/* ============================================================
   EduCash Admin Dashboard — Design System
   ============================================================ */

/* ─── Variables ─────────────────────────────────────────── */
:root {
  --primary:        #6366f1;
  --primary-dark:   #4f46e5;
  --primary-light:  #e0e7ff;
  --secondary:      #0ea5e9;
  --success:        #10b981;
  --warning:        #f59e0b;
  --danger:         #ef4444;
  --info:           #8b5cf6;

  --bg:             #0f172a;
  --bg-card:        #1e293b;
  --bg-card-hover:  #263147;
  --bg-sidebar:     #0f172a;
  --bg-input:       #1e293b;

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;

  --border:         #1e293b;
  --border-light:   #334155;

  --sidebar-w:      260px;
  --topbar-h:       64px;
  --radius:         12px;
  --radius-sm:      8px;
  --shadow:         0 4px 24px rgba(0,0,0,0.3);
  --transition:     0.25s cubic-bezier(0.4,0,0.2,1);
}

/* ─── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ─── Layout ─────────────────────────────────────────────── */
.ec-body {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────── */
.ec-sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transform: translateX(-100%);
  transition: transform var(--transition);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}

.ec-sidebar--open { transform: translateX(0); }

.ec-sidebar__logo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-light);
}

.ec-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ec-logo__icon {
  font-size: 28px;
  filter: drop-shadow(0 0 8px rgba(99,102,241,0.6));
}

.ec-logo__text {
  font-size: 1.3rem;
  font-weight: 700;
  background: linear-gradient(135deg, #6366f1, #0ea5e9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ec-sidebar__close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color var(--transition);
}
.ec-sidebar__close:hover { color: var(--text-primary); }

/* School badge */
.ec-sidebar__school {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
}

.ec-school-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(14,165,233,0.1));
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.ec-school-badge__avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.ec-school-badge__info { display: flex; flex-direction: column; overflow: hidden; }
.ec-school-badge__name { font-size: 0.8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ec-school-badge__role { font-size: 0.7rem; color: var(--primary); font-weight: 500; }

/* Navigation */
.ec-nav {
  flex: 1;
  padding: 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ec-nav__section-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  padding: 14px 8px 6px;
}

.ec-nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  position: relative;
  cursor: pointer;
}

.ec-nav__item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}

.ec-nav__item--active {
  background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(14,165,233,0.1));
  color: #a5b4fc;
  border: 1px solid rgba(99,102,241,0.25);
}

.ec-nav__item--active .ec-nav__icon { color: var(--primary); }

.ec-nav__icon {
  width: 18px;
  text-align: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.ec-sidebar__footer {
  padding: 16px;
  border-top: 1px solid var(--border-light);
}

.ec-sidebar__logout {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: none;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition);
}
.ec-sidebar__logout:hover {
  background: rgba(239,68,68,0.1);
  border-color: rgba(239,68,68,0.3);
  color: #fca5a5;
}

/* ─── Overlay (mobile) ───────────────────────────────────── */
.ec-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  backdrop-filter: blur(2px);
}
.ec-overlay--visible { display: block; }
@media (min-width: 1024px) { .ec-overlay { display: none !important; } }

/* ─── Main Content ───────────────────────────────────────── */
.ec-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition);
}

@media (min-width: 1024px) {
  .ec-sidebar { transform: translateX(0); }
  .ec-main--shifted { margin-left: var(--sidebar-w); }
}

/* ─── Topbar ─────────────────────────────────────────────── */
.ec-topbar {
  height: var(--topbar-h);
  background: rgba(15,23,42,0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.ec-topbar__menu-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 6px;
  border-radius: 6px;
  transition: color var(--transition);
}
.ec-topbar__menu-btn:hover { color: var(--text-primary); }

.ec-topbar__title { flex: 1; }
.ec-topbar__title h1 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}
.ec-topbar__title p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.ec-topbar__actions { display: flex; align-items: center; gap: 12px; }

.ec-topbar__user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ec-topbar__avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.ec-topbar__name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: none;
}
@media (min-width: 640px) { .ec-topbar__name { display: block; } }

/* ─── Content Area ───────────────────────────────────────── */
.ec-content {
  flex: 1;
  padding: 24px;
}
@media (max-width: 640px) { .ec-content { padding: 16px; } }

/* ─── Cards ──────────────────────────────────────────────── */
.ec-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  transition: box-shadow var(--transition);
}

.ec-card:hover { box-shadow: var(--shadow); }
.ec-card--sm { padding: 16px; }

.ec-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.ec-card__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}
.ec-card__subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ─── Stat Cards ─────────────────────────────────────────── */
.ec-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.ec-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.ec-stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--stat-color, var(--primary));
}

.ec-stat-card:hover {
  border-color: rgba(99,102,241,0.3);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.ec-stat-card__icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  background: var(--stat-bg, rgba(99,102,241,0.15));
  color: var(--stat-color, var(--primary));
  flex-shrink: 0;
}

.ec-stat-card__body { flex: 1; min-width: 0; }

.ec-stat-card__label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ec-stat-card__value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  margin: 4px 0;
}

.ec-stat-card__trend {
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 4px;
}
.ec-stat-card__trend--up { color: var(--success); }
.ec-stat-card__trend--down { color: var(--danger); }

/* ─── Tables ─────────────────────────────────────────────── */
.ec-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
}

.ec-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}

.ec-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.ec-table td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-secondary);
  vertical-align: middle;
}

.ec-table tbody tr {
  transition: background var(--transition);
}

.ec-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.ec-table tbody tr:last-child td { border-bottom: none; }

