/* Sovo Academy Design System — unified light / dark themes */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* —— Light (Sun) — premium navy / white —— */
:root,
[data-theme="light"] {
  color-scheme: light;

  --bg-primary: #F5F8FD;
  --bg-secondary: #E7EFFF;
  --surface: #FFFFFF;
  --surface-2: #F8FAFD;
  --text-primary: #102A56;
  --text-secondary: #65758B;
  --border-color: #DFE7F2;
  --accent-color: #103B8F;
  --accent-hover: #175CD3;
  --accent-soft: #E7EFFF;
  --input-bg: #ffffff;
  --input-text: #102A56;
  --input-placeholder: #98A2B3;

  /* Legacy aliases used across site/app/student CSS */
  --brand: var(--accent-color);
  --brand-dark: var(--accent-hover);
  --brand-soft: var(--accent-soft);
  --mint: var(--bg-primary);
  --mint-deep: var(--bg-secondary);
  --navy: #102A56;
  --ink: var(--text-primary);
  --muted: var(--text-secondary);
  --border: var(--border-color);
  --danger: #d92d20;
  --danger-soft: #fef3f2;
  --warning: #b7791f;
  --success: #039855;
  --accent: #175CD3;
  --shadow: 0 10px 28px rgba(16, 59, 143, 0.08);
  --shadow-sm: 0 4px 14px rgba(16, 42, 86, 0.06);
  --overlay: rgba(16, 42, 86, 0.45);

  --subhead-bg: #E7EFFF;
  --subhead-fg: #3D4F6F;

  --radius: 16px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --font: "Inter", "Segoe UI", sans-serif;
  --font-display: "Inter", "Segoe UI", sans-serif;
  --header-h: 70px;
  --bottom-nav-h: 68px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --topbar-h: 36px;
  --theme-transition: background-color .25s ease, color .25s ease, border-color .25s ease, box-shadow .25s ease, fill .25s ease;
}

/* —— Dark (Moon) —— */
[data-theme="dark"] {
  color-scheme: dark;

  --bg-primary: #0B0B0D;
  --bg-secondary: #121216;
  --surface: #151518;
  --surface-2: #1C1C21;
  --text-primary: #F4F4F5;
  --text-secondary: #A1A1AA;
  --border-color: #2A2A32;
  --accent-color: #6BA3FF;
  --accent-hover: #8BB8FF;
  --accent-soft: #1A2744;
  --input-bg: #1C1C21;
  --input-text: #F4F4F5;
  --input-placeholder: #71717A;

  /* Distinct from page bg / cards so subhead bands visibly change in dark mode */
  --subhead-bg: #1E2A44;
  --subhead-fg: #B8C7E0;

  --brand: var(--accent-color);
  --brand-dark: var(--accent-hover);
  --brand-soft: var(--accent-soft);
  --mint: var(--bg-primary);
  --mint-deep: var(--bg-secondary);
  --navy: #E4E4E7;
  --ink: var(--text-primary);
  --muted: var(--text-secondary);
  --border: var(--border-color);
  --danger: #FF8A80;
  --danger-soft: #3A2220;
  --warning: #E3B341;
  --success: #34D399;
  --accent: #6BA3FF;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.35);
  --overlay: rgba(0, 0, 0, 0.65);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: var(--theme-transition);
}

img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
button, input, select, textarea { font: inherit; color: inherit; }

.container {
  width: min(1180px, calc(100% - 2rem));
  margin-inline: auto;
}

.container-narrow { width: min(760px, calc(100% - 2rem)); margin-inline: auto; }

/* Typography */
.h1, h1 { font-family: var(--font-display); font-size: clamp(1.75rem, 3vw, 2.5rem); color: var(--navy); margin: 0 0 .5rem; letter-spacing: -.02em; font-weight: 800; }
.h2, h2 { font-family: var(--font-display); font-size: clamp(1.35rem, 2.4vw, 1.85rem); color: var(--navy); margin: 0 0 .5rem; font-weight: 800; }
.h3, h3 { font-size: 1.1rem; color: var(--navy); margin: 0 0 .35rem; font-weight: 700; }
.lead { color: var(--muted); font-size: 1.05rem; }
.muted { color: var(--muted); }
.section-label { color: var(--muted); font-size: .85rem; font-weight: 700; margin: 0 0 .75rem; }
.accent-text { color: var(--brand); }
.section-sub {
  display: inline-block;
  margin: .45rem 0 0;
  padding: .4rem .75rem;
  border-radius: 10px;
  background: var(--subhead-bg);
  color: var(--subhead-fg);
  font-size: .92rem;
  line-height: 1.4;
  transition: var(--theme-transition);
}
.page-hero {
  padding: 2rem 0 1.25rem;
  background: var(--subhead-bg);
  border-bottom: 1px solid var(--border);
  transition: var(--theme-transition);
}
.page-hero h1 { margin-bottom: .35rem; }
.page-hero .lead { color: var(--subhead-fg); }

