/* ============================================================
   EduPay Multi — Design System
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── CSS variables ─────────────────────────────────────────── */
:root {
  --primary:       #2B7FFF;
  --primary-dark:  #1A6FEE;
  --primary-light: #EFF6FF;
  --primary-rgb:   43,127,255;
  --success:       #10B981;
  --danger:        #EF4444;
  --warning:       #F59E0B;
  --bg:            #F1F5F9;
  --card-bg:       #FFFFFF;
  --text:          #0F172A;
  --text-muted:    #64748B;
  --border:        #E2E8F0;
  --radius:        10px;
  --radius-sm:     6px;
  --radius-lg:     16px;
  --shadow:        0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:     0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.05);
  --shadow-lg:     0 8px 30px rgba(0,0,0,.12);
  --sidebar-bg:    #0284C7;
  --sidebar-width: 240px;
}

/* ── Base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background:  var(--bg);
  color:       var(--text);
  margin:      0;
  -webkit-font-smoothing: antialiased;
}

/* ── App layout ────────────────────────────────────────────── */
.app-layout {
  display:    flex;
  min-height: 100vh;
}

.sidebar {
  width:          var(--sidebar-width);
  background:     var(--sidebar-bg);
  display:        flex;
  flex-direction: column;
  flex-shrink:    0;
  transition:     transform .28s cubic-bezier(.4,0,.2,1);
}

.main {
  flex:           1;
  display:        flex;
  flex-direction: column;
  overflow:       hidden;
  min-width:      0;
}

.topbar {
  background:      var(--card-bg);
  border-bottom:   1px solid var(--border);
  padding:         0 1.5rem;
  height:          60px;
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  gap:             .75rem;
  flex-shrink:     0;
  box-shadow:      var(--shadow);
  position:        sticky;
  top:             0;
  z-index:         100;
}

.topbar-title {
  font-weight: 700;
  font-size:   1rem;
  color:       var(--text);
}

.content {
  flex:       1;
  overflow-y: auto;
  padding:    1.5rem;
}

