/* ===== THEME.CSS — Y9 Global Studies ===== */

:root {
  --teal:        #1A6B72;
  --teal-light:  #D6ECEE;
  --teal-mid:    #0f5a60;
  --gold:        #C8960C;
  --gold-light:  #FFF8E1;
  --red:         #A63D2F;
  --red-light:   #FDECEA;
  --grey-light:  #F5F5F5;
  --grey-mid:    #E0E0E0;
  --grey-text:   #666;
  --text:        #1a1a1a;
  --border:      #e0e0e0;
  --sidebar-w:   220px;
  --line-color:  #c8d8da;
  --font:        'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono:   'Cascadia Code', 'Consolas', 'SF Mono', monospace;
  --green-on:    #22c55e;
  --bg-base:     #0f2328;
  --bg-card:     #162f36;
  --bg-card-hover: #1a3840;
  --bg-sidebar:  #0d1f24;
  --bg-phase-active:   #1a3f48;
  --bg-phase-complete: #132a30;
  --bg-phase-upcoming: #111e22;
  --text-primary:   #f0f4f5;
  --text-secondary: #8ca8ae;
  --text-muted:     #5a7a80;
  --border-dark:    #1e3a42;
  --chip-done-bg:   #1A6B72;
  --chip-done-text: #fff;
  --chip-next-bg:   #3d2f00;
  --chip-next-text: #f0b429;
  --chip-planned-bg:   #1a2f35;
  --chip-planned-text: #5a7a80;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 14px; color: var(--text-primary); display: flex; min-height: 100vh; background: var(--bg-base); -webkit-font-smoothing: antialiased; }

/* ===== SIDEBAR ===== */
.sidebar { width: var(--sidebar-w); background: var(--bg-sidebar); border-right: 1px solid var(--border-dark); display: flex; flex-direction: column; padding: 0; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; z-index: 100; }
.sidebar-header { background: var(--teal); padding: 16px 14px; display: flex; align-items: center; gap: 10px; }
.sidebar-logo { background: rgba(255,255,255,0.2); color: #fff; font-size: 16px; font-weight: bold; width: 36px; height: 36px; border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sidebar-title { color: #fff; font-size: 13px; font-weight: 600; }
.sidebar-sub { color: rgba(255,255,255,0.7); font-size: 11px; }
.nav-section { padding: 14px 14px 4px; font-size: 10px; font-weight: 600; color: rgba(255,255,255,0.35); text-transform: uppercase; letter-spacing: 0.07em; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 7px 14px; font-size: 13px; color: rgba(255,255,255,0.65); text-decoration: none; border-left: 2px solid transparent; transition: background 0.1s; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { color: #fff; font-weight: 600; border-left-color: var(--gold); background: rgba(255,255,255,0.1); }

/* Nav icon */
.nav-icon { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 12px; color: rgba(255,255,255,0.5); }

/* Phase complete — filled diamond */
.nav-item.phase-complete .nav-icon { font-size: 0; }
.nav-item.phase-complete .nav-icon::before { content: ''; display: block; width: 8px; height: 8px; background: rgba(255,255,255,0.7); border-radius: 1px; transform: rotate(45deg); }
.nav-item.phase-complete { color: rgba(255,255,255,0.5); }

/* Phase active — solid white circle */
.nav-item.phase-active .nav-icon { font-size: 0; }
.nav-item.phase-active .nav-icon::before { content: ''; display: block; width: 10px; height: 10px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,0.2); }
.nav-item.phase-active { color: #fff; font-weight: 500; }

/* Phase upcoming — open circle */
.nav-item.phase-upcoming .nav-icon { font-size: 0; }
.nav-item.phase-upcoming .nav-icon::before { content: ''; display: block; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,0.3); }
.nav-item.phase-upcoming { color: rgba(255,255,255,0.45); }

/* ===== MAIN CONTENT ===== */
.main-content { margin-left: var(--sidebar-w); flex: 1; padding: 28px 32px; max-width: 1140px; background: var(--bg-base); }

/* Page header */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.01em; }
.page-sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.header-badges { display: flex; gap: 6px; margin-top: 4px; }
.badge { font-size: 11px; padding: 3px 8px; border-radius: 10px; font-weight: 500; }
.badge-class { background: var(--teal-light); color: var(--teal-mid); }
.header-actions { display: flex; gap: 8px; }
.btn { font-size: 12px; padding: 7px 14px; border-radius: 6px; text-decoration: none; display: inline-block; cursor: pointer; border: 1px solid var(--border); font-family: var(--font); }
.btn-print { background: var(--teal); color: #fff; border-color: var(--teal); }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border-color: var(--border-dark); }

/* Stat grid */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border-dark); border-radius: 8px; padding: 14px 16px; }
.stat-card.marking { border-left: 3px solid var(--gold); }
.stat-label { font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 600; color: var(--text-primary); line-height: 1; font-family: var(--font-mono); }
.stat-value.small { font-size: 18px; }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* Phase blocks */
.phase-block { background: var(--bg-card); border: 1px solid var(--border-dark); border-radius: 8px; margin-bottom: 14px; overflow: hidden; }
.phase-header { padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.phase-header.phase-complete { background: var(--bg-phase-complete); }
.phase-header.phase-active   { background: var(--bg-phase-active); }
.phase-header.phase-upcoming { background: var(--bg-phase-upcoming); }
.phase-label { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.phase-weeks { font-size: 12px; color: var(--text-secondary); margin-left: auto; }
.phase-badge { font-size: 10px; padding: 2px 7px; border-radius: 8px; font-weight: 500; text-transform: capitalize; }
.phase-badge-complete { background: #e8f5e9; color: #2e7d32; }
.phase-badge-active   { background: var(--teal-light); color: var(--teal-mid); }
.phase-badge-upcoming { background: var(--grey-light); color: #999; }

/* ===== LESSON TABLE — 7 cols: # | title | 9H date | 9U date | 9H toggle | 9U toggle | bookmark ===== */
.lesson-col-header {
  display: grid;
  grid-template-columns: 48px 1fr 130px 130px 58px 58px 90px;
  gap: 0;
  padding: 6px 16px;
  font-size: 10px;
  font-weight: 600;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-dark);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.lesson-row {
  display: grid;
  grid-template-columns: 48px 1fr 130px 130px 58px 58px 90px;
  gap: 0;
  padding: 9px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-dark);
  align-items: center;
  transition: background 0.1s;
}
.lesson-row:last-child { border-bottom: none; }
.lesson-row:hover { background: var(--bg-card-hover); }
.lesson-num { font-size: 11px; color: var(--text-muted); font-weight: 600; font-family: var(--font-mono); }
.lesson-title a { color: var(--text-primary); text-decoration: none; font-weight: 500; }
.lesson-title a:hover { color: #7dd3d8; text-decoration: underline; }
.lesson-date { font-size: 11px; color: var(--text-secondary); font-family: var(--font-mono); }
.col-center { display: flex; align-items: center; justify-content: center; }
.bookmark-chip { font-size: 11px; color: var(--text-secondary); }

/* ===== TOGGLE SWITCH ===== */
.toggle-switch { display: inline-flex; align-items: center; cursor: pointer; user-select: none; }
.toggle-switch input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.toggle-track { position: relative; width: 34px; height: 19px; background: #2a4a52; border-radius: 20px; transition: background 0.18s ease; flex-shrink: 0; }
.toggle-thumb { position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; background: #fff; border-radius: 50%; transition: transform 0.18s ease; box-shadow: 0 1px 3px rgba(0,0,0,0.4); }
.toggle-switch input:checked ~ .toggle-track { background: var(--green-on); }
.toggle-switch input:checked ~ .toggle-track .toggle-thumb { transform: translateX(15px); }

/* status chips (lesson pages only) */
.status-chip { font-size: 10px; padding: 2px 7px; border-radius: 8px; display: inline-block; font-weight: 500; }
.status-done    { background: var(--chip-done-bg); color: var(--chip-done-text); }
.status-next    { background: var(--chip-next-bg); color: var(--chip-next-text); }
.status-planned { background: var(--chip-planned-bg); color: var(--chip-planned-text); }
.lesson-done-toggles { display: flex; gap: 16px; margin-top: 10px; }
.lesson-toggle-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.lesson-toggle-label { font-size: 10px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em; }

/* ===== LESSON PAGE ===== */
.lesson-eyebrow { font-size: 12px; color: var(--teal); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.lesson-grid { display: grid; grid-template-columns: 1fr 300px; gap: 20px; }
.lesson-main { display: flex; flex-direction: column; gap: 16px; }
.lesson-sidebar { display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--bg-card); border: 1px solid var(--border-dark); border-radius: 8px; padding: 18px 20px; color: var(--text-primary); }
.card h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--teal); border-bottom: 1px solid var(--border-dark); padding-bottom: 8px; margin-bottom: 12px; }
.objectives-list { padding-left: 18px; }
.objectives-list li { margin-bottom: 6px; font-size: 14px; line-height: 1.5; }
.sequence-table { font-size: 13px; }
.seq-header { display: grid; grid-template-columns: 90px 80px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border-dark); font-weight: 600; font-size: 11px; color: var(--text-muted); text-transform: uppercase; }
.seq-row { display: grid; grid-template-columns: 90px 80px 1fr; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--border-dark); align-items: start; }
.seq-row:last-child { border-bottom: none; }
.seq-time { font-size: 11px; color: var(--text-secondary); }
.seq-stage { font-weight: 600; color: var(--teal); font-size: 12px; }
.seq-notes { line-height: 1.6; color: var(--text-primary); }
.diff-table { font-size: 13px; }
.diff-row { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border-dark); align-items: start; }
.diff-row:last-child { border-bottom: none; }
.diff-label { font-weight: 600; color: var(--teal); font-size: 12px; }
.diff-cultural .diff-label { color: #e57373; }
.diff-cultural { background: rgba(166,61,47,0.2); margin: 4px -20px; padding: 8px 20px; }
.meta-list { font-size: 13px; }
.meta-row { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border-dark); }
.meta-row:last-child { border-bottom: none; }
.meta-row span:first-child { color: var(--text-secondary); font-size: 12px; }
.bookmark-row { background: rgba(200,150,12,0.15); margin: 0 -20px; padding: 6px 20px; }
.reminder-row { background: rgba(26,107,114,0.25); margin: 0 -20px; padding: 6px 20px; }
.teacher-notes-list { padding-left: 18px; }
.teacher-notes-list li { margin-bottom: 8px; font-size: 13px; line-height: 1.5; }
.timetable-mini { font-size: 12px; }
.tt-header { font-weight: 600; color: var(--text-muted); font-size: 11px; text-transform: uppercase; }
.tt-row { display: grid; grid-template-columns: 36px 1fr 48px 40px; gap: 6px; padding: 5px 0; border-bottom: 1px solid var(--border-dark); }
.tt-row:last-child { border-bottom: none; }
.tt-class { font-weight: 600; color: var(--teal); }
.sensitivity-banner { background: rgba(166,61,47,0.2); border-left: 4px solid var(--red); padding: 12px 16px; border-radius: 0 6px 6px 0; margin-bottom: 20px; font-size: 13px; color: #e57373; }

/* ===== WORKSHEET STYLES ===== */
.ws-page { background: #fff; max-width: 210mm; margin: 0 auto; padding: 16mm 18mm 14mm; min-height: 297mm; }
.ws-header { display: flex; justify-content: space-between; align-items: flex-start; background: var(--teal); color: #fff; padding: 14px 18px; border-radius: 8px 8px 0 0; margin: -16mm -18mm 0; width: calc(100% + 36mm); }
.ws-unit { font-size: 11px; opacity: 0.8; margin-bottom: 3px; text-transform: uppercase; letter-spacing: 0.05em; }
.ws-title { font-size: 19px; font-weight: bold; }
.ws-header-right { text-align: right; min-width: 140px; }
.ws-field-label { font-size: 10px; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 2px; margin-top: 8px; }
.ws-field-label:first-child { margin-top: 0; }
.ws-field-line { border-bottom: 1px solid rgba(255,255,255,0.6); width: 140px; height: 20px; }
.ws-field-short { width: 80px; }
.ws-section { margin-top: 20px; }
.ws-section-title { font-size: 13px; font-weight: bold; color: var(--teal); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 2px solid var(--teal-light); padding-bottom: 5px; margin-bottom: 10px; }
.ws-instruction { font-size: 13px; color: #444; margin-bottom: 10px; line-height: 1.5; }
.ws-question { font-size: 14px; font-weight: bold; color: #1a1a1a; background: var(--teal-light); border-left: 4px solid var(--teal); padding: 10px 14px; border-radius: 0 6px 6px 0; margin-bottom: 12px; }
.ws-line { border-bottom: 1px solid var(--line-color); height: 32px; margin-bottom: 2px; }
.ws-writing-lines { margin-top: 6px; }
.ws-fields { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.ws-field-row { display: grid; grid-template-columns: 180px 1fr; border-bottom: 1px solid var(--border); min-height: 38px; }
.ws-field-row:last-child { border-bottom: none; }
.ws-field-key { background: var(--teal-light); color: var(--teal-mid); font-size: 12px; font-weight: bold; padding: 8px 12px; display: flex; align-items: center; }
.ws-field-value { padding: 8px 12px; font-size: 13px; color: #666; }
.ws-peel { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.ws-peel-row { display: grid; grid-template-columns: 40px 1fr; border-bottom: 1px solid var(--border); }
.ws-peel-row:last-child { border-bottom: none; }
.ws-peel-label { background: var(--teal); color: #fff; font-size: 18px; font-weight: bold; display: flex; align-items: center; justify-content: center; }
.ws-peel-content { padding: 10px 14px; }
.ws-peel-hint { font-size: 11px; color: #888; font-style: italic; margin-bottom: 6px; }
.ws-table { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.ws-table-header { display: grid; background: var(--teal); color: #fff; font-size: 12px; font-weight: bold; }
.ws-table-header > div { padding: 8px 12px; }
.ws-table-row { display: grid; border-bottom: 1px solid var(--border); }
.ws-table-row:last-child { border-bottom: none; }
.ws-table-cell { min-height: 48px; border-right: 1px solid var(--border); padding: 6px 10px; }
.ws-table-cell:last-child { border-right: none; }
.ws-extension { margin-top: 20px; background: var(--gold-light); border: 1px solid #e8c84c; border-radius: 8px; padding: 14px 16px; color: #1a1a1a; }
.ws-extension-title { font-size: 12px; font-weight: bold; color: var(--gold); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.ws-exit { margin-top: 20px; border: 2px solid var(--teal); border-radius: 8px; padding: 12px 16px; color: #1a1a1a; }
.ws-exit-label { font-size: 10px; font-weight: bold; text-transform: uppercase; letter-spacing: 0.06em; color: var(--teal); margin-bottom: 6px; }
.ws-exit-question { font-size: 13px; font-weight: bold; margin-bottom: 8px; color: #1a1a1a; }
.ws-exit-lines .ws-line { height: 28px; }
.ws-bookwork { margin-top: 16px; background: var(--teal-light); border-radius: 6px; padding: 10px 14px; font-size: 12px; color: var(--teal-mid); }

@media print {
  body { background: #fff; }
  .ws-page { margin: 0; padding: 12mm 14mm; box-shadow: none; }
  .ws-line { border-bottom: 1px solid #bbb; }
  .ws-peel-label { background: #1A6B72 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ws-header { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ws-question { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ws-field-key { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ws-table-header { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ws-bookwork { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}