/* ===== DESIGN TOKENS — change these to retheme the whole site ===== */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f5f5f5;
  --text: #1c1c1c;
  --text-muted: #6b6b6b;
  --accent: #11139e;
  --accent-hover: #333333;
  --border: #e5e5e5;
  --locked-text: #b0b0b0;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --font: Cambria, Georgia, serif;
}

/* Dark mode — grey base, yellow accent */
[data-theme="dark"] {
  --bg: #1e1e1e;
  --surface: #262626;
  --surface-soft: #2e2e2e;
  --text: #f2f2f2;
  --text-muted: #a0a0a0;
  --accent: #f2c744;
  --accent-hover: #e0b52f;
  --border: #3a3a3a;
  --locked-text: #6b6b6b;
  --shadow: 0 2px 12px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  transition: background 0.2s ease, color 0.2s ease;
}

/* ===== BASE BUTTON RESET ===== */
button {
  font-family: var(--font);
}

/* ===== TOP BAR ===== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Hamburger */
.hamburger-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
}

.hamburger-btn span {
  width: 20px;
  height: 2px;
  background: var(--text);
  display: block;
}

/* Sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 30;
}

.sidebar-overlay.open { display: block; }

.sidebar {
  position: fixed;
  top: 0;
  left: -300px;
  width: 280px;
  height: 100%;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 40;
  transition: left 0.25s ease;
  display: flex;
  flex-direction: column;
}

.sidebar.open { left: 0; }

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-title { font-weight: 700; font-size: 1.05rem; }

.sidebar-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 8px 0;
}

.sidebar-item {
  padding: 14px 20px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.95rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-item:hover { background: var(--surface-soft); }

.sidebar-item.locked {
  color: var(--locked-text);
  cursor: not-allowed;
}

.lock-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
}

/* Theme toggle */
.theme-toggle {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text);
}

/* ===== LOGIN BUTTON (topbar) ===== */
.login-btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 999px;
  padding: 9px 20px;
  font-size: 0.9rem;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.login-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* ===== PRIMARY BUTTONS (submit, CTA, finish) ===== */
.auth-submit-btn,
.cta-btn,
.upgrade-btn,
.toast-ok-btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 999px;
  padding: 11px 26px;
  font-size: 0.95rem;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  letter-spacing: 0.01em;
  transition: background 0.15s ease, transform 0.1s ease;
}

.auth-submit-btn:hover,
.cta-btn:hover,
.upgrade-btn:hover,
.toast-ok-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.auth-submit-btn:active,
.cta-btn:active,
.upgrade-btn:active,
.toast-ok-btn:active {
  transform: translateY(0);
}

/* ===== PAGE LAYOUT ===== */
.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* ===== QUICK ACTIONS ===== */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}

.action-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: box-shadow 0.15s ease;
}

.action-card:hover { box-shadow: var(--shadow); }

.action-text h3 {
  margin: 0 0 4px;
  font-size: 1.25rem;
}

.action-text p {
  margin: 0;
  font-size: 1rem;
  color: var(--text-muted);
}

/* ===== HERO ===== */
.hero {
  text-align: center;
  padding: 40px 0 60px;
}

.hero h1 {
  font-size: 2.2rem;
  line-height: 1.3;
  margin-bottom: 14px;
}

.hero-sub {
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 24px;
}

/* ===== HOW IT WORKS ===== */
.how-it-works { margin-bottom: 60px; }

.how-it-works h2 { text-align: center; margin-bottom: 28px; }

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-weight: 400;
}

/* ===== COMPARISON TABLE ===== */
.comparison-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  text-align: left;
}

.comparison-header h2 { margin: 0; }

.comparison-table {
  width: 100%;
  max-width: 640px;
  margin-left: 0;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.comparison-table th,
.comparison-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.comparison-table th { background: var(--surface-soft); }

.locked-cell { color: var(--locked-text); }

/* ===== AUTH MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 50;
}

.modal-overlay.open { display: block; }

.auth-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  width: 320px;
  z-index: 60;
}

.auth-modal.open { display: block; }

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-muted);
}

.auth-modal h2 {
  margin: 0 0 20px;
  font-size: 1.3rem;
}

#authForm {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#authForm input {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
}


.auth-error {
  color: #d94f4f;
  font-size: 0.8rem;
  margin: 0;
  min-height: 14px;
}

.auth-toggle-text {
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

.auth-toggle-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
  text-decoration: underline;
}

.account-wrapper { position: relative; }

.account-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 110%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 180px;
  overflow: hidden;
  z-index: 20;
}

.account-dropdown.open { display: block; }

.account-item {
  display: block;
  padding: 10px 16px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.9rem;
}

.account-item:hover { background: var(--surface-soft); }

/* Simple success toast */
.toast {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 20px;
  align-items: center;
  gap: 16px;
  z-index: 70;
}

.toast.open {
  display: flex;
}

.confirm-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  width: 300px;
  text-align: center;
  z-index: 60;
}