/* ─── Badges ─────────────────────────────────────────────── */
.ec-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.ec-badge--primary { background: rgba(99,102,241,0.15); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.2); }
.ec-badge--success { background: rgba(16,185,129,0.15); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.2); }
.ec-badge--warning { background: rgba(245,158,11,0.15); color: #fcd34d; border: 1px solid rgba(245,158,11,0.2); }
.ec-badge--danger  { background: rgba(239,68,68,0.15);  color: #fca5a5; border: 1px solid rgba(239,68,68,0.2);  }
.ec-badge--info    { background: rgba(139,92,246,0.15); color: #c4b5fd; border: 1px solid rgba(139,92,246,0.2); }
.ec-badge--muted   { background: rgba(148,163,184,0.1); color: #94a3b8; border: 1px solid rgba(148,163,184,0.1); }

/* ─── Buttons ────────────────────────────────────────────── */
.ec-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.ec-btn--primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}
.ec-btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99,102,241,0.45);
}

.ec-btn--success {
  background: linear-gradient(135deg, var(--success), #059669);
  color: white;
  box-shadow: 0 4px 12px rgba(16,185,129,0.25);
}
.ec-btn--success:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(16,185,129,0.4); }

.ec-btn--danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: white;
  box-shadow: 0 4px 12px rgba(239,68,68,0.25);
}

.ec-btn--outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}
.ec-btn--outline:hover { border-color: var(--primary); color: var(--primary); }

.ec-btn--sm { padding: 6px 12px; font-size: 0.8rem; }
.ec-btn--icon { padding: 8px; width: 34px; height: 34px; justify-content: center; }

/* ─── Forms ──────────────────────────────────────────────── */
.ec-form-group { margin-bottom: 18px; }

.ec-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.ec-input,
.ec-select,
.ec-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.ec-input:focus,
.ec-select:focus,
.ec-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.ec-input::placeholder { color: var(--text-muted); }
.ec-select option { background: var(--bg-card); }
.ec-textarea { resize: vertical; min-height: 90px; }

.ec-input-group {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color var(--transition);
}
.ec-input-group:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.ec-input-group__prefix, .ec-input-group__suffix {
  padding: 10px 12px;
  color: var(--text-muted);
  font-size: 0.875rem;
  background: rgba(255,255,255,0.03);
  border-right: 1px solid var(--border-light);
  white-space: nowrap;
}
.ec-input-group__suffix { border-right: none; border-left: 1px solid var(--border-light); }
.ec-input-group .ec-input { border: none; background: transparent; box-shadow: none; }
.ec-input-group .ec-input:focus { box-shadow: none; }

.ec-form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 5px; }
.ec-form-error { font-size: 0.75rem; color: var(--danger); margin-top: 5px; }

/* ─── Alerts ─────────────────────────────────────────────── */
.ec-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  margin: 0 24px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
}

.ec-alert--success { background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.25); color: #6ee7b7; }
.ec-alert--danger { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.25); color: #fca5a5; }
.ec-alert--warning { background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.25); color: #fcd34d; }
.ec-alert__close { margin-left: auto; background: none; border: none; cursor: pointer; color: inherit; opacity: 0.7; }
.ec-alert__close:hover { opacity: 1; }

/* ─── Modals ─────────────────────────────────────────────── */
.ec-modal-backdrop, .ec-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ec-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0,0,0,0.5);
}

.ec-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
}
.ec-modal__title { font-size: 1rem; font-weight: 700; }
.ec-modal__close {
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary); font-size: 1.1rem;
  padding: 4px 8px; border-radius: 6px; transition: color var(--transition);
}
.ec-modal__close:hover { color: var(--danger); }
.ec-modal__body { padding: 24px; }
.ec-modal__footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ─── Page Header ────────────────────────────────────────── */
.ec-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.ec-page-header__left h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: 4px; }
.ec-page-header__left p { color: var(--text-secondary); font-size: 0.875rem; }

/* ─── Grid ───────────────────────────────────────────────── */
.ec-grid { display: grid; gap: 20px; }
.ec-grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.ec-grid--3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* ─── Avatar / Photo ─────────────────────────────────────── */
.ec-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* ─── Pagination ─────────────────────────────────────────── */
.ec-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding-top: 20px;
}
.ec-pagination a, .ec-pagination span {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  transition: all var(--transition);
}
.ec-pagination a:hover { border-color: var(--primary); color: var(--primary); }
.ec-pagination .active span { background: var(--primary); border-color: var(--primary); color: white; }
.ec-pagination [disabled] span { opacity: 0.4; cursor: not-allowed; }

/* ─── Misc Utilities ─────────────────────────────────────── */
.ec-divider { border: none; border-top: 1px solid var(--border-light); margin: 20px 0; }
.ec-text-primary { color: var(--text-primary); }
.ec-text-secondary { color: var(--text-secondary); }
.ec-text-muted { color: var(--text-muted); }
.ec-text-success { color: var(--success); }
.ec-text-danger { color: var(--danger); }
.ec-text-warning { color: var(--warning); }
.ec-fw-bold { font-weight: 700; }
.ec-fs-sm { font-size: 0.8rem; }
.ec-mb-0 { margin-bottom: 0 !important; }

/* ─── Empty State ────────────────────────────────────────── */
.ec-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.ec-empty__icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.4; }
.ec-empty__title { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.ec-empty__desc { font-size: 0.85rem; }

/* ─── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ─── Auth Page ──────────────────────────────────────────── */
.ec-auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 20% 20%, rgba(99,102,241,0.15) 0%, transparent 50%),
                    radial-gradient(ellipse at 80% 80%, rgba(14,165,233,0.1) 0%, transparent 50%);
  padding: 24px;
}

.ec-auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.4);
}
