/* ============================================
   GLOBAL NEW ERA PRIVATE HIGH SCHOOL
   Fee Structure — Main Stylesheet
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

/* ─── CSS Variables ─── */
:root {
  --bg:        #F8FAFC;
  --surface:   #FFFFFF;
  --surface2:  #F1F5F9;
  --primary:   #2563EB;
  --primary-light: #EFF6FF;
  --secondary: #0F172A;
  --text:      #0F172A;
  --text-muted:#64748B;
  --border:    #E2E8F0;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-md: 0 4px 20px rgba(0,0,0,.10), 0 1px 4px rgba(0,0,0,.06);
  --radius:    14px;
  --radius-sm: 8px;
  --transition: .25s cubic-bezier(.4,0,.2,1);
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
}

[data-theme="dark"] {
  --bg:        #0F172A;
  --surface:   #1E293B;
  --surface2:  #273447;
  --primary:   #3B82F6;
  --primary-light: #1e3a5f;
  --secondary: #F8FAFC;
  --text:      #F8FAFC;
  --text-muted:#94A3B8;
  --border:    #334155;
  --shadow:    0 1px 3px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  --shadow-md: 0 4px 20px rgba(0,0,0,.35), 0 1px 4px rgba(0,0,0,.2);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ─── Utility ─── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ═══════════════════════════════════════════
   NAV
═══════════════════════════════════════════ */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  transition: background var(--transition), border-color var(--transition);
}

.nav__inner {
  display: flex; align-items: center; gap: 16px;
  height: 64px;
}

.nav__brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: var(--text);
  flex-shrink: 0;
}

.nav__logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav__logo-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.nav__name {
  font-family: var(--font-display); font-weight: 700; font-size: 17px;
  line-height: 1.2;
}
.nav__name small { display: block; font-family: var(--font-body); font-size: 11px; font-weight: 400; color: var(--text-muted); }

.nav__search {
  flex: 1; max-width: 380px;
  position: relative;
}

.nav__search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-muted); pointer-events: none;
}

#navSearch {
  width: 100%; height: 38px; padding: 0 12px 0 38px;
  border: 1px solid var(--border); border-radius: 99px;
  background: var(--surface2); color: var(--text); font-family: var(--font-body); font-size: 14px;
  outline: none;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
#navSearch:focus {
  border-color: var(--primary); background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
#navSearch::placeholder { color: var(--text-muted); }

.nav__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.btn-icon {
  width: 38px; height: 38px; border: 1px solid var(--border);
  border-radius: 99px; background: var(--surface2);
  display: grid; place-items: center; color: var(--text-muted);
  transition: all var(--transition); flex-shrink: 0;
}
.btn-icon:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-icon svg { width: 18px; height: 18px; }

.hamburger {
  display: none; flex-direction: column; gap: 5px; width: 38px; height: 38px;
  align-items: center; justify-content: center; border: 1px solid var(--border);
  border-radius: 99px; background: var(--surface2);
}
.hamburger span { width: 18px; height: 2px; background: var(--text); border-radius: 2px; transition: var(--transition); }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ═══════════════════════════════════════════
   HERO
═══════════════════════════════════════════ */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 45%, #7c3aed 100%);
  color: #fff; padding: 72px 0 80px; position: relative; overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Ccircle cx='30' cy='30' r='28'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
  opacity: .5;
}

.hero::after {
  content: '';
  position: absolute; bottom: -1px; left: 0; right: 0; height: 48px;
  background: var(--bg);
  clip-path: ellipse(60% 100% at 50% 100%);
  transition: background var(--transition);
}

.hero__inner { position: relative; z-index: 1; text-align: center; }

.hero__badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.25);
  border-radius: 99px; padding: 5px 14px; font-size: 12px; font-weight: 500;
  letter-spacing: .5px; text-transform: uppercase; margin-bottom: 20px;
  backdrop-filter: blur(8px);
}
.hero__badge-dot { width: 6px; height: 6px; border-radius: 50%; background: #4ade80; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.6;transform:scale(.85)} }

.hero__logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero__logo {
    width: 120px;   /* Adjust size as needed */
    height: 120px;
    object-fit: contain;
}

.hero__title {
  font-family: var(--font-display); font-size: clamp(24px, 5vw, 44px); font-weight: 700;
  line-height: 1.15; margin-bottom: 8px;
  text-shadow: 0 2px 12px rgba(0,0,0,.2);
}

.hero__sub { font-size: 15px; opacity: .8; margin-bottom: 4px; }
.hero__location { font-size: 13px; opacity: .65; }

.hero__meta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 28px;
}
.hero__chip {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.2);
  border-radius: 99px; padding: 6px 14px; font-size: 13px; font-weight: 500;
  backdrop-filter: blur(8px);
}
.hero__chip svg { width: 14px; height: 14px; opacity: .8; }

