/* =====================================================================
   Study Drits — design system
   Light, clean, mobile-first. Blue accent, sampled from the site logo.
   The --gold*/--ink/--secondary*/--bg/--line/--text variables below are
   the STATIC fallback (used if the dynamic override in themeStyleTag()
   ever fails to load); the values an admin actually sees and edits live
   in Admin → Settings → Appearance and are injected as a <style>
   override — see includes/helpers.php's
   themeDefaults()/themeColors()/themeStyleTag(). Variable names keep
   their original "gold" naming from the site's first theme to avoid
   touching every rule below; only their values changed.

   --ink-soft is deliberately NOT one of the admin-editable colours: it's
   derived from --text with color-mix() below, so "soft"/muted text
   (captions, hints, metadata) always stays legible and harmonious with
   whatever text colour an admin picks, instead of needing its own
   picker that could easily end up clashing.

   --radius/--radius-sm/--btn-radius/--shadow/--shadow-lg are the
   DEFAULT ("rounded") layout style's values. Admin → Settings →
   Appearance also offers "sharp" and "bold" layout styles, which
   override these (and a few structural rules further down) via
   html[data-layout="…"] — see includes/helpers.php's
   themeLayoutStyle()/themeLayoutOptions().
   ===================================================================== */

:root {
  --gold: #0B7FE0;
  --gold-dark: #0653B6;
  --gold-light: #E6F1FD;
  --ink: #12203D;
  --text: #12203D;
  --ink-soft: color-mix(in srgb, var(--text) 68%, white);
  --line: #E1E7F0;
  --bg: #F7FAFD;
  --card: #FFFFFF;
  --secondary: #0E7C86;
  --secondary-dark: #0A5960;
  --secondary-light: color-mix(in srgb, var(--secondary) 14%, white);
  --green: #1E8E5A;
  --green-bg: #E7F6EE;
  --red: #C4432B;
  --red-bg: #FBEAE6;
  --blue: #0E7C86;
  --blue-bg: #E1F4F4;
  --radius: 14px;
  --radius-sm: 9px;
  --btn-radius: 999px;
  --shadow: 0 1px 2px rgba(18,32,61,.05), 0 6px 20px rgba(18,32,61,.07);
  --shadow-lg: 0 10px 40px rgba(18,32,61,.14);
  --maxw: 1160px;
}

/* ---------- Layout styles (Admin → Settings → Appearance) ---------- */
html[data-layout="sharp"] {
  --radius: 6px;
  --radius-sm: 4px;
  --btn-radius: 7px;
  --shadow: 0 1px 2px rgba(18,32,61,.06);
  --shadow-lg: 0 4px 16px rgba(18,32,61,.1);
}
html[data-layout="bold"] {
  --radius: 22px;
  --radius-sm: 15px;
  --btn-radius: 999px;
  --shadow: 0 2px 6px rgba(18,32,61,.08), 0 14px 34px -6px color-mix(in srgb, var(--gold) 35%, transparent);
  --shadow-lg: 0 18px 54px -8px color-mix(in srgb, var(--gold) 45%, transparent);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 16px;
}
img { max-width: 100%; display: block; }
a { color: var(--gold-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: 2rem; } h2 { font-size: 1.5rem; } h3 { font-size: 1.2rem; } h4 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.3em; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 680px; margin: 0 auto; padding: 0 20px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: 12px 22px; border-radius: var(--btn-radius); border: 1px solid transparent;
  font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none;
  transition: transform .06s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
  line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--gold); color: #fff; }
