/* ============================================================
   Blue Sky School — Events Platform  |  app.css
   ============================================================ */

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

:root {
  --sky:        #0ea5e9;
  --sky-dark:   #0369a1;
  --sky-light:  #e0f2fe;
  --gold:       #f59e0b;
  --gold-light: #fef3c7;
  --navy:       #0f172a;
  --slate:      #334155;
  --muted:      #94a3b8;
  --surface:    #f8fafc;
  --card:       #ffffff;
  --border:     #e2e8f0;
  --success:    #10b981;
  --danger:     #ef4444;
  --warning:    #f59e0b;
  --sidebar-w:  240px;
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --shadow-sm:  0 1px 4px rgba(0,0,0,.06);
  --shadow-md:  0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.12);
}

html { font-size: 16px; }
body { font-family: 'DM Sans', sans-serif; background: var(--surface); color: var(--navy); min-height: 100vh; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3 { font-family: 'Playfair Display', serif; font-weight: 700; color: var(--navy); }
.text-muted    { color: var(--muted); }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.text-warning  { color: var(--warning); }
.text-sky      { color: var(--sky); }
.fw-600        { font-weight: 600; }
.font-mono     { font-family: monospace; }

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w); height: 100vh;
  background: var(--navy);
  display: flex; flex-direction: column;
  z-index: 200; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.1) transparent;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.logo-mark { font-size: 22px; color: var(--gold); line-height: 1; flex-shrink: 0; }