/* ═══════════════════════════════════════════
   STATS DASHBOARD
═══════════════════════════════════════════ */
.stats { padding: 48px 0 0; }

.stats__grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}

.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  animation: fadeUp .4s ease both;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-card__icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: grid; place-items: center; flex-shrink: 0;
}
.stat-card__icon svg { width: 24px; height: 24px; color: #fff; }

.stat-card__label { font-size: 12px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.stat-card__value { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--text); line-height: 1; }

/* ═══════════════════════════════════════════
   CONTROLS BAR
═══════════════════════════════════════════ */
.controls { padding: 32px 0 0; }

.controls__top {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}

.controls__title { font-family: var(--font-display); font-size: 22px; font-weight: 700; margin-right: auto; }

.view-toggle {
  display: flex; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 99px; padding: 3px; gap: 2px;
}
.view-btn {
  display: flex; align-items: center; gap: 6px; padding: 7px 14px;
  border: none; background: transparent; color: var(--text-muted);
  border-radius: 99px; font-size: 13px; font-weight: 500;
  transition: all var(--transition);
}
.view-btn svg { width: 15px; height: 15px; }
.view-btn.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

.controls__filters {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

.filter-select {
  height: 38px; padding: 0 34px 0 14px; border: 1px solid var(--border);
  border-radius: 99px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 12px center;
  -webkit-appearance: none; appearance: none;
  color: var(--text); font-family: var(--font-body); font-size: 13px; font-weight: 500;
  outline: none; cursor: pointer;
  transition: border-color var(--transition), background-color var(--transition);
}
.filter-select:focus { border-color: var(--primary); }

.sort-select { min-width: 170px; }

.controls__results {
  font-size: 13px; color: var(--text-muted); margin-left: auto; white-space: nowrap;
}

/* Export buttons */
.export-group { display: flex; gap: 8px; }
.btn-export {
  display: flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 99px;
  font-size: 12px; font-weight: 600; letter-spacing: .3px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); transition: all var(--transition);
}
.btn-export svg { width: 13px; height: 13px; }
.btn-export:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* ═══════════════════════════════════════════
   CARDS VIEW
═══════════════════════════════════════════ */
.fee-section { padding: 24px 0 60px; }

.cards-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px;
}

.fee-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
  animation: fadeUp .4s ease both;
  display: flex; flex-direction: column;
}
.fee-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.fee-card:hover .card__arrow { transform: translateX(4px); }

.card__header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}

