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

:root {
  --bg:          #f5f5f7;
  --surface:     #ffffff;
  --surface-2:   #f0f0f5;
  --surface-3:   #e8e8f0;
  --border:      #e0dfe8;
  --border-light:#d0cfe0;
  --gold:        #c07a10;
  --gold-dim:    #a06508;
  --gold-bg:     #fef3e2;
  --purple:      #7c3aed;
  --text:        #1a1825;
  --text-muted:  #6b6880;
  --text-dim:    #9b98b0;
  --green:       #16a34a;
  --green-bg:    #dcfce7;
  --red:         #dc2626;
  --red-bg:      #fee2e2;
  --yellow:      #d97706;
  --yellow-bg:   #fef3c7;
  --sidebar-w:   220px;
  --topbar-h:    56px;
}

html { font-size: 15px; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* ── Typography ────────────────────────────────────────────────────────── */
h1 { font-size: 1.4rem; font-weight: 600; }
h2 { font-size: 1.1rem; font-weight: 600; }
h3 { font-size: 0.95rem; font-weight: 600; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-dim); }

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

/* ── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  height: 64px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo img { height: 36px; width: auto; display: block; }

.sidebar-nav { flex: 1; padding: 0; }

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 18px 18px 4px;
}
.sidebar-nav .nav-section-label:first-child { padding-top: 14px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
  position: relative;
  cursor: pointer;
  text-decoration: none;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--gold-bg);
  color: var(--gold);
  border-left: 2px solid var(--gold);
  padding-left: 16px;
}
.nav-item .icon { font-size: 1rem; width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto;
  background: var(--gold);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}
.sidebar-footer a { color: var(--text-muted); }
.sidebar-footer a:hover { color: var(--red); }

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

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 1rem; font-weight: 600; flex: 1; }
.topbar-meta { font-size: 0.8rem; color: var(--text-muted); }

.content { padding: 24px; flex: 1; }

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-weight: 600; font-size: 0.95rem; }

/* ── Stats row ─────────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
}
.stat-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--text); line-height: 1; }
.stat-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.stat-card.highlight { border-color: var(--gold); }
.stat-card.highlight .stat-value { color: var(--gold); }

/* ── Tabs ──────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tab-btn {
  padding: 8px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }
.tab-count {
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 8px;
}
.tab-btn.active .tab-count { background: var(--gold); color: #fff; }

/* ── Booking cards ─────────────────────────────────────────────────────── */
.booking-list { display: flex; flex-direction: column; gap: 14px; }

.booking-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  transition: border-color 0.15s;
}
.booking-card:hover { border-color: var(--border-light); }
.booking-card.approved { border-left: 3px solid var(--green); }
.booking-card.rejected { border-left: 3px solid var(--red); opacity: 0.6; }

.booking-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.booking-name { font-weight: 600; font-size: 1rem; }
.booking-contact { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }
.booking-time { font-size: 0.78rem; color: var(--text-dim); white-space: nowrap; }

.booking-divider { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

.booking-detail { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.booking-row { display: flex; align-items: baseline; gap: 8px; font-size: 0.85rem; }
.booking-row-label { color: var(--text-muted); min-width: 80px; font-size: 0.8rem; }
.booking-row-value { color: var(--text); }
.booking-capacity { font-size: 0.78rem; color: var(--text-dim); margin-left: 6px; }
.booking-capacity.full { color: var(--red); }
.booking-message {
  background: var(--surface-2);
  border-left: 2px solid var(--border-light);
  padding: 8px 12px;
  border-radius: 0 6px 6px 0;
  font-size: 0.83rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 14px;
}

.booking-actions { display: flex; gap: 8px; align-items: center; }
.booking-status-badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
}
.booking-status-badge.approved { background: var(--green-bg); color: var(--green); }
.booking-status-badge.rejected { background: var(--red-bg); color: var(--red); }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--gold); color: #fff; border-color: var(--gold); }
.btn-primary:hover { background: var(--gold-dim); border-color: var(--gold-dim); color: #fff; }

.btn-success { background: var(--green-bg); color: var(--green); border-color: var(--green); }
.btn-success:hover { background: #bbf7d0; }

.btn-danger { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: #fecaca; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-light); }

.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-icon { padding: 7px 10px; }

/* ── Table ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--surface-2); }
th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 11px 14px;
  font-size: 0.87rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 0.75rem;
  font-weight: 600;
}
.tag-online  { background: #dbeafe; color: #1d4ed8; }
.tag-inperson { background: #ede9fe; color: var(--purple); }
.tag-active  { background: var(--green-bg); color: var(--green); }
.tag-inactive { background: var(--surface-2); color: var(--text-muted); }
.tag-subject { background: var(--surface-2); color: var(--text-muted); }

/* ── Search / filters bar ──────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  padding: 7px 12px;
  font-size: 0.87rem;
  min-width: 220px;
  outline: none;
}
.search-input:focus { border-color: var(--gold); }
.search-input::placeholder { color: var(--text-dim); }
select.filter-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  padding: 7px 12px;
  font-size: 0.87rem;
  outline: none;
  cursor: pointer;
}
select.filter-select:focus { border-color: var(--gold); }

/* ── Slide-over panel ──────────────────────────────────────────────────── */
.slideover-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  z-index: 200;
  backdrop-filter: blur(2px);
}
.slideover-backdrop.open { display: block; }

.slideover {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 400px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 201;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -4px 0 24px rgba(0,0,0,0.08);
}
.slideover.open { transform: translateX(0); }

.slideover-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.slideover-title { font-weight: 600; font-size: 1rem; }
.slideover-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 5px;
  line-height: 1;
}
.slideover-close:hover { background: var(--surface-2); color: var(--text); }

.slideover-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.slideover-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* ── Forms ─────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  padding: 8px 12px;
  font-size: 0.88rem;
  outline: none;
  font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-bg); }