/* Buttons */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: .75rem 1.25rem;
  font-weight: 650;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 44px;
  transition: .15s ease;
  text-decoration: none;
  background: transparent;
  color: var(--ink);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-secondary { background: var(--brand-soft); color: var(--brand-dark); border-color: transparent; }
.btn-secondary:hover { filter: brightness(.97); }
.btn-outline { border-color: var(--brand); color: var(--brand); background: var(--surface); }
.btn-outline:hover { background: var(--brand-soft); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { padding: .4rem .85rem; min-height: 34px; font-size: .875rem; font-weight: 600; }
.btn-xs { padding: .3rem .7rem; min-height: 30px; font-size: .8rem; }
.btn-block { width: 100%; }
.btn-icon {
  width: 44px; height: 44px; padding: 0; border-radius: 14px;
  background: var(--brand-soft); color: var(--brand); border: 0;
  display: grid; place-items: center; position: relative;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-body { padding: 1.25rem; }
.card-soft { background: var(--mint); border: 0; box-shadow: none; }

/* Forms */
.form-label, label { display: grid; gap: .35rem; font-size: .9rem; font-weight: 600; color: var(--navy); margin-bottom: .85rem; }
.form-control, .form-select, .form-textarea,
input[type="text"], input[type="email"], input[type="password"],
input[type="tel"], input[type="url"], input[type="number"],
input[type="search"], select, textarea {
  width: 100%;
  border: 1px solid var(--border-color);
  background: var(--input-bg);
  color: var(--input-text);
  border-radius: var(--radius-sm);
  padding: .75rem .9rem;
  min-height: 46px;
  box-sizing: border-box;
  transition: var(--theme-transition);
}
input::placeholder, textarea::placeholder { color: var(--input-placeholder); }
.form-control:focus, .form-select:focus, .form-textarea:focus,
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent);
  border-color: var(--brand);
}
.form-textarea, textarea { min-height: 120px; resize: vertical; }
.form-hint { font-size: .82rem; color: var(--muted); font-weight: 400; }
.form-grid { display: grid; gap: 1rem; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 720px) { .form-grid.two { grid-template-columns: 1fr; } }

/* Search */
.search-bar {
  display: flex; align-items: center; gap: .5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: .35rem .35rem .35rem 1rem;
  box-shadow: var(--shadow-sm);
}
.search-bar input {
  flex: 1; border: 0; background: transparent; outline: none; min-height: 40px;
}
.search-bar .search-submit {
  width: 42px; height: 42px; border: 0; border-radius: 50%;
  background: var(--brand); color: #fff; cursor: pointer;
  display: grid; place-items: center;
}

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  border-radius: var(--radius-pill);
  padding: .2rem .65rem;
  font-size: .78rem; font-weight: 700;
  background: var(--brand-soft); color: var(--brand-dark);
}
.badge-live { background: #ffe5e5; color: #c0392b; }
.badge-soft { background: var(--mint-deep); color: var(--brand); }
.badge-pill {
  display: inline-flex; align-items: center; gap: .35rem;
  border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius-pill); padding: .35rem .85rem;
  font-size: .78rem; font-weight: 700; color: var(--brand);
}