.card__grade { font-family: var(--font-display); font-size: 18px; font-weight: 700; line-height: 1.2; }
.card__arrow { width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; margin-top: 2px; transition: transform var(--transition); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 99px; font-size: 11px; font-weight: 600;
  letter-spacing: .4px; text-transform: uppercase; margin-top: 6px;
}
.badge--regular { background: #dbeafe; color: #1d4ed8; }
.badge--premium { background: #dcfce7; color: #15803d; }
[data-theme="dark"] .badge--regular { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge--premium { background: #064e3b; color: #86efac; }

.badge svg { width: 11px; height: 11px; }

.card__body { padding: 16px 20px 20px; flex: 1; }

.card__row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.card__row:last-child { border-bottom: none; }
.card__row-label { color: var(--text-muted); font-weight: 400; }
.card__row-value { font-weight: 600; color: var(--text); }

.card__installments {
  margin: 12px 0;
  background: var(--surface2); border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.card__inst-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: 8px; }
.card__inst-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 10px; font-size: 12px; font-weight: 500; color: var(--text);
}

.card__footer {
  padding: 14px 20px;
  background: var(--surface2); border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.card__footer-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); }
.card__total {
  font-family: var(--font-display); font-size: 22px; font-weight: 700;
}

/* ─── Accent stripe per card ─── */
.card__stripe {
  height: 4px; width: 100%;
  background: var(--card-accent, var(--primary));
}

/* ═══════════════════════════════════════════
   TABLE VIEW
═══════════════════════════════════════════ */
.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: auto; box-shadow: var(--shadow);
}

.fee-table { width: 100%; border-collapse: collapse; font-size: 14px; }

.fee-table thead { background: var(--surface2); position: sticky; top: 0; z-index: 1; }
.fee-table th {
  padding: 14px 18px; text-align: left;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.fee-table td { padding: 14px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.fee-table tbody tr:last-child td { border-bottom: none; }
.fee-table tbody tr { transition: background var(--transition); cursor: pointer; }
.fee-table tbody tr:hover { background: var(--surface2); }

.fee-table .td-grade { font-weight: 600; white-space: nowrap; }
.fee-table .td-total { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.fee-table .td-inst { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* ═══════════════════════════════════════════
   NO RESULTS
═══════════════════════════════════════════ */
.no-results {
  text-align: center; padding: 80px 24px; color: var(--text-muted);
  display: none;
}
.no-results svg { width: 48px; height: 48px; margin: 0 auto 16px; opacity: .4; }
.no-results h3 { font-family: var(--font-display); font-size: 20px; color: var(--text); margin-bottom: 6px; }

/* ═══════════════════════════════════════════
   MODAL
═══════════════════════════════════════════ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.45); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity var(--transition);
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }
.modal-backdrop.open .modal { transform: scale(1) translateY(0); }

.modal {
  background: var(--surface); border-radius: 20px; width: 100%; max-width: 520px;
  box-shadow: 0 25px 60px rgba(0,0,0,.25); overflow: hidden;
  transform: scale(.95) translateY(16px); transition: transform var(--transition);
}

.modal__header {
  padding: 24px 24px 20px;
  display: flex; justify-content: space-between; align-items: flex-start;
  border-bottom: 1px solid var(--border);
}
.modal__title { font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.modal__close {
  width: 34px; height: 34px; border-radius: 99px;
  background: var(--surface2); border: 1px solid var(--border);
  display: grid; place-items: center; color: var(--text-muted);
  transition: all var(--transition); flex-shrink: 0;
}
.modal__close:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.modal__close svg { width: 16px; height: 16px; }

.modal__body { padding: 24px; }

.modal__section { margin-bottom: 20px; }
.modal__section-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-muted); margin-bottom: 10px;
}

.modal__row {
  display: flex; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.modal__row:last-child { border-bottom: none; }
.modal__row-label { color: var(--text-muted); }
.modal__row-value { font-weight: 600; }

.modal__total-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #1d4ed8, #7c3aed); color: #fff; margin-top: 20px;
}
.modal__total-label { font-size: 14px; font-weight: 500; }
.modal__total-value { font-family: var(--font-display); font-size: 24px; font-weight: 700; }

.modal__actions {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; gap: 10px;
}

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 0 20px; height: 40px; border-radius: 99px; font-size: 14px; font-weight: 600; border: none; transition: all var(--transition); }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { filter: brightness(1.1); }
.btn--outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn--outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn svg { width: 15px; height: 15px; }

/* ═══════════════════════════════════════════
   LOADING SKELETONS
═══════════════════════════════════════════ */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--surface2) 50%, var(--border) 75%);
  background-size: 600px;
  animation: shimmer 1.5s infinite linear;
  border-radius: 6px;
}

.skeleton-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; height: 280px;
}

/* ═══════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════ */
.footer {
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 28px 0; text-align: center;
  font-size: 13px; color: var(--text-muted);
  transition: background var(--transition);
}
.footer span { color: var(--text); font-weight: 600; }

/* ═══════════════════════════════════════════
   ANIMATIONS
═══════════════════════════════════════════ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.fade-in { animation: fadeIn .4s ease both; }

/* stagger children */
.cards-grid > * { animation-delay: calc(var(--card-index, 0) * 50ms); }

/* ═══════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════ */
@media (max-width: 900px) {
  .stats__grid { grid-template-columns: repeat(2, 1fr); }
  .hamburger { display: flex; }
  .nav__search, .nav__name small { display: none; }
}

@media (max-width: 640px) {
  .stats__grid { grid-template-columns: 1fr 1fr; }
  .controls__top { flex-wrap: wrap; }
  .controls__title { font-size: 18px; }
  .cards-grid { grid-template-columns: 1fr; }
  .hero { padding: 52px 0 60px; }
  .export-group { display: none; }
  .controls__filters { width: 100%; }
  .filter-select { flex: 1; min-width: 130px; }
}

@media (max-width: 400px) {
  .stats__grid { grid-template-columns: 1fr; }
}

/* Print */
@media print {
  .nav, .controls, .hero, .footer, .modal__actions { display: none !important; }
  .modal-backdrop { position: static; opacity: 1; background: none; pointer-events: all; }
  .modal { box-shadow: none; max-width: 100%; border: none; }
}