.sidebar-logo h2 { font-size: 16px; color: #fff; }
.sidebar-logo p  { font-size: 10px; color: rgba(255,255,255,.35); letter-spacing: .5px; text-transform: uppercase; margin-top: 2px; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: #fff; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 500; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.role-badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 600; text-transform: capitalize; }
.role-admin  { background: rgba(245,158,11,.2);  color: #fbbf24; }
.role-staff  { background: rgba(14,165,233,.2);  color: #38bdf8; }
.role-parent { background: rgba(16,185,129,.2);  color: #34d399; }

.sidebar-nav { padding: 10px 8px; flex: 1; display: flex; flex-direction: column; }
.nav-section { font-size: 10px; font-weight: 600; color: rgba(255,255,255,.28); letter-spacing: 1px; text-transform: uppercase; padding: 10px 10px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  color: rgba(255,255,255,.52); font-size: 13px;
  cursor: pointer; transition: all .18s; margin-bottom: 1px;
}
.nav-item svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.88); }
.nav-item.active { background: rgba(14,165,233,.18); color: var(--sky); font-weight: 500; }
.nav-badge { margin-left: auto; background: var(--gold); color: var(--navy); border-radius: 20px; padding: 1px 7px; font-size: 10px; font-weight: 700; }

/* ── Main Content ───────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-w); padding: 28px; min-height: 100vh; }

/* ── Mobile Menu Toggle ───────────────────────────────────────── */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 250;
  background: var(--sky);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 20px;
  align-items: center;
  justify-content: center;
}
.mobile-menu-btn:active {
  background: var(--sky-dark);
}

/* ── Page Header ────────────────────────────────────────────── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-title { font-size: 28px; font-weight: 700; color: var(--navy); }
.page-sub   { font-size: 13px; color: var(--muted); margin-top: 3px; }
.header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: none; transition: all .18s;
  font-family: 'DM Sans', sans-serif; white-space: nowrap;
  text-decoration: none;
}
.btn-sky     { background: var(--sky); color: #fff; }
.btn-sky:hover { background: var(--sky-dark); }
.btn-gold    { background: var(--gold); color: var(--navy); font-weight: 600; }
.btn-gold:hover { background: #d97706; }
.btn-outline { background: #fff; border: 1.5px solid var(--border); color: var(--slate); }
.btn-outline:hover { border-color: var(--sky); color: var(--sky); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm      { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-lg      { padding: 13px 28px; font-size: 15px; border-radius: 12px; }
.btn-block   { width: 100%; justify-content: center; }
.btn svg     { width: 15px; height: 15px; }

/* ── Cards ──────────────────────────────────────────────────── */
.card { background: var(--card); border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.card-title  { font-size: 15px; font-weight: 600; color: var(--navy); }

/* ── Stats Grid ─────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card  { background: var(--card); border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 20px; }
.stat-icon  { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.stat-icon svg { width: 20px; height: 20px; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.stat-icon-sky    { background: var(--sky-light); }    .stat-icon-sky    svg { stroke: var(--sky-dark); }
.stat-icon-gold   { background: var(--gold-light); }   .stat-icon-gold   svg { stroke: var(--gold); }
.stat-icon-green  { background: #d1fae5; }             .stat-icon-green  svg { stroke: var(--success); }
.stat-icon-red    { background: #fee2e2; }             .stat-icon-red    svg { stroke: var(--danger); }
.stat-val    { font-family: 'Playfair Display', serif; font-size: 28px; font-weight: 700; color: var(--navy); }
.stat-label  { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat-change { font-size: 11px; margin-top: 6px; font-weight: 500; }
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td  { padding: 13px 14px; border-bottom: 1px solid var(--border); color: var(--slate); vertical-align: middle; }
tbody tr:hover  { background: var(--surface); }
tbody tr:last-child td { border-bottom: none; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-paid      { background: #d1fae5; color: #065f46; }
.badge-pending   { background: #fef3c7; color: #92400e; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-confirmed { background: #dbeafe; color: #1e40af; }
.badge-refunded  { background: #f3e8ff; color: #6b21a8; }
.badge-free      { background: #d1fae5; color: #065f46; }
.badge-upcoming  { background: var(--sky-light); color: var(--sky-dark); }
.badge-past      { background: #f1f5f9; color: #64748b; }
.badge-admin     { background: rgba(245,158,11,.15); color: #b45309; }
.badge-staff     { background: rgba(14,165,233,.15);  color: var(--sky-dark); }
.badge-parent    { background: rgba(16,185,129,.15);  color: #065f46; }

/* ── Event Cards Grid ───────────────────────────────────────── */
.events-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.event-card { background: var(--card); border-radius: var(--radius-lg); border: 1px solid var(--border); overflow: hidden; transition: transform .2s, box-shadow .2s; }
.event-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.event-banner { height: 110px; display: flex; align-items: flex-end; padding: 14px; position: relative; }
.event-banner.sky    { background: linear-gradient(135deg, #0f172a 0%, #0369a1 60%, #0ea5e9 100%); }
.event-banner.gold   { background: linear-gradient(135deg, #78350f, #b45309, #f59e0b); }
.event-banner.green  { background: linear-gradient(135deg, #064e3b, #059669, #34d399); }
.event-banner.purple { background: linear-gradient(135deg, #3b0764, #7c3aed, #a78bfa); }
.event-banner.coral  { background: linear-gradient(135deg, #7f1d1d, #b91c1c, #f87171); }
.event-category { background: rgba(255,255,255,.18); color: #fff; border-radius: 6px; padding: 2px 8px; font-size: 11px; font-weight: 600; backdrop-filter: blur(4px); }
.event-body  { padding: 16px; }
.event-name  { font-size: 15px; font-weight: 600; color: var(--navy); margin-bottom: 8px; line-height: 1.3; }
.event-meta-row { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.event-meta-row svg { width: 13px; height: 13px; flex-shrink: 0; stroke: var(--muted); fill: none; stroke-width: 2; }
.event-footer { padding: 12px 16px; background: var(--surface); border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.capacity-wrap { display: flex; align-items: center; gap: 8px; flex: 1; }
.capacity-bar  { height: 4px; background: var(--border); border-radius: 2px; flex: 1; overflow: hidden; }
.capacity-fill { height: 100%; border-radius: 2px; transition: width .4s; background: var(--sky); }
.capacity-fill.warn { background: var(--warning); }
.capacity-fill.full { background: var(--danger); }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group      { margin-bottom: 16px; }
.form-label      { display: block; font-size: 12px; font-weight: 500; color: var(--slate); margin-bottom: 6px; }
.form-label span { color: var(--danger); }
.form-control {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; font-family: 'DM Sans', sans-serif;
  outline: none; transition: border-color .2s; background: #fff; color: var(--navy);
}
.form-control:focus  { border-color: var(--sky); }
.form-control.error  { border-color: var(--danger); }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint   { font-size: 11px; color: var(--muted); margin-top: 4px; }
.form-error  { font-size: 11px; color: var(--danger); margin-top: 4px; }
.form-row    { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3  { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ── Search Bar ─────────────────────────────────────────────── */
.search-bar { display: flex; align-items: center; gap: 10px; background: #fff; border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 8px 14px; }
.search-bar svg   { width: 16px; height: 16px; stroke: var(--muted); fill: none; stroke-width: 2; flex-shrink: 0; }
.search-bar input { border: none; outline: none; font-size: 13px; font-family: 'DM Sans', sans-serif; flex: 1; color: var(--navy); background: transparent; }

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs    { display: flex; gap: 4px; background: var(--surface); border-radius: 10px; padding: 4px; }
.tab-btn { padding: 7px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--muted); border: none; background: none; transition: all .18s; font-family: 'DM Sans', sans-serif; }
.tab-btn.active { background: #fff; color: var(--navy); box-shadow: var(--shadow-sm); }

/* ── Payment method selector ────────────────────────────────── */
.pay-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.pay-option  { border: 2px solid var(--border); border-radius: var(--radius-sm); padding: 14px 8px; text-align: center; cursor: pointer; transition: all .2s; }
.pay-option:hover    { border-color: var(--sky); }
.pay-option.selected { border-color: var(--sky); background: var(--sky-light); }
.pay-icon    { font-size: 22px; margin-bottom: 4px; }
.pay-label   { font-size: 11px; font-weight: 500; color: var(--slate); }

/* ── Ticket / QR ────────────────────────────────────────────── */
.ticket-card { background: linear-gradient(135deg, var(--navy), #1e3a5f); border-radius: var(--radius-lg); padding: 20px; color: #fff; margin-bottom: 16px; position: relative; overflow: hidden; }
.ticket-card::after { content: ''; position: absolute; right: -30px; top: -30px; width: 100px; height: 100px; background: rgba(255,255,255,.04); border-radius: 50%; }
.ticket-divider { border-top: 2px dashed rgba(255,255,255,.15); margin: 14px 0; }
.ticket-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ticket-label { font-size: 10px; color: rgba(255,255,255,.4); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 2px; }
.ticket-val   { font-size: 13px; color: #fff; font-weight: 500; }
.qr-center    { text-align: center; padding: 16px 0; }
.qr-center canvas, .qr-center img { margin: 0 auto; border-radius: 10px; border: 8px solid #fff; }

/* ── Calendar ───────────────────────────────────────────────── */
.cal-nav     { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.cal-month   { font-family: 'Playfair Display', serif; font-size: 22px; font-weight: 700; }
.cal-days    { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 4px; }
.cal-day-name { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); padding: 8px; text-transform: uppercase; }
.cal-grid    { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-cell    { min-height: 72px; padding: 6px; border-radius: 8px; border: 1px solid transparent; cursor: default; }
.cal-cell:hover     { background: var(--surface); border-color: var(--border); }
.cal-cell.today     { background: var(--sky-light); border-color: var(--sky); }
.cal-cell.other-mo  { opacity: .28; }
.cal-num     { font-size: 12px; font-weight: 600; color: var(--navy); }
.cal-ev-dot  { font-size: 10px; border-radius: 4px; padding: 1px 5px; margin-top: 3px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cal-ev-dot.sky    { background: var(--sky); }
.cal-ev-dot.gold   { background: var(--gold); color: var(--navy); }
.cal-ev-dot.green  { background: var(--success); }
.cal-ev-dot.purple { background: #7c3aed; }
.cal-ev-dot.coral  { background: #ef4444; }

/* ── Alerts / Flash ─────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; margin-bottom: 16px; border: 1px solid transparent; }
.alert-success { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.alert-danger  { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.alert-info    { background: var(--sky-light); color: var(--sky-dark); border-color: #bae6fd; }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; z-index: 900; padding: 16px; backdrop-filter: blur(3px); }
.modal-box     { background: #fff; border-radius: 20px; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; box-shadow: 0 40px 80px rgba(0,0,0,.25); }
.modal-header  { padding: 22px 22px 0; display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-family: 'Playfair Display', serif; font-size: 20px; }
.modal-close   { width: 30px; height: 30px; border-radius: 8px; border: 1.5px solid var(--border); background: none; cursor: pointer; font-size: 16px; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.modal-body    { padding: 18px 22px; }
.modal-footer  { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── WhatsApp ───────────────────────────────────────────────── */
.btn-whatsapp { background: #25D366; color: #fff; font-weight: 600; }
.btn-whatsapp:hover { background: #1da851; color: #fff; }

/* ── Auth Pages ─────────────────────────────────────────────── */
.auth-page { min-height: 100vh; background: linear-gradient(135deg, #0f172a 0%, #0369a1 60%, #0ea5e9 100%); display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-card { background: #fff; border-radius: 20px; padding: 40px; width: 100%; max-width: 400px; box-shadow: 0 40px 80px rgba(0,0,0,.3); }
.auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.auth-logo-mark { width: 48px; height: 48px; background: linear-gradient(135deg, var(--sky), var(--sky-dark)); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; color: #fff; }
.auth-logo h1 { font-family: 'Playfair Display', serif; font-size: 20px; }
.auth-logo p  { font-size: 11px; color: var(--muted); }
.auth-tabs    { display: flex; background: var(--surface); border-radius: 10px; padding: 4px; margin-bottom: 24px; }
.auth-tab     { flex: 1; padding: 8px; text-align: center; font-size: 13px; font-weight: 500; border-radius: 8px; cursor: pointer; color: var(--muted); transition: all .2s; border: none; background: none; font-family: 'DM Sans', sans-serif; }
.auth-tab.active { background: #fff; color: var(--navy); box-shadow: var(--shadow-sm); }
.demo-box { background: var(--sky-light); border-radius: 8px; padding: 12px; font-size: 12px; color: var(--sky-dark); margin-top: 16px; text-align: center; }

/* ── Flash Toast ─────────────────────────────────────────────── */
.toast { position: fixed; top: 20px; right: 20px; background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 12px; font-size: 13px; font-weight: 500; z-index: 9999; transform: translateX(120%); transition: transform .3s; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px; max-width: 320px; }
.toast.show    { transform: none; }
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }

/* ── Progress bars ───────────────────────────────────────────── */
.progress     { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 4px; transition: width .4s ease; background: var(--sky); }
.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger  { background: var(--danger); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1024px) { .stats-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 768px)  {
  :root { --sidebar-w: 0px; }
  .sidebar { position: fixed; left: 0; top: 0; width: 240px; height: 100vh; transform: translateX(-100%); transition: transform .25s ease-in-out; z-index: 201; }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu-btn { display: flex; }
  .main-content { margin-left: 0; padding: 60px 16px 16px 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .events-grid { grid-template-columns: 1fr; }
  .pay-methods { grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-width: 480px) { .stats-grid { grid-template-columns: 1fr; } }

/* ── Utilities ───────────────────────────────────────────────── */
.d-flex   { display: flex; }
.d-grid   { display: grid; }
.gap-4    { gap: 4px; }   .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.p-16 { padding: 16px; } .p-20 { padding: 20px; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1   { flex: 1; }
.w-full   { width: 100%; }
.rounded  { border-radius: var(--radius-sm); }
.hidden   { display: none; }
.surface-bg { background: var(--surface); }
.grid-2   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3   { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.separator { height: 1px; background: var(--border); margin: 16px 0; }
