/* ═══════════════════════════════════════════════════════════
   RED HILL PORTAL — Design System
   Aesthetic: Refined institutional • Clean authority • Red accent
   Fonts: Playfair Display (headings) + DM Sans (body)
═══════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700;800&family=DM+Sans:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  /* Palette */
  --red:       #c0392b;
  --red-dark:  #96281b;
  --red-light: #e74c3c;
  --red-muted: rgba(192,57,43,0.1);
  --red-glow:  rgba(192,57,43,0.2);

  --bg:        #f8f7f5;
  --bg2:       #ffffff;
  --bg3:       #f2f0ed;
  --bg4:       #e8e5e0;

  --text:      #1a1612;
  --text2:     #4a4540;
  --muted:     #8a837a;

  --border:    rgba(0,0,0,0.08);
  --border2:   rgba(0,0,0,0.14);

  --sidebar-w: 240px;
  --font:      'DM Sans', sans-serif;
  --serif:     'Playfair Display', serif;
  --mono:      'DM Mono', monospace;
  --radius:    10px;
  --shadow:    0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

/* ── Reset ── */
*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; }
html,body { height:100%; font-family:var(--font); background:var(--bg); color:var(--text); font-size:15px; line-height:1.6; -webkit-font-smoothing:antialiased; }
::-webkit-scrollbar { width:5px; } ::-webkit-scrollbar-track { background:var(--bg3); } ::-webkit-scrollbar-thumb { background:var(--bg4); border-radius:3px; }
a { color:inherit; text-decoration:none; }
button { font-family:var(--font); cursor:pointer; }
input,select,textarea { font-family:var(--font); }