/* ── Sidebar brand ─────────────────────────────────────────── */
.sidebar-brand {
  padding:       1.25rem 1rem 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink:   0;
}
.sidebar-brand-name {
  font-size:      1.4rem;
  font-weight:    800;
  color:          #fff;
  letter-spacing: -.02em;
}
.sidebar-brand-name span { color: #BAE6FD; }
.sidebar-brand-sub {
  font-size:      .7rem;
  color:          rgba(255,255,255,.55);
  margin-top:     .2rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight:    600;
}

/* ── Mobile hamburger ──────────────────────────────────────── */
.menu-toggle {
  display:         none;
  align-items:     center;
  justify-content: center;
  width:           38px;
  height:          38px;
  border:          none;
  background:      transparent;
  cursor:          pointer;
  border-radius:   var(--radius-sm);
  color:           var(--text-muted);
  transition:      background .15s;
  flex-shrink:     0;
}
.menu-toggle:hover { background: var(--bg); }

.sidebar-backdrop {
  display:    none;
  position:   fixed;
  inset:      0;
  background: rgba(0,0,0,.5);
  z-index:    999;
  backdrop-filter: blur(2px);
}

@media (max-width: 768px) {
  .menu-toggle { display: flex; }
  .sidebar {
    position:   fixed;
    top: 0; left: 0; bottom: 0;
    z-index:    1000;
    transform:  translateX(-100%);
    box-shadow: 4px 0 24px rgba(0,0,0,.3);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background:    var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow:    var(--shadow);
  padding:       1.5rem;
  border:        1px solid rgba(226,232,240,.7);
  transition:    box-shadow .2s;
}
.card:hover { box-shadow: var(--shadow-md); }

/* ── Stat cards ────────────────────────────────────────────── */
.stat-card {
  display:        flex;
  flex-direction: column;
  gap:            .4rem;
  position:       relative;
  overflow:       hidden;
}
.stat-card::after {
  content:       '';
  position:      absolute;
  top:     -16px;
  right:   -16px;
  width:    72px;
  height:   72px;
  border-radius: 50%;
  background:    rgba(var(--primary-rgb),.07);
}
.stat-card .stat-value {
  font-size:   2rem;
  font-weight: 800;
  line-height: 1.1;
  color:       var(--text);
}
.stat-card .stat-label {
  font-size:      .75rem;
  font-weight:    600;
  color:          var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display:       inline-flex;
  align-items:   center;
  gap:           .4rem;
  padding:       .55rem 1.1rem;
  border-radius: var(--radius);
  font-size:     .875rem;
  font-weight:   600;
  cursor:        pointer;
  border:        none;
  transition:    background .15s, opacity .15s, box-shadow .15s, transform .08s;
  line-height:   1.4;
  white-space:   nowrap;
  font-family:   inherit;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color:      #fff;
  box-shadow: 0 1px 2px rgba(79,70,229,.3);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(79,70,229,.4);
}

.btn-success {
  background: var(--success);
  color:      #fff;
  box-shadow: 0 1px 2px rgba(16,185,129,.25);
}
.btn-success:hover:not(:disabled) { background: #059669; }

.btn-danger {
  background: var(--danger);
  color:      #fff;
  box-shadow: 0 1px 2px rgba(239,68,68,.25);
}
.btn-danger:hover:not(:disabled) { background: #DC2626; }

.btn-ghost    { background: transparent; color: var(--text-muted); }
.btn-ghost:hover:not(:disabled)   { background: var(--bg); color: var(--text); }

/* Sign-out button inside sidebar — keep white text, use translucent hover */
.sidebar .btn-ghost              { color: rgba(255,255,255,.72); }
.sidebar .btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,.12); color: #fff; }

.btn-outline {
  background: transparent;
  border:     1.5px solid var(--border);
  color:      var(--text);
}
.btn-outline:hover:not(:disabled) { background: var(--bg); border-color: #CBD5E1; }

.btn-sm { padding: .35rem .75rem; font-size: .8rem; border-radius: var(--radius-sm); }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }

/* ── Form elements ─────────────────────────────────────────── */
.form-input, .form-select, .form-textarea {
  width:         100%;
  padding:       .55rem .85rem;
  border:        1.5px solid var(--border);
  border-radius: var(--radius);
  font-size:     .9rem;
  font-family:   inherit;
  color:         var(--text);
  background:    #fff;
  transition:    border-color .15s, box-shadow .15s;
  line-height:   1.5;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline:      none;
  border-color: var(--primary);
  box-shadow:   0 0 0 3px rgba(79,70,229,.12);
}

.form-input::placeholder, .form-textarea::placeholder { color: #CBD5E1; }

label.form-label {
  display:        block;
  font-size:      .75rem;
  font-weight:    700;
  margin-bottom:  .4rem;
  color:          var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.form-group { margin-bottom: 1.1rem; }

/* ── Badge ─────────────────────────────────────────────────── */
.badge {
  display:        inline-flex;
  align-items:    center;
  padding:        .2rem .65rem;
  border-radius:  99px;
  font-size:      .7rem;
  font-weight:    700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.badge-green  { background: #D1FAE5; color: #065F46; }
.badge-red    { background: #FEE2E2; color: #991B1B; }
.badge-yellow { background: #FEF3C7; color: #92400E; }
.badge-blue   { background: #DBEAFE; color: #1E40AF; }
.badge-gray   { background: #F1F5F9; color: #475569; }

/* ── Table ─────────────────────────────────────────────────── */
.data-table {
  width:           100%;
  border-collapse: collapse;
  font-size:       .875rem;
}
.data-table th {
  text-align:     left;
  padding:        .65rem 1rem;
  background:     #F8FAFC;
  color:          var(--text-muted);
  font-size:      .72rem;
  font-weight:    700;
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom:  2px solid var(--border);
  white-space:    nowrap;
}
.data-table td {
  padding:        .75rem 1rem;
  border-bottom:  1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .12s; }
.data-table tbody tr:hover { background: #F8FAFC; }

/* ── Sidebar nav ───────────────────────────────────────────── */
.nav-link {
  display:         flex;
  align-items:     center;
  gap:             .625rem;
  padding:         .625rem .875rem;
  border-radius:   var(--radius);
  font-size:       .875rem;
  font-weight:     500;
  color:           rgba(255,255,255,.72);
  text-decoration: none;
  transition:      background .15s, color .15s;
  position:        relative;
}
.nav-link:hover  { background: rgba(255,255,255,.12); color: #fff; }
.nav-link.active {
  background:  rgba(0,0,0,.18);
  color:       #fff;
  font-weight: 600;
}
.nav-link.active::before {
  content:      '';
  position:     absolute;
  left:         0; top: 50%;
  transform:    translateY(-50%);
  width:        3px; height: 60%;
  background:   #fff;
  border-radius: 0 3px 3px 0;
}

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position:        fixed;
  inset:           0;
  background:      rgba(15,23,42,.55);
  display:         flex;
  align-items:     center;
  justify-content: center;
  z-index:         9000;
  padding:         1rem;
  backdrop-filter: blur(3px);
}
.modal-overlay.hidden { display: none; }

.modal-box {
  background:     #fff;
  border-radius:  var(--radius-lg);
  box-shadow:     0 20px 60px rgba(0,0,0,.22);
  width:          100%;
  max-width:      540px;
  max-height:     90vh;
  display:        flex;
  flex-direction: column;
  overflow:       hidden;
  animation:      modalIn .22s cubic-bezier(.34,1.56,.64,1);
}
.modal-box.modal-lg  { max-width: 720px; }
.modal-box.modal-xl  { max-width: 900px; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(.92) translateY(16px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}

.modal-header {
  display:          flex;
  align-items:      center;
  justify-content:  space-between;
  padding:          1.25rem 1.5rem;
  border-bottom:    1px solid var(--border);
  flex-shrink:      0;
  background:       #FAFAFA;
}
.modal-header h3 { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--text); }

.modal-body   { padding: 1.5rem; overflow-y: auto; flex: 1; }
.modal-footer {
  padding:         1rem 1.5rem;
  border-top:      1px solid var(--border);
  display:         flex;
  justify-content: flex-end;
  gap:             .5rem;
  flex-shrink:     0;
  background:      #FAFAFA;
}

/* ── Auth / Login pages ────────────────────────────────────── */
.auth-page {
  min-height:      100vh;
  display:         flex;
  align-items:     center;
  justify-content: center;
  background:      #F1F5F9;
  padding:         1.5rem;
}
.auth-card {
  background:    #fff;
  border-radius: var(--radius-lg);
  box-shadow:    0 4px 32px rgba(0,0,0,.10), 0 1px 4px rgba(0,0,0,.06);
  width:         100%;
  max-width:     420px;
  overflow:      hidden;
}
.auth-card-header {
  background:  #fff;
  padding:     2rem 2rem 1.25rem;
  text-align:  center;
  border-bottom: 1px solid var(--border);
}
.auth-logo {
  font-size:      2rem;
  font-weight:    800;
  color:          var(--primary);
  letter-spacing: -.04em;
  line-height:    1;
}
.auth-logo span { color: var(--primary-dark); }
.auth-subtitle {
  color:       var(--text-muted);
  font-size:   .875rem;
  margin:      .35rem 0 0;
  font-weight: 500;
}
.auth-card-body { padding: 2rem; }

/* ── Toast ─────────────────────────────────────────────────── */
#toast-container {
  position:       fixed;
  top:            1.25rem;
  right:          1.25rem;
  z-index:        99999;
  display:        flex;
  flex-direction: column;
  gap:            .5rem;
  pointer-events: none;
}
.toast {
  display:        flex;
  align-items:    center;
  gap:            .75rem;
  padding:        .875rem 1.25rem;
  border-radius:  var(--radius);
  box-shadow:     var(--shadow-lg);
  font-size:      .875rem;
  font-weight:    600;
  min-width:      260px;
  max-width:      380px;
  animation:      slideIn .22s cubic-bezier(.34,1.56,.64,1);
  pointer-events: auto;
  border-left:    4px solid transparent;
  background:     #fff;
  color:          var(--text);
}
.toast-success { border-left-color: var(--success); }
.toast-error   { border-left-color: var(--danger);  }
.toast-info    { border-left-color: var(--primary); }
.toast-warning { border-left-color: var(--warning); }

@keyframes slideIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes fadeOut {
  to { opacity: 0; transform: translateX(24px); }
}

/* ── Loading spinner ───────────────────────────────────────── */
.spinner {
  width:         20px;
  height:        20px;
  border:        2.5px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation:     spin .65s linear infinite;
  display:       inline-block;
  flex-shrink:   0;
}
.spinner-dark {
  border-color:     rgba(79,70,229,.15);
  border-top-color: var(--primary);
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Page loading overlay ──────────────────────────────────── */
#page-loading {
  position:        fixed;
  inset:           0;
  background:      rgba(255,255,255,.88);
  display:         flex;
  align-items:     center;
  justify-content: center;
  z-index:         9999;
}
#page-loading.hidden { display: none; }

/* ── Stats grid ────────────────────────────────────────────── */
.stats-grid {
  display:               grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap:                   1rem;
  margin-bottom:         1.5rem;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .modal-box {
    max-width:     100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    align-self:    flex-end;
    max-height:    95vh;
  }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .data-table    { font-size: .8rem; }
  .content       { padding: 1rem; }
  .topbar        { padding: 0 1rem; height: 56px; }
  .stats-grid    { grid-template-columns: 1fr 1fr; }
}