/* Alerts */
.alert {
  border-radius: var(--radius-sm);
  padding: .9rem 1rem;
  margin-bottom: 1rem;
  font-size: .95rem;
}
.alert-success { background: color-mix(in srgb, var(--success) 16%, var(--surface)); color: var(--success); }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-info { background: var(--brand-soft); color: var(--navy); }
.alert ul { margin: .35rem 0 0; padding-left: 1.1rem; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: .85rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.table tr:last-child td { border-bottom: 0; }

/* Empty / skeleton */
.empty-state { text-align: center; padding: 3rem 1.25rem; }
.empty-state .empty-icon {
  width: 88px; height: 88px; margin: 0 auto 1rem;
  border-radius: 50%; background: var(--brand-soft);
  display: grid; place-items: center; color: var(--brand); font-size: 2rem;
}
.skeleton {
  background: linear-gradient(90deg, var(--mint-deep), var(--brand-soft), var(--mint-deep));
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
  border-radius: 10px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* Pagination */
.pagination { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: center; margin-top: 1.5rem; }
.pagination a, .pagination span {
  min-width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
}
.pagination .active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: var(--overlay);
  display: none; align-items: center; justify-content: center; z-index: 80; padding: 1rem;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: min(520px, 100%); background: var(--surface);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem;
}

/* Menu list rows (mobile profile style) */
.menu-list { display: grid; }
.menu-row {
  display: grid;
  grid-template-columns: 44px 1fr 18px;
  gap: .85rem;
  align-items: center;
  padding: .95rem 0;
  color: inherit;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.menu-row + .menu-row { border-top: 1px solid var(--border); }
.menu-row .icon-tile {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-size: 1.15rem;
}
.menu-row strong { display: block; color: var(--navy); font-size: .98rem; }
.menu-row small { color: var(--muted); font-size: .82rem; }
.menu-row .chev { color: #94a3b8; }

/* Category chips */
.cat-card {
  background: var(--brand-soft);
  border-radius: var(--radius);
  padding: 1.1rem .75rem;
  text-align: center;
  color: var(--brand-dark);
  min-width: 110px;
}
.cat-card .cat-icon {
  width: 54px; height: 54px; margin: 0 auto .65rem;
  border-radius: 50%; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: 1.2rem;
}

/* Course card */
.course-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
@media (min-width: 900px) {
  .course-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.course-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
}
.course-card .thumb {
  aspect-ratio: 4/3; background: var(--mint-deep); position: relative;
}
.course-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.course-card .bookmark {
  position: absolute; right: .65rem; bottom: .65rem;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface); color: var(--brand); border: 0;
  display: grid; place-items: center; box-shadow: var(--shadow-sm);
}
.course-card .body { padding: .9rem; }
.course-card h3 { font-size: .95rem; margin: 0 0 .35rem; color: var(--navy); }
.course-card .meta { display: flex; gap: .65rem; color: var(--muted); font-size: .8rem; margin-bottom: .45rem; }
.course-card .price { color: var(--brand); font-weight: 750; }
.course-card .price s { color: var(--muted); font-weight: 500; margin-left: .35rem; font-size: .85rem; }

/* Feature / why-us cards */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.1rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.feature-card .icon {
  width: 52px; height: 52px; margin: 0 auto .85rem;
  border-radius: 50%; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-size: 1.25rem;
}

/* Section shells */
.section { padding: 2.75rem 0; }
.section-mint { background: var(--mint); }
.section-white { background: var(--surface); }
.section-head {
  display: flex; justify-content: space-between; align-items: end;
  gap: 1rem; margin-bottom: 1.35rem;
}
.section-head a { color: var(--muted); font-weight: 600; }

/* Circular theme switcher — shows icon of ACTIVE theme (sun=light, moon=dark) */
.theme-toggle {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--surface);
  color: var(--accent-color);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  padding: 0;
  box-shadow: var(--shadow-sm);
  transition: var(--theme-transition), transform .15s ease;
  position: relative;
  z-index: 2;
}
.theme-toggle:hover {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent-color) 35%, var(--border-color));
}
[data-theme="dark"] .theme-toggle {
  background: var(--surface-2);
  border-color: color-mix(in srgb, var(--accent-color) 45%, var(--border-color));
  color: #F5C518;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-color) 20%, transparent);
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 3px;
}
.theme-toggle:active { transform: scale(.96); }
.theme-toggle svg { display: block; pointer-events: none; }
.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (max-width: 720px) {
  .theme-toggle { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
}

/* Surfaces that should follow theme */
.card, .modal, .table-wrap, .dash-card, .auth-card {
  transition: var(--theme-transition);
}

/* Utilities */
.stack { display: grid; gap: 1rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* Auth tabs */
.tabs { display: flex; gap: .5rem; margin-bottom: 1rem; }
.tabs button {
  flex: 1; border: 1px solid var(--border); background: var(--surface-2);
  border-radius: 10px; padding: .65rem; font: inherit; cursor: pointer; font-weight: 600; color: var(--muted);
}
.tabs button.active { background: var(--brand); border-color: var(--brand); color: #fff; }