.btn-primary:hover { background: var(--gold-dark); color: #fff; }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover { background: var(--secondary-dark); color: #fff; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #000; }
.btn-outline { background: transparent; border-color: var(--line); color: var(--text); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold-dark); }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 8px 16px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Top nav ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; background: rgba(251,250,247,.92);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; max-width: var(--maxw); margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: var(--text); }
.brand .mark { width: 34px; height: 34px; object-fit: contain; flex-shrink: 0; }
.nav-links { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nav-links a { padding: 8px 12px; border-radius: 999px; color: var(--ink-soft); font-weight: 600; font-size: .92rem; }
.nav-links a:hover, .nav-links a.active { background: var(--gold-light); color: var(--gold-dark); text-decoration: none; }
.nav-toggle { display: none; }
.mobile-nav-actions { display: none; align-items: center; gap: 8px; }

/* ---------- App shell (student/admin/company dashboards) ---------- */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
  width: 236px; flex-shrink: 0; background: var(--ink); color: #fff;
  padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.app-sidebar .brand { color: #fff; margin-bottom: 22px; padding: 0 8px; }
.app-sidebar a {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px;
  color: #C7C9D1; font-weight: 600; font-size: .92rem; margin-bottom: 2px;
}
.app-sidebar a:hover { background: #26272E; color: #fff; text-decoration: none; }
.app-sidebar a.active { background: var(--gold); color: #fff; }
.app-sidebar .side-section { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: #6C6E78; margin: 18px 10px 6px; }
.app-main { flex: 1; min-width: 0; padding: 28px 28px 60px; }
.app-topline { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card-pad-lg { padding: 32px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---------- Course cards ---------- */
.course-card { display: flex; flex-direction: column; overflow: hidden; transition: transform .15s ease, box-shadow .15s ease; }
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.course-cover { height: 108px; border-radius: 10px; margin: -22px -22px 14px; background: linear-gradient(135deg, var(--gold), #16D0F7); display: flex; align-items: flex-end; padding: 12px 16px; }
.course-cover .badge-level { background: rgba(0,0,0,.25); color: #fff; font-size: .72rem; padding: 3px 10px; border-radius: 999px; font-weight: 700; }
.course-card h3 { font-size: 1.05rem; margin-bottom: 6px; }
.course-card .career-tag { font-size: .78rem; color: var(--gold-dark); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 6px; }
.course-card .meta { display: flex; gap: 14px; font-size: .82rem; color: var(--ink-soft); margin: 10px 0 14px; }
.course-card p.desc { color: var(--ink-soft); font-size: .9rem; flex: 1; }

/* ---------- Badges / pills ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.badge-pending { background: var(--blue-bg); color: var(--blue); }
.badge-approved, .badge-success { background: var(--green-bg); color: var(--green); }
.badge-rejected, .badge-danger { background: var(--red-bg); color: var(--red); }
.badge-gold { background: var(--gold-light); color: var(--gold-dark); }
.badge-secondary { background: var(--secondary-light); color: var(--secondary-dark); }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 18px; }
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; color: var(--text); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], input[type=search], input[type=url], select, textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: .95rem; font-family: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-light); }
textarea { resize: vertical; min-height: 100px; }
.hint { font-size: .8rem; color: var(--ink-soft); margin-top: 5px; }
.radio-row { display: flex; gap: 10px; }
.radio-card { flex: 1; border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; }
.radio-card input { width: auto; margin-right: 8px; }
.radio-card.checked { border-color: var(--gold); background: var(--gold-light); }
.check-row { display: flex; align-items: center; gap: 8px; font-weight: 500; margin-bottom: 4px; cursor: pointer; }
.check-row input { width: auto; }
.color-swatch { width: 48px; height: 42px; padding: 3px; border: 1.5px solid var(--line); border-radius: 8px; cursor: pointer; flex-shrink: 0; background: #fff; }
.color-hex { width: auto; max-width: 110px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: '▸ '; }
details[open] > summary::before { content: '▾ '; }
details[open] > summary { margin-bottom: 4px; }

/* ---------- Alerts ---------- */
.alert { padding: 13px 16px; border-radius: 10px; margin-bottom: 18px; font-size: .92rem; }
.alert-error { background: var(--red-bg); color: var(--red); }
.alert-success { background: var(--green-bg); color: var(--green); }
.alert-info { background: var(--blue-bg); color: var(--blue); }
.alert-gold { background: var(--gold-light); color: var(--gold-dark); }

/* ---------- Tables ---------- */
table.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); padding: 10px 12px; border-bottom: 1.5px solid var(--line); }
.data-table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

/* ---------- Hero / landing ----------
   A soft two-colour bloom sits behind the hero content rather than a
   flat background — tinted with the site's own primary/secondary
   accents via color-mix(), so it's never off-palette no matter what an
   admin sets those to, and stays subtle (professional) rather than a
   loud full-bleed gradient. */
.hero {
  padding: 72px 0 60px; text-align: center; position: relative; overflow: hidden;
  background:
    radial-gradient(640px 320px at 15% -10%, color-mix(in srgb, var(--gold) 16%, transparent), transparent 70%),
    radial-gradient(560px 300px at 100% 0%, color-mix(in srgb, var(--secondary) 14%, transparent), transparent 70%);
}
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.2rem); max-width: 780px; margin: 0 auto .4em; letter-spacing: -.01em; position: relative; }
.hero p.lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 620px; margin: 0 auto 28px; position: relative; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; position: relative; }
.stat-strip { display: flex; justify-content: center; gap: 44px; padding: 30px 0; flex-wrap: wrap; position: relative; }
.stat-strip .stat b { display: block; font-size: 1.7rem; color: var(--gold-dark); }
.stat-strip .stat span { font-size: .82rem; color: var(--ink-soft); }
.hero-visual { max-width: 900px; margin: 36px auto 0; border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; position: relative; }
/* Sharp & Corporate: swap the soft bloom for a crisp accent rule — a
   deliberately more structured, less decorative opening. */
html[data-layout="sharp"] .hero { background: var(--card); border-bottom: 3px solid var(--gold); }
/* Bold & Vibrant: richer, larger blooms and a touch more lift. */
html[data-layout="bold"] .hero {
  padding: 84px 0 68px;
  background:
    radial-gradient(760px 420px at 12% -15%, color-mix(in srgb, var(--gold) 26%, transparent), transparent 70%),
    radial-gradient(680px 380px at 105% 5%, color-mix(in srgb, var(--secondary) 24%, transparent), transparent 70%);
}
html[data-layout="bold"] .hero h1 { font-size: clamp(2.3rem, 5.6vw, 3.6rem); }
.hero-visual img { display: block; width: 100%; }
.banner-img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); display: block; }
.section { padding: 52px 0; }
.section-head { text-align: center; max-width: 560px; margin: 0 auto 32px; }
footer.site-footer { border-top: 1px solid var(--line); padding: 34px 0; color: var(--ink-soft); font-size: .88rem; text-align: center; }

/* ---------- Module reader / tutor chat ---------- */
.module-content { font-size: 1rem; line-height: 1.75; }
.module-content h2 { font-size: 1.25rem; margin-top: 1.3em; }
.module-content h3 { font-size: 1.05rem; margin-top: 1.1em; }
.module-content strong { color: var(--text); }
.video-embed { position: relative; padding-top: 56.25%; border-radius: 12px; overflow: hidden; background: #000; margin: 16px 0; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.chat-window { display: flex; flex-direction: column; gap: 12px; padding: 16px; height: 460px; overflow-y: auto; background: var(--bg); border-radius: var(--radius); border: 1px solid var(--line); }
.chat-msg { max-width: 78%; padding: 11px 15px; border-radius: 14px; font-size: .92rem; line-height: 1.5; white-space: pre-wrap; }
.chat-msg.user { align-self: flex-end; background: var(--gold); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.assistant { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-input-row { display: flex; gap: 10px; margin-top: 12px; }
.chat-input-row textarea { flex: 1; min-height: 46px; max-height: 120px; }
.assistant-block { align-self: flex-start; max-width: 78%; display: flex; flex-direction: column; gap: 4px; }
.assistant-block .chat-msg.assistant { max-width: none; }
.tutor-save { padding-left: 2px; }
.tutor-save .btn-ghost { padding: 4px 8px; font-size: .78rem; }
.tutor-save-picker { display: none; align-items: center; gap: 8px; margin-top: 4px; }
.tutor-save-picker select { width: auto; max-width: 220px; padding: 7px 10px; font-size: .82rem; }
.tutor-save-picker .btn { padding: 7px 14px; font-size: .78rem; }
.tutor-save-saved { font-size: .78rem; color: var(--green); font-weight: 600; padding-left: 2px; }

/* ---------- Quiz / exam ---------- */
.quiz-question { padding: 20px 0; border-bottom: 1px solid var(--line); }
.quiz-question:last-child { border-bottom: none; }
.quiz-option { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px; margin-bottom: 8px; cursor: pointer; }
.quiz-option:hover { border-color: var(--gold); }
.quiz-option.selected { border-color: var(--gold); background: var(--gold-light); }
.quiz-option.correct { border-color: var(--green); background: var(--green-bg); }
.quiz-option.incorrect { border-color: var(--red); background: var(--red-bg); }
.quiz-option input { width: auto; margin: 0; }
.timer-pill { background: var(--ink); color: #fff; padding: 8px 16px; border-radius: 999px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Progress ---------- */
.progress-bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-dark)); }

/* ---------- Misc utility ---------- */
.text-soft { color: var(--ink-soft); }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-0{margin-top:0} .mb-0{margin-bottom:0} .mt-8{margin-top:8px} .mt-16{margin-top:16px} .mt-24{margin-top:24px} .mb-24{margin-bottom:24px}
.small { font-size: .85rem; }
.empty-state { text-align: center; padding: 50px 20px; color: var(--ink-soft); }
.empty-state .icon { font-size: 2.4rem; margin-bottom: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--gold-light); color: var(--gold-dark); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .85rem; }
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(0,0,0,.15); border-top-color: var(--text); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .app-sidebar { position: fixed; left: -260px; top: 0; bottom: 0; z-index: 60; transition: left .2s ease; box-shadow: var(--shadow-lg); }
  .app-sidebar.open { left: 0; }
  .app-main { padding: 18px 16px 60px; }
  .nav-toggle { display: inline-flex; }
  .nav-links { display: none; }
  .mobile-nav-actions { display: flex; }
  .topbar .nav-links { position: absolute; top: 100%; left: 0; right: 0; background: var(--card); border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; padding: 10px 16px 16px; gap: 4px; box-shadow: var(--shadow); }
  .topbar .nav-links.open { display: flex; }
  .topbar .nav-links a { padding: 12px 14px; }
  .topbar { position: sticky; }
}
@media (max-width: 640px) {
  .topbar-inner { padding: 12px 16px; }
  .hero { padding: 40px 0 36px; }
  .card-pad-lg { padding: 22px; }
}