/* ── AUTH PAGES ── */
.auth-page {
  min-height:100vh; display:flex; align-items:center; justify-content:center;
  background: var(--bg);
  position:relative; overflow:hidden;
}
.auth-page::before {
  content:''; position:absolute; inset:0;
  background: linear-gradient(135deg, rgba(192,57,43,0.04) 0%, transparent 60%),
              repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(0,0,0,0.03) 39px, rgba(0,0,0,0.03) 40px),
              repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(0,0,0,0.03) 39px, rgba(0,0,0,0.03) 40px);
}
.auth-split {
  display:grid; grid-template-columns:1fr 1fr; min-height:100vh; width:100%;
}
.auth-brand {
  background: linear-gradient(160deg, var(--red-dark) 0%, var(--red) 60%, #e74c3c 100%);
  display:flex; flex-direction:column; align-items:flex-start; justify-content:center;
  padding:60px; position:relative; overflow:hidden;
}
.auth-brand::after {
  content:''; position:absolute; bottom:-80px; right:-80px;
  width:320px; height:320px; border-radius:50%;
  background:rgba(255,255,255,0.06);
}
.auth-brand::before {
  content:''; position:absolute; top:-60px; right:40px;
  width:200px; height:200px; border-radius:50%;
  background:rgba(255,255,255,0.04);
}
.brand-logo { display:flex; align-items:center; gap:14px; margin-bottom:48px; }
.brand-icon {
  width:52px; height:52px; background:rgba(255,255,255,0.15);
  border-radius:12px; display:flex; align-items:center; justify-content:center;
  font-size:24px; backdrop-filter:blur(8px);
  border:1px solid rgba(255,255,255,0.2);
}
.brand-name { font-family:var(--serif); font-size:22px; color:#fff; font-weight:700; }
.brand-tagline { font-size:13px; color:rgba(255,255,255,0.6); margin-top:2px; letter-spacing:0.3px; }
.brand-heading { font-family:var(--serif); font-size:42px; color:#fff; font-weight:800; line-height:1.2; margin-bottom:20px; }
.brand-sub { font-size:15px; color:rgba(255,255,255,0.7); max-width:340px; line-height:1.7; }
.brand-pills { display:flex; flex-wrap:wrap; gap:8px; margin-top:32px; }
.brand-pill {
  padding:6px 14px; border-radius:20px;
  background:rgba(255,255,255,0.12); border:1px solid rgba(255,255,255,0.18);
  color:rgba(255,255,255,0.85); font-size:12px; font-weight:500;
}

.auth-form-side {
  display:flex; align-items:center; justify-content:center;
  padding:48px 60px; background:var(--bg2);
}
.auth-form-box { width:100%; max-width:400px; }
.auth-form-title { font-family:var(--serif); font-size:30px; font-weight:700; color:var(--text); margin-bottom:6px; }
.auth-form-sub { font-size:14px; color:var(--muted); margin-bottom:36px; }

/* ── FORM ELEMENTS ── */
.form-group { margin-bottom:20px; }
.form-group label { display:block; font-size:12px; font-weight:600; color:var(--text2); text-transform:uppercase; letter-spacing:0.7px; margin-bottom:8px; }
.form-group input,
.form-group select,
.form-group textarea {
  width:100%; padding:12px 16px;
  background:var(--bg3); border:1.5px solid var(--border2);
  border-radius:var(--radius); color:var(--text); font-size:14px;
  outline:none; transition:border-color 0.18s, box-shadow 0.18s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color:var(--red); box-shadow:0 0 0 3px var(--red-muted);
}
.form-group input::placeholder { color:var(--muted); }
.form-group select option { background:var(--bg2); }
.form-group textarea { resize:vertical; min-height:80px; }

.form-row { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.form-hint { font-size:12px; color:var(--muted); margin-top:5px; }

/* Checkbox tag pills for subject selection */
.subject-grid { display:flex; flex-wrap:wrap; gap:8px; }
.subject-chip {
  padding:7px 14px; border-radius:20px; font-size:13px; font-weight:500;
  border:1.5px solid var(--border2); background:var(--bg3); color:var(--text2);
  cursor:pointer; transition:all 0.15s; user-select:none;
}
.subject-chip.selected { background:var(--red-muted); border-color:var(--red); color:var(--red); }

/* ── BUTTONS ── */
.btn {
  display:inline-flex; align-items:center; gap:8px;
  padding:11px 22px; border-radius:var(--radius);
  font-size:14px; font-weight:600; border:none;
  cursor:pointer; transition:all 0.18s; white-space:nowrap;
  font-family:var(--font);
}
.btn-primary {
  background:var(--red); color:#fff;
}
.btn-primary:hover { background:var(--red-dark); transform:translateY(-1px); box-shadow:0 6px 20px var(--red-glow); }
.btn-ghost {
  background:var(--bg3); color:var(--text); border:1.5px solid var(--border2);
}
.btn-ghost:hover { border-color:var(--border2); background:var(--bg4); }
.btn-outline {
  background:transparent; color:var(--red); border:1.5px solid var(--red);
}
.btn-outline:hover { background:var(--red-muted); }
.btn-danger { background:rgba(231,76,60,0.1); color:var(--red-light); border:1.5px solid rgba(231,76,60,0.2); }
.btn-danger:hover { background:rgba(231,76,60,0.2); }
.btn-success { background:rgba(39,174,96,0.1); color:#27ae60; border:1.5px solid rgba(39,174,96,0.2); }
.btn-success:hover { background:rgba(39,174,96,0.2); }
.btn-sm { padding:7px 14px; font-size:12px; }
.btn-lg { padding:14px 28px; font-size:15px; }
.btn-full { width:100%; justify-content:center; }

/* ── APP SHELL ── */
.app-shell { display:flex; height:100vh; overflow:hidden; }

/* ── SIDEBAR ── */
.sidebar {
  width:var(--sidebar-w); flex-shrink:0;
  background:var(--bg2); border-right:1.5px solid var(--border);
  display:flex; flex-direction:column;
  height:100vh; overflow-y:auto;
  position:sticky; top:0;
}
.sidebar-brand {
  padding:24px 20px; border-bottom:1px solid var(--border);
  display:flex; align-items:center; gap:12px;
}
.sb-icon {
  width:36px; height:36px; background:var(--red); border-radius:9px;
  display:flex; align-items:center; justify-content:center;
  font-size:16px; flex-shrink:0;
}
.sb-name { font-family:var(--serif); font-size:15px; font-weight:700; color:var(--text); }
.sb-school { font-size:11px; color:var(--muted); font-family:var(--mono); }

.sidebar-user {
  padding:16px 14px; border-bottom:1px solid var(--border);
  display:flex; align-items:center; gap:10px;
}
.user-avatar {
  width:36px; height:36px; border-radius:9px;
  display:flex; align-items:center; justify-content:center;
  font-size:14px; font-weight:700; flex-shrink:0; color:#fff;
}
.user-name { font-size:13px; font-weight:600; color:var(--text); }
.user-role { font-size:11px; color:var(--muted); text-transform:capitalize; font-family:var(--mono); }

.sidebar-nav { flex:1; padding:12px 10px; }
.nav-section { font-size:10px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:1px; padding:12px 8px 4px; }
.nav-item {
  display:flex; align-items:center; gap:10px;
  padding:10px 10px; border-radius:8px; cursor:pointer;
  font-size:13px; font-weight:500; color:var(--text2);
  transition:all 0.15s; margin-bottom:2px;
  border:none; background:none; width:100%; text-align:left;
}
.nav-item:hover { color:var(--text); background:var(--bg3); }
.nav-item.active { color:var(--red); background:var(--red-muted); font-weight:600; }
.nav-item .nav-icon { font-size:15px; width:20px; flex-shrink:0; }
.nav-badge {
  margin-left:auto; background:var(--red); color:#fff;
  font-size:10px; font-weight:700; padding:2px 7px; border-radius:10px; font-family:var(--mono);
}

.sidebar-footer { padding:14px; border-top:1px solid var(--border); }
.logout-btn {
  width:100%; padding:9px 12px; border-radius:8px; background:none;
  border:1.5px solid var(--border); color:var(--muted); font-size:13px;
  font-family:var(--font); cursor:pointer; display:flex; align-items:center;
  justify-content:center; gap:8px; transition:all 0.15s;
}
.logout-btn:hover { color:var(--red); border-color:var(--red); background:var(--red-muted); }

/* ── MAIN CONTENT ── */
.main { flex:1; display:flex; flex-direction:column; min-width:0; overflow-y:auto; }
.topbar {
  padding:16px 28px; border-bottom:1.5px solid var(--border);
  display:flex; align-items:center; justify-content:space-between;
  background:var(--bg2); position:sticky; top:0; z-index:10;
}
.topbar-title { font-family:var(--serif); font-size:20px; font-weight:700; color:var(--text); }
.topbar-right { display:flex; align-items:center; gap:12px; }
.topbar-date { font-size:12px; color:var(--muted); font-family:var(--mono); }
.notif-btn {
  width:36px; height:36px; border-radius:9px; background:var(--bg3);
  border:1.5px solid var(--border); display:flex; align-items:center;
  justify-content:center; cursor:pointer; position:relative; transition:all 0.15s;
}
.notif-btn:hover { border-color:var(--red); background:var(--red-muted); }
.notif-dot { position:absolute; top:7px; right:7px; width:7px; height:7px; border-radius:50%; background:var(--red); border:1.5px solid var(--bg2); }
.content { padding:28px; flex:1; }

/* ── ANIMATIONS ── */
@keyframes fadeUp { from{opacity:0;transform:translateY(10px);}to{opacity:1;transform:translateY(0);} }
.fade-up { animation:fadeUp 0.3s ease; }
@keyframes slideIn { from{opacity:0;transform:translateX(-10px);}to{opacity:1;transform:translateX(0);} }

/* ── CARDS ── */
.card {
  background:var(--bg2); border:1.5px solid var(--border);
  border-radius:12px; padding:22px;
}
.card-sm { padding:16px; }
.card-title { font-family:var(--serif); font-size:16px; font-weight:700; color:var(--text); margin-bottom:16px; }
.card-subtitle { font-size:13px; color:var(--muted); margin-top:-10px; margin-bottom:16px; }

.stat-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:16px; margin-bottom:24px; }
.stat-card {
  background:var(--bg2); border:1.5px solid var(--border); border-radius:12px;
  padding:20px; display:flex; flex-direction:column; gap:10px;
  transition:border-color 0.18s, box-shadow 0.18s;
}
.stat-card:hover { border-color:var(--red); box-shadow:0 4px 16px var(--red-glow); }
.stat-icon { width:40px; height:40px; border-radius:9px; display:flex; align-items:center; justify-content:center; font-size:18px; }
.stat-val { font-size:30px; font-weight:700; color:var(--text); font-family:var(--serif); letter-spacing:-1px; }
.stat-label { font-size:12px; color:var(--muted); font-weight:500; }

/* ── PAGE HEADER ── */
.page-header {
  display:flex; align-items:flex-start; justify-content:space-between;
  flex-wrap:wrap; gap:16px; margin-bottom:24px;
}
.page-title { font-family:var(--serif); font-size:26px; font-weight:800; color:var(--text); margin-bottom:4px; }
.page-sub { font-size:14px; color:var(--muted); }

/* ── TABLE ── */
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; }
thead th {
  padding:10px 14px; text-align:left; font-size:11px; font-weight:700;
  color:var(--muted); text-transform:uppercase; letter-spacing:0.6px;
  border-bottom:1.5px solid var(--border); background:var(--bg3);
}
tbody tr { border-bottom:1px solid var(--border); transition:background 0.1s; }
tbody tr:hover { background:var(--bg3); }
tbody td { padding:13px 14px; font-size:14px; color:var(--text); }

/* ── BADGE ── */
.badge {
  display:inline-flex; align-items:center; padding:3px 10px;
  border-radius:20px; font-size:11px; font-weight:700; font-family:var(--mono);
}
.badge-red { background:var(--red-muted); color:var(--red); }
.badge-green { background:rgba(39,174,96,0.1); color:#27ae60; }
.badge-amber { background:rgba(243,156,18,0.1); color:#d68910; }
.badge-blue { background:rgba(41,128,185,0.1); color:#2980b9; }
.badge-grey { background:var(--bg4); color:var(--muted); }
.badge-purple { background:rgba(142,68,173,0.1); color:#8e44ad; }

/* ── PROGRESS ── */
.progress-bar { height:6px; background:var(--bg4); border-radius:3px; overflow:hidden; }
.progress-fill { height:100%; border-radius:3px; background:var(--red); transition:width 0.6s ease; }
.progress-fill.green { background:#27ae60; }
.progress-fill.amber { background:#f39c12; }

/* ── MODAL ── */
.modal-overlay {
  display:none; position:fixed; inset:0;
  background:rgba(0,0,0,0.5); backdrop-filter:blur(4px);
  z-index:200; align-items:center; justify-content:center; padding:20px;
}
.modal-overlay.open { display:flex; }
.modal {
  background:var(--bg2); border:1.5px solid var(--border);
  border-radius:16px; width:100%; max-width:540px; max-height:90vh; overflow-y:auto;
  box-shadow:var(--shadow-lg); animation:fadeUp 0.25s ease;
}
.modal-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:22px 24px; border-bottom:1.5px solid var(--border);
}
.modal-title { font-family:var(--serif); font-size:18px; font-weight:700; color:var(--text); }
.modal-close { background:none; border:none; font-size:20px; color:var(--muted); cursor:pointer; line-height:1; }
.modal-close:hover { color:var(--red); }
.modal-body { padding:24px; }
.modal-footer { display:flex; justify-content:flex-end; gap:10px; padding:16px 24px; border-top:1.5px solid var(--border); }

/* ── CONFIRM ── */
#confirm-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.5); backdrop-filter:blur(4px); z-index:300; align-items:center; justify-content:center; }
#confirm-overlay.open { display:flex; }
#confirm-box { background:var(--bg2); border:1.5px solid var(--border); border-radius:14px; padding:32px; max-width:360px; width:90%; text-align:center; box-shadow:var(--shadow-lg); }

/* ── TOAST ── */
#toast { position:fixed; bottom:24px; right:24px; z-index:999; display:flex; flex-direction:column; gap:8px; }
.toast-item {
  background:var(--bg2); border:1.5px solid var(--border); border-radius:10px;
  padding:12px 18px; font-size:13px; color:var(--text);
  box-shadow:var(--shadow); display:flex; align-items:center; gap:8px;
  animation:slideIn 0.3s ease;
}
.toast-item.success { border-color:rgba(39,174,96,0.4); }
.toast-item.error { border-color:rgba(231,76,60,0.4); }

/* ── SEARCH ── */
.search-row { display:flex; gap:10px; margin-bottom:20px; flex-wrap:wrap; }
.search-input {
  flex:1; min-width:200px; background:var(--bg3); border:1.5px solid var(--border2);
  border-radius:var(--radius); padding:10px 14px; color:var(--text); font-size:14px;
  font-family:var(--font); outline:none; transition:border-color 0.18s;
}
.search-input:focus { border-color:var(--red); }
.search-input::placeholder { color:var(--muted); }

/* ── CALENDAR ── */
.calendar-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:2px; }
.cal-head { text-align:center; font-size:11px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:0.5px; padding:8px 0; }
.cal-day {
  min-height:70px; padding:6px; border-radius:8px;
  border:1px solid var(--border); background:var(--bg2);
  cursor:pointer; transition:all 0.15s;
}
.cal-day:hover { border-color:var(--red); background:var(--red-muted); }
.cal-day.today { border-color:var(--red); background:var(--red-muted); }
.cal-day.other-month { background:var(--bg3); opacity:0.5; }
.cal-day-num { font-size:12px; font-weight:600; color:var(--text2); margin-bottom:4px; }
.cal-day.today .cal-day-num { color:var(--red); font-weight:700; }
.cal-event { font-size:10px; padding:2px 5px; border-radius:4px; margin-bottom:2px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cal-event.test { background:var(--red-muted); color:var(--red); }
.cal-event.assignment { background:rgba(41,128,185,0.1); color:#2980b9; }
.cal-event.exam { background:rgba(142,68,173,0.1); color:#8e44ad; }
.cal-event.event { background:rgba(39,174,96,0.1); color:#27ae60; }

/* ── REQUEST CARD ── */
.request-card {
  background:var(--bg2); border:1.5px solid var(--border); border-radius:10px;
  padding:16px; display:flex; align-items:center; gap:14px; margin-bottom:10px;
  transition:border-color 0.15s;
}
.request-card:hover { border-color:var(--red-glow); }
.req-info { flex:1; }
.req-name { font-size:14px; font-weight:600; color:var(--text); margin-bottom:2px; }
.req-detail { font-size:12px; color:var(--muted); }
.req-actions { display:flex; gap:8px; }

/* ── TIMETABLE GRID ── */
.tt-grid { display:grid; grid-template-columns:80px repeat(5,1fr); gap:2px; }
.tt-head { padding:10px; text-align:center; font-size:11px; font-weight:700; color:var(--muted); text-transform:uppercase; background:var(--bg3); border-radius:6px; }
.tt-time { padding:10px; font-size:12px; color:var(--muted); font-family:var(--mono); text-align:right; display:flex; align-items:center; justify-content:flex-end; }
.tt-slot {
  min-height:64px; border-radius:8px; border:1.5px dashed var(--border);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; transition:all 0.15s; position:relative;
}
.tt-slot:hover { border-color:var(--red); background:var(--red-muted); }
.tt-slot.filled { border-style:solid; border-color:var(--border2); background:var(--bg2); cursor:default; }
.tt-slot-content { padding:8px; text-align:center; }
.tt-subject { font-size:12px; font-weight:700; color:var(--red); margin-bottom:2px; }
.tt-teacher { font-size:11px; color:var(--muted); }
.tt-add { font-size:20px; color:var(--border2); }
.tt-slot:hover .tt-add { color:var(--red); }

/* ── MARK INPUT ── */
.mark-input {
  width:70px; padding:6px 10px; border:1.5px solid var(--border2);
  border-radius:7px; font-size:14px; font-family:var(--mono);
  text-align:center; background:var(--bg3); color:var(--text); outline:none;
}
.mark-input:focus { border-color:var(--red); background:#fff; }

/* ── EMPTY STATE ── */
.empty-state { text-align:center; padding:60px 20px; }
.empty-icon { font-size:48px; margin-bottom:16px; opacity:0.5; }
.empty-title { font-family:var(--serif); font-size:18px; font-weight:700; color:var(--text); margin-bottom:8px; }
.empty-sub { font-size:14px; color:var(--muted); }

/* ── ALERT ── */
.alert { padding:12px 16px; border-radius:8px; font-size:13px; margin-bottom:16px; display:flex; align-items:center; gap:10px; }
.alert-error { background:var(--red-muted); border:1px solid rgba(192,57,43,0.3); color:var(--red); }
.alert-success { background:rgba(39,174,96,0.1); border:1px solid rgba(39,174,96,0.3); color:#27ae60; }
.alert-info { background:rgba(41,128,185,0.1); border:1px solid rgba(41,128,185,0.25); color:#2980b9; }

/* ── TABS ── */
.tabs { display:flex; gap:2px; background:var(--bg3); padding:4px; border-radius:10px; width:fit-content; margin-bottom:20px; }
.tab { padding:8px 18px; border-radius:8px; font-size:13px; font-weight:600; color:var(--muted); cursor:pointer; border:none; background:none; font-family:var(--font); transition:all 0.15s; }
.tab.active { background:var(--bg2); color:var(--red); box-shadow:var(--shadow); }

/* ── STEP INDICATOR ── */
.steps { display:flex; align-items:center; gap:0; margin-bottom:36px; }
.step { display:flex; align-items:center; gap:10px; }
.step-num {
  width:32px; height:32px; border-radius:50%; border:2px solid var(--border2);
  display:flex; align-items:center; justify-content:center; font-size:13px;
  font-weight:700; color:var(--muted); flex-shrink:0; transition:all 0.2s;
}
.step.active .step-num { border-color:var(--red); background:var(--red); color:#fff; }
.step.done .step-num { border-color:var(--red); background:var(--red-muted); color:var(--red); }
.step-label { font-size:13px; font-weight:600; color:var(--muted); }
.step.active .step-label { color:var(--text); }
.step-line { flex:1; height:2px; background:var(--border2); margin:0 12px; min-width:24px; }
.step-line.done { background:var(--red); }

/* ── MOBILE ── */
.hamburger { display:none; background:none; border:none; cursor:pointer; padding:4px; }
.mob-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.5); z-index:40; }
@media(max-width:900px){
  .auth-split { grid-template-columns:1fr; }
  .auth-brand { display:none; }
  .auth-form-side { padding:40px 28px; }
  .sidebar { position:fixed; left:-260px; top:0; height:100%; z-index:50; transition:left 0.25s; }
  .sidebar.open { left:0; }
  .hamburger { display:flex; }
  .mob-overlay.show { display:block; }
  .content { padding:16px; }
  .topbar { padding:12px 16px; }
  .form-row { grid-template-columns:1fr; }
  .stat-grid { grid-template-columns:1fr 1fr; }
  .tt-grid { grid-template-columns:60px repeat(5,1fr); }
}