.confirm-modal.open { display: block; }

.confirm-text {
  margin: 0 0 20px;
  font-size: 0.95rem;
}

.confirm-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* ===== SECONDARY / GHOST BUTTONS ===== */
.confirm-cancel-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 9px 20px;
  font-size: 0.9rem;
  font-family: var(--font);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.confirm-cancel-btn:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

/* ===== CONFIRM OK BUTTON ===== */
.confirm-ok-btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 999px;
  padding: 9px 20px;
  font-size: 0.9rem;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.confirm-ok-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* ===== ONBOARDING EXPANSION ===== */
.auth-modal {
  transition: width 0.35s ease, height 0.35s ease, max-width 0.35s ease;
  overflow: hidden;
}

.auth-modal.expanded {
  width: 640px;
  max-width: 92vw;
  max-height: 85vh;
  overflow-y: auto;
  padding: 40px;
}

.onboarding-step {
  display: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.onboarding-step.active {
  display: block;
  opacity: 1;
}

.onboarding-intro {
  margin: 0 0 18px;
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* ===== SKIP LINK TILE ===== */
.skip-link {
  display: block;
  margin-top: 18px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.skip-link:hover {
  border-color: var(--accent);
  color: var(--text);
}


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

.category-tile {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 10px;
  cursor: pointer;
  font-size: 0.85rem;
  text-align: center;
  transition: border-color 0.15s ease;
}

.category-tile.selected-has {
  border-color: var(--accent);
}

.accordion-container {
  display: flex;
  flex-direction: column;
}

.category-wrapper {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease;
}

.category-wrapper.open {
  grid-template-rows: 1fr;
}

.subject-accordion {
  overflow: hidden;
  min-height: 0;
}

.subject-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 4px 0;
}

.subject-tile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
}

.subject-tile .check-icon {
  width: 16px;
  height: 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
}

.subject-tile.checked .check-icon {
  background: var(--accent);
  border-color: var(--accent);
}

.subject-tile.checked {
  border-color: var(--accent);
}

/* Year level cards */
.year-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.year-card, .unit-card {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  font-size: 0.9rem;
}

.year-card.selected, .unit-card.selected {
  border-color: var(--accent);
  background: var(--surface);
}

.selected-summary {
  margin-top: 16px;
  min-height: 0;
}

.summary-label {
  margin: 0 0 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.summary-chip {
  display: inline-block;
  background: var(--surface-soft);
  border: 1px solid var(--accent);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.8rem;
  margin: 0 6px 6px 0;
}

/* ===== ONBOARDING NUDGE ===== */
.onboarding-nudge {
  bottom: 24px;
  right: 24px;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  max-width: 280px;
}

.onboarding-nudge.stacked {
  bottom: 110px;
}

.nudge-dismiss {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text-muted);
}

/* ===== SETTINGS PANEL ===== */
.settings-panel {
  display: none;
  position: fixed;
  top: 0;
  right: -520px;
  width: 480px;
  max-width: 95vw;
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 60;
  overflow-y: auto;
  padding: 32px 28px 60px;
  transition: right 0.3s ease;
}

.settings-panel.open {
  display: block;
  right: 0;
}

.settings-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.settings-panel-title {
  margin: 0;
  font-size: 1.3rem;
}

.settings-section {
  margin-bottom: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.settings-section-title {
  font-size: 1rem;
  margin: 0 0 14px;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-field label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.settings-field input {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--font);
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.settings-feedback {
  font-size: 0.85rem;
  margin: 0;
}

/* ===== SETTINGS ACCOUNT ACTIONS ===== */
.settings-account-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-action-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 12px 16px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--font);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  text-align: left;
}

.settings-action-btn:hover {
  border-color: var(--accent);
  background: var(--surface);
}

.settings-action-arrow {
  color: var(--text-muted);
  font-size: 1rem;
}