.form-input::placeholder { color: var(--text-dim); }
.form-textarea { resize: vertical; min-height: 70px; }
.form-section { font-size: 0.75rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; padding: 14px 0 8px; border-top: 1px solid var(--border); margin-top: 8px; }
.form-section:first-child { border-top: none; margin-top: 0; padding-top: 0; }

.checkbox-list { display: flex; flex-direction: column; gap: 6px; }
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 6px;
}
.checkbox-item:hover { background: var(--surface-2); }
.checkbox-item input[type="checkbox"] { accent-color: var(--gold); width: 14px; height: 14px; }

/* ── Mini info rows (inside slide-over) ───────────────────────────────── */
.info-row { display: flex; align-items: baseline; gap: 10px; padding: 5px 0; font-size: 0.85rem; }
.info-label { color: var(--text-muted); min-width: 90px; font-size: 0.8rem; }
.info-value { color: var(--text); }
.info-section {
  font-size: 0.72rem; font-weight: 700; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 14px 0 6px; border-top: 1px solid var(--border); margin-top: 6px;
}
.info-section:first-child { border-top: none; margin-top: 0; padding-top: 0; }

.enrolment-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  margin: 2px 2px 2px 0;
}
.enrolment-chip .chip-day { color: var(--purple); font-size: 0.72rem; }

/* ── Empty state ───────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.88rem; }

/* ── Toast ─────────────────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 500; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.85rem;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.2s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}
.toast.success { border-color: var(--green); }
.toast.error   { border-color: var(--red); }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ── Login page ────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 30% 20%, rgba(192,132,252,0.06) 0%, transparent 60%),
                    radial-gradient(ellipse at 70% 80%, rgba(192,120,16,0.06) 0%, transparent 60%);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 40px 36px;
  width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 8px;
}
.login-logo img { width: 36px; height: 36px; object-fit: contain; }
.login-logo-text { font-size: 1.15rem; font-weight: 700; }
.login-logo-text span { color: var(--gold); }
.login-subtitle { text-align: center; color: var(--text-muted); font-size: 0.82rem; margin-bottom: 28px; }
.login-error {
  background: var(--red-bg);
  border: 1px solid var(--red);
  color: var(--red);
  padding: 10px 14px;
  border-radius: 7px;
  font-size: 0.83rem;
  margin-bottom: 16px;
}
.login-btn {
  width: 100%;
  padding: 11px;
  font-size: 0.95rem;
  margin-top: 4px;
}

/* ── Portal layout ─────────────────────────────────────────────────────── */
.portal-wrap {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.portal-topnav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.portal-topnav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
  margin-right: 10px;
}
.portal-topnav-logo span { color: var(--gold); }
.portal-topnav-logo img { width: 24px; height: 24px; object-fit: contain; }
.portal-nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
}
.portal-nav-link {
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 0.87rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.portal-nav-link:hover { background: var(--surface-2); color: var(--text); }
.portal-nav-link.active { background: var(--gold-bg); color: var(--gold); font-weight: 600; }
.portal-topnav-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.83rem;
  color: var(--text-muted);
}
.portal-topnav-user a { color: var(--text-muted); }
.portal-topnav-user a:hover { color: var(--red); }

.portal-content {
  max-width: 860px;
  margin: 32px auto;
  padding: 0 24px;
  width: 100%;
}

.portal-greeting {
  margin-bottom: 28px;
}
.portal-greeting h1 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.portal-greeting p {
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* ── Portal children cards ─────────────────────────────────────────────── */
.child-cards { display: flex; flex-direction: column; gap: 16px; }
.child-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
}
.child-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.child-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--gold-bg);
  color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem;
  flex-shrink: 0;
}
.child-name { font-weight: 600; font-size: 1rem; }
.child-age { font-size: 0.8rem; color: var(--text-muted); }
.child-classes { display: flex; flex-wrap: wrap; gap: 8px; }
.child-class-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.83rem;
}
.child-class-name { font-weight: 600; color: var(--text); }
.child-class-meta { font-size: 0.76rem; color: var(--text-muted); margin-top: 2px; }

/* ── Portal schedule ───────────────────────────────────────────────────── */
.schedule-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.schedule-day-group { }
.schedule-day-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  padding: 14px 0 6px;
  border-top: 1px solid var(--border);
}
.schedule-day-label:first-child { border-top: none; padding-top: 0; }
.schedule-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.schedule-time {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  min-width: 48px;
  font-variant-numeric: tabular-nums;
}
.schedule-class-info { flex: 1; }
.schedule-class-name { font-weight: 600; font-size: 0.9rem; }
.schedule-class-student { font-size: 0.78rem; color: var(--text-muted); margin-top: 1px; }
.schedule-format-tag { flex-shrink: 0; }

/* ── Portal invoice rows ───────────────────────────────────────────────── */
.invoice-list { display: flex; flex-direction: column; gap: 10px; }
.invoice-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.invoice-period { font-weight: 600; font-size: 0.9rem; min-width: 90px; }
.invoice-amount { font-weight: 700; color: var(--gold); font-size: 0.95rem; }
.invoice-due { font-size: 0.78rem; color: var(--text-muted); flex: 1; }
.invoice-badge-paid { background: var(--green-bg); color: var(--green); font-size: 0.78rem; font-weight: 600; padding: 3px 10px; border-radius: 6px; }
.invoice-badge-unpaid { background: var(--red-bg); color: var(--red); font-size: 0.78rem; font-weight: 600; padding: 3px 10px; border-radius: 6px; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .slideover { width: 100%; }
}
@media (max-width: 640px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
