/* ================================================================
   UNIBRUZ Academy — Page Styles
   Depends on: base.css
   ================================================================ */

/* ----------------------------------------------------------------
   Body: Academy-specific padding
   ---------------------------------------------------------------- */
body {
  padding-top: 4rem;
  line-height: 1.55;
}

/* ----------------------------------------------------------------
   Font Size Adjustments (user preference)
   ---------------------------------------------------------------- */
body.font-small { font-size: 0.85rem; }
body.font-small h1 { font-size: 2.2rem; }
body.font-small h2 { font-size: 1.3rem; }
body.font-small h3 { font-size: 1.05rem; }

body.font-medium { font-size: 1rem; }
body.font-medium h1 { font-size: 2.8rem; }
body.font-medium h2 { font-size: 1.5rem; }
body.font-medium h3 { font-size: 1.15rem; }

body.font-large { font-size: 1.15rem; }
body.font-large h1 { font-size: 3.4rem; }
body.font-large h2 { font-size: 1.8rem; }
body.font-large h3 { font-size: 1.3rem; }

/* ----------------------------------------------------------------
   Light Theme: Academy-specific overrides
   ---------------------------------------------------------------- */
body.light-theme .sandbox-textarea,
body.light-theme .sandbox-iframe { border-color: var(--border); }
body.light-theme .dashboard-welcome-card { background: var(--primary-bright); color: var(--primary-fg); }
body.light-theme .dashboard-welcome-card h2,
body.light-theme .dashboard-welcome-card p { color: var(--primary-fg) !important; }
body.light-theme .leaderboard-row.active { background: hsl(45 100% 50% / .12); border-color: var(--primary-bright); }
body.light-theme .leaderboard-row { background: var(--card); color: var(--text); border-color: var(--border); }
body.light-theme .leaderboard-row .user-name { color: var(--text); }
body.light-theme .panel { background: #ffffff; border-color: var(--border); }
body.light-theme .course-card { background: var(--card); border-color: var(--border); }
body.light-theme .student-tab-btn:hover { background: hsl(220 14% 93%); border-color: var(--border); }
body.light-theme .student-tab-btn.active { color: var(--primary-fg); background: var(--primary-bright); }
body.light-theme .filter-btn { background: var(--card); color: var(--text); border-color: var(--border); }
body.light-theme .filter-btn:hover { background: hsl(220 14% 93%); color: var(--text); border-color: var(--muted); }
body.light-theme .filter-btn.active { background: var(--primary-bright); color: var(--primary-fg); border-color: transparent; }

/* Safety net: flip hardcoded dark surfaces in inline styles */
body.light-theme [style*="hsl(0 0% 4%)"],
body.light-theme [style*="hsl(0 0% 5%)"],
body.light-theme [style*="hsl(0 0% 6%)"],
body.light-theme [style*="hsl(0 0% 7%)"],
body.light-theme [style*="hsl(0 0% 8%)"],
body.light-theme [style*="hsl(0 0% 10%)"],
body.light-theme [style*="hsl(0 0% 12%)"] { background-color: var(--card) !important; }
body.light-theme [style*="color: #fff"],
body.light-theme [style*="color:#fff"],
body.light-theme [style*="color: white"],
body.light-theme [style*="color:white"] { color: var(--text) !important; }
body.light-theme .playground-editor-pane { background: var(--card); }
body.light-theme .lesson { background: #fff; border-color: var(--border); color: var(--text); }
body.light-theme .lesson-open { background: #fff; color: var(--primary); border-color: var(--primary); }
body.light-theme .lesson-viewer { background: #fff; border-color: var(--border); }
body.light-theme .profile-avatar-large { background: var(--primary-bright); }
body.light-theme #heroHeader h1 { color: var(--text); }
body.light-theme #heroHeader p { color: var(--muted); }
body.light-theme #statusBanner {
  background: hsl(220 14% 97%);
  color: var(--text);
  border: 1px solid var(--border);
}
body.light-theme .student-tabs { border-bottom-color: var(--border); }
body.light-theme .student-tab-btn { color: var(--muted); }
body.light-theme .quiz-type-tag { background: hsl(48 100% 92%); }
body.light-theme .exam-timer { background: hsl(0 0% 96%); }
body.light-theme .strength-meter { background: hsl(0 0% 90%); }

/* ----------------------------------------------------------------
   Focus Styles: Academy-specific elements
   ---------------------------------------------------------------- */
.student-tab-btn:focus-visible,
.filter-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ----------------------------------------------------------------
   Hero Section
   ---------------------------------------------------------------- */
.hero {
  padding: 3rem 0 2.2rem;
  text-align: center;
}
.eyebrow {
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .2em;
  font-size: .76rem;
  margin-bottom: .8rem;
}
h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: .98;
  margin-bottom: .9rem;
}
.hero p {
  color: var(--muted);
  max-width: 780px;
  margin: 0 auto;
  font-size: 1rem;
}

/* ----------------------------------------------------------------
   Status Banner
   ---------------------------------------------------------------- */
.status-banner {
  margin: 1.1rem auto 0;
  padding: .7rem .95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  max-width: 760px;
  color: var(--muted);
  font-size: .9rem;
  text-align: left;
}

/* ----------------------------------------------------------------
   Authentication Card
   ---------------------------------------------------------------- */
.auth-wrap {
  margin: 2rem auto 3rem;
  max-width: 500px;
}
.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2.2rem;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
  transition: border-color .2s ease;
}

/* Auth Tab Toggle */
.auth-toggle {
  display: flex;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.25rem;
  margin-bottom: 2rem;
  gap: 0.25rem;
}
body.light-theme .auth-toggle { background: hsl(0 0% 95%); }
.auth-toggle button {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.65rem;
  border-radius: 0.45rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
/* Sign In tab — gold tone when active */
#tabSignIn.active {
  background: var(--bg);
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(255, 204, 0, 0.15);
  border: 1px solid rgba(255, 204, 0, 0.3);
}
body.light-theme #tabSignIn.active {
  background: var(--card);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border);
}
/* Register tab — warm gradient tone when active */
#tabRegister.active {
  background: linear-gradient(135deg, hsl(48 100% 50% / 0.15), hsl(28 90% 50% / 0.15));
  color: hsl(48 100% 60%);
  box-shadow: 0 4px 15px rgba(255, 100, 0, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.4);
}
body.light-theme #tabRegister.active {
  background: var(--card);
  color: hsl(28 90% 45%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(251, 191, 36, 0.2);
}

/* Auth Form Fields */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  position: relative;
}
.form-group label {
  color: var(--text);
  font-weight: 600;
  font-size: 0.85rem;
  text-align: left;
}
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.auth-form input {
  width: 100%;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.75rem 2.5rem 0.75rem 0.9rem;
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.2s ease;
}
.auth-form input::placeholder { color: var(--muted); opacity: 0.5; }
.auth-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.15);
}
.auth-form input.is-invalid {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}
.auth-form input.is-valid { border-color: var(--success) !important; }

/* Password visibility toggle */
.password-toggle-btn {
  position: absolute;
  right: 0.8rem;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}
.password-toggle-btn:hover { color: var(--text); }
.password-toggle-btn .eye-icon { width: 1.2rem; height: 1.2rem; }

/* Field-level error messages */
.field-error {
  font-size: 0.78rem;
  color: var(--danger);
  min-height: 1rem;
  margin-top: 0.15rem;
  transition: opacity 0.2s ease;
  opacity: 0;
  text-align: left;
}
.field-error.visible { opacity: 1; }

/* Password Strength Meter */
.password-strength-wrap {
  margin-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.strength-meter {
  height: 4px;
  width: 100%;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.strength-bar {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  transition: width 0.3s ease, background-color 0.3s ease;
}
.strength-bar.weak   { width: 25%; background-color: var(--danger); }
.strength-bar.fair   { width: 50%; background-color: hsl(28 90% 50%); }
.strength-bar.good   { width: 75%; background-color: hsl(48 90% 50%); }
.strength-bar.strong { width: 100%; background-color: var(--success); }
.strength-label { font-size: 0.78rem; color: var(--muted); text-align: left; }

/* Password requirement checklist */
.password-requirements {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.25rem;
}
.req-item {
  font-size: 0.76rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.2s ease;
}
.req-item::before { content: "\2022"; font-weight: bold; }
.req-item.matched { color: var(--success); }
.req-item.matched::before { content: "\2713"; }

/* Auth Submit Buttons — mode-specific */
.auth-submit-btn {
  width: 100%;
  padding: 0.85rem;
  border-radius: 0.6rem;
  font-size: 0.95rem;
  font-weight: 700;
  margin-top: 0.8rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}
.auth-submit-btn.mode-signin {
  background: var(--primary);
  color: var(--primary-fg);
}
.auth-submit-btn.mode-signin:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 0 15px rgba(255, 204, 0, 0.35);
}
.auth-submit-btn.mode-register {
  background: linear-gradient(135deg, hsl(48 100% 50%), hsl(28 90% 50%));
  color: #000;
  box-shadow: 0 4px 15px rgba(255, 100, 0, 0.2);
}
.auth-submit-btn.mode-register:hover:not(:disabled) {
  background: linear-gradient(135deg, hsl(50 100% 55%), hsl(30 95% 55%));
  box-shadow: 0 0 20px rgba(255, 120, 0, 0.4);
}
.auth-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--border) !important;
  color: var(--muted) !important;
  box-shadow: none !important;
  border-color: transparent !important;
}
body.light-theme .auth-submit-btn:disabled { background: hsl(0 0% 90%) !important; }

/* Auth divider & Google button */
.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1.5rem 0;
  color: var(--muted);
  font-size: 0.8rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border);
}
.auth-divider:not(:empty)::before { margin-right: .75em; }
.auth-divider:not(:empty)::after  { margin-left:  .75em; }

.google-signin-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.google-signin-btn:hover { background: var(--card); border-color: var(--primary); }

/* Terms checkbox */
.checkbox-group { margin-top: 0.4rem; margin-bottom: 0.8rem; }
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
  color: var(--muted) !important;
  font-weight: 500 !important;
  font-size: 0.8rem !important;
  line-height: 1.4;
  text-align: left;
}
.checkbox-label input[type="checkbox"] {
  width: auto !important;
  margin-top: 0.2rem;
  cursor: pointer;
  accent-color: var(--primary);
}

/* Auth Wrap overrides removed to respect the site's light/dark theme toggle */

/* ----------------------------------------------------------------
   Platform Layout
   ---------------------------------------------------------------- */
.platform {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding-bottom: 2.8rem;
}
@media (min-width: 980px) {
  .platform { grid-template-columns: 2fr 1fr; }
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 1rem;
  transition: background-color .25s ease, border-color .2s ease;
}
.panel h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin-bottom: .85rem;
}
/* Sub-section heading inside settings/profile panels (was an 8x-repeated
   inline style). Token-based, so it themes identically to the old inline. */
.panel-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

/* ----------------------------------------------------------------
   Course Cards (within the platform)
   ---------------------------------------------------------------- */
.course-grid { display: grid; gap: .9rem; }
.course-card {
  border: 1px solid var(--border);
  border-radius: .65rem;
  background: var(--card);
  padding: .9rem;
}
.course-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: .75rem;
  margin-bottom: .7rem;
}
.course-top h3 {
  font-size: 1rem;
  font-family: var(--font-display);
  line-height: 1.25;
  margin-bottom: .25rem;
}
.course-meta { color: var(--muted); font-size: .8rem; display: flex; flex-wrap: wrap; gap: .5rem; }

/* ----------------------------------------------------------------
   Progress Bar
   ---------------------------------------------------------------- */
.progress {
  margin: .35rem 0 .75rem;
  border: 1px solid var(--border);
  border-radius: 9999px;
  height: .58rem;
  overflow: hidden;
  background: var(--input-bg);
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--primary);
  width: 0;
  transition: width .25s ease;
}

/* ----------------------------------------------------------------
   Lesson Accordion & Viewer
   ---------------------------------------------------------------- */
details.module {
  border: 1px solid var(--border);
  border-radius: .55rem;
  padding: .55rem .65rem;
  margin-bottom: .55rem;
  background: var(--card);
}
details.module summary {
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  color: hsl(0 0% 88%);
}
.lesson-list { margin-top: .5rem; display: grid; gap: .45rem; }
.lesson {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .7rem;
  border: 1px dashed hsl(0 0% 20%);
  border-radius: .45rem;
  padding: .45rem .55rem;
  font-size: .84rem;
  color: hsl(0 0% 84%);
}
.lesson-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .35rem;
  flex: 1;
}
.lesson-open {
  border: 1px solid var(--primary);
  border-radius: .4rem;
  padding: .25rem .5rem;
  font-size: .72rem;
  color: var(--primary);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}
.lesson-open:hover { background: var(--primary); color: #000; }
.lesson-viewer {
  margin-top: .45rem;
  border: 1px solid var(--border);
  border-radius: .55rem;
  background: var(--card);
  padding: .65rem;
}
.lesson-viewer h4 { font-family: var(--font-display); margin-bottom: .35rem; font-size: .96rem; }
.lesson-viewer p  { color: var(--muted); font-size: .82rem; margin-bottom: .55rem; }
.lesson-summary   { color: var(--muted); font-size: .85rem; font-style: italic; margin-bottom: .75rem; }

/* Lesson body content rendering */
.lesson-content { color: var(--text); font-size: .9rem; line-height: 1.7; }
.lesson-content > .lesson-video { margin: 0 0 1rem; }
.lesson-content .lesson-video + .video-speeds { margin-bottom: 1rem; }
.lesson-content h1 { font-family: var(--font-display); font-size: 1.5rem;  margin: 1rem 0 .5rem; }
.lesson-content h2 { font-family: var(--font-display); font-size: 1.25rem; margin: 1rem 0 .5rem; }
.lesson-content h3 { font-family: var(--font-display); font-size: 1.08rem; margin: .9rem 0 .4rem; }
.lesson-content p  { margin: .55rem 0; color: var(--text); }
.lesson-content ul, .lesson-content ol { margin: .5rem 0 .5rem 1.5rem; }
.lesson-content li { margin: .25rem 0; }
.lesson-content a  { color: var(--primary); text-decoration: underline; }
.lesson-content img { max-width: 100%; height: auto; border-radius: .4rem; margin: .5rem 0; }
.lesson-content blockquote {
  border-left: 3px solid var(--primary);
  margin: .6rem 0;
  padding: .2rem 0 .2rem .9rem;
  color: var(--muted);
}
.lesson input { accent-color: hsl(48 100% 50%); }

/* ----------------------------------------------------------------
   Video Player
   ---------------------------------------------------------------- */
.lesson-video {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  border-radius: .5rem;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
}
.lesson-video iframe,
.lesson-video .placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.lesson-video .placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: .82rem;
  padding: .6rem;
  text-align: center;
}
.speed-ctrl-btn {
  border: 1px solid var(--border);
  background: hsl(0, 0%, 7%);
  color: var(--muted);
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.15s ease;
}
.speed-ctrl-btn:hover { border-color: var(--muted); }
.speed-ctrl-btn.active {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: transparent;
  font-weight: 600;
}

/* ----------------------------------------------------------------
   Quiz
   ---------------------------------------------------------------- */
.quiz-shell {
  margin-top: .7rem;
  border: 1px solid var(--border);
  border-radius: .55rem;
  padding: .65rem;
  background: var(--card);
}
.quiz-q { margin-bottom: .55rem; font-size: .83rem; color: hsl(0 0% 88%); }
.quiz-options { display: grid; gap: .35rem; margin-top: .3rem; color: var(--muted); font-size: .8rem; }
.quiz-meta  { margin-top: .45rem; color: var(--muted); font-size: .78rem; }
.quiz-type-tag {
  display: inline-block;
  font-size: .64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: .1rem .4rem;
  border-radius: .3rem;
  background: var(--border);
  color: var(--primary);
  vertical-align: middle;
}
.quiz-option-label {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.82rem;
  margin-bottom: 0.25rem;
}
.quiz-option-label:hover { border-color: var(--primary); }
.quiz-option-label input { margin: 0; }
.quiz-option-label.correct {
  border-color: var(--success) !important;
  color: var(--success) !important;
  background: hsl(146 63% 42% / .08) !important;
  font-weight: 600;
}
.quiz-option-label.incorrect {
  border-color: var(--danger) !important;
  color: var(--danger) !important;
  background: hsl(0 75% 58% / .08) !important;
  text-decoration: line-through;
}
.quiz-q-flag {
  outline: 2px solid var(--danger);
  outline-offset: 4px;
  border-radius: 6px;
  transition: outline-color .3s;
}

/* Exam Timer */
.exam-timer {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .95rem;
  color: var(--primary);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: .4rem;
  padding: .25rem .6rem;
  letter-spacing: .05em;
  white-space: nowrap;
}
.exam-timer.warning, .exam-timer.expired { color: var(--danger); border-color: var(--danger); }

/* ----------------------------------------------------------------
   Resource Panel
   ---------------------------------------------------------------- */
.resource-shell {
  margin-top: .7rem;
  border: 1px solid var(--border);
  border-radius: .55rem;
  padding: .65rem;
  background: var(--card);
}
.resource-shell h4 { margin-bottom: .45rem; font-family: var(--font-display); font-size: .94rem; }
.resource-list {
  list-style: none;
  display: grid;
  gap: .55rem;
  color: var(--muted);
  font-size: .8rem;
}
.resource-item {
  border: 1px solid var(--border);
  border-radius: .5rem;
  background: var(--bg);
  padding: .55rem .6rem;
}
.resource-item summary { cursor: pointer; font-weight: 600; color: hsl(0 0% 94%); }
.resource-title { display: inline-block; margin-bottom: .25rem; font-weight: 600; font-size: .84rem; }
.resource-detail { font-size: .78rem; color: var(--muted); margin-top: .16rem; line-height: 1.45; }
.resource-meta { display: inline-block; margin-top: .3rem; font-size: .74rem; color: hsl(48 75% 72%); letter-spacing: .01em; }
.resource-points { margin: .35rem 0 0 .95rem; display: grid; gap: .2rem; color: hsl(0 0% 86%); font-size: .78rem; }
.resource-section-title { margin-top: .45rem; font-size: .77rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: hsl(48 75% 72%); }
.resource-steps { margin: .3rem 0 0 1rem; display: grid; gap: .25rem; color: hsl(0 0% 88%); font-size: .78rem; }
.resource-checklist { margin: .3rem 0 0 .95rem; display: grid; gap: .2rem; color: hsl(0 0% 88%); font-size: .78rem; }
.resource-quiz {
  margin-top: .55rem;
  border: 1px solid var(--border);
  border-radius: .5rem;
  padding: .55rem;
  background: var(--bg);
}
.resource-quiz h5 { margin-bottom: .35rem; font-family: var(--font-display); font-size: .82rem; color: hsl(0 0% 94%); }
.resource-quiz-q { margin-bottom: .4rem; color: hsl(0 0% 86%); font-size: .78rem; }
.resource-quiz-options { display: grid; gap: .28rem; margin-top: .25rem; color: var(--muted); font-size: .77rem; }
.resource-quiz-result { margin-top: .42rem; font-size: .77rem; color: hsl(0 0% 85%); }
.resource-list a { text-decoration: underline; text-underline-offset: 2px; color: hsl(0 0% 92%); }
.resource-list a:hover { color: var(--primary); }

/* ----------------------------------------------------------------
   Guest Gating
   ---------------------------------------------------------------- */
.lesson-locked {
  display: flex; align-items: center; justify-content: space-between;
  padding: .42rem .55rem; border-radius: .4rem;
  background: var(--card); margin-bottom: .3rem; gap: .5rem;
  font-size: .84rem; color: var(--muted);
}
.lesson-locked .lock-label { display: flex; align-items: center; gap: .4rem; }
.lesson-locked .lock-icon { font-size: .82rem; opacity: .6; }
.lesson-preview-badge {
  display: inline-block; font-size: .62rem;
  background: hsl(48 100% 50% / .15); color: var(--primary);
  border: 1px solid hsl(48 100% 50% / .3);
  border-radius: 99px; padding: .08rem .42rem;
  font-weight: 700; letter-spacing: .04em; margin-left: .35rem; vertical-align: middle;
}
.guest-gate {
  background: var(--card); border: 1px dashed var(--border);
  border-radius: .65rem; padding: 1.4rem 1.25rem;
  text-align: center; margin: .65rem 0;
}
.guest-gate .gate-icon { font-size: 1.5rem; margin-bottom: .4rem; }
.guest-gate h4 { font-family: var(--font-display); font-size: .95rem; margin-bottom: .3rem; }
.guest-gate p  { color: var(--muted); font-size: .82rem; margin-bottom: .9rem; line-height: 1.5; }
.guest-gate .gate-actions { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }
.guest-gate .gate-actions .btn { font-size: .82rem; padding: .45rem .85rem; }
.guest-gate .gate-actions .btn-primary { font-size: .82rem; padding: .45rem .85rem; }

/* ----------------------------------------------------------------
   Certificate Card
   ---------------------------------------------------------------- */
.certificate-card {
  border: 1px solid var(--border);
  border-radius: .65rem;
  background: var(--card);
  padding: .8rem;
  margin-bottom: .7rem;
}
.certificate-card h4 { font-family: var(--font-display); margin-bottom: .25rem; }
.certificate-card p  { color: var(--muted); font-size: .8rem; margin-bottom: .5rem; }

/* ----------------------------------------------------------------
   Student Dashboard Tabs
   ---------------------------------------------------------------- */
.platform-hub { padding-bottom: 2.8rem; }
.student-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.student-tabs::-webkit-scrollbar { display: none; }
.student-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.32, 1);
}
.student-tab-btn:hover { color: var(--text); background: var(--card); border-color: var(--border); }
.student-tab-btn.active { color: var(--primary-fg); background: var(--primary); border-color: transparent; }
.student-tab-btn .tab-icon { font-size: 1rem; }
.student-pane { animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.32, 1); }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ----------------------------------------------------------------
   Dashboard Welcome Card
   ---------------------------------------------------------------- */
.dashboard-welcome-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}
.dashboard-welcome-card::before { display: none; }

/* ----------------------------------------------------------------
   Catalog Controls & Filters
   ---------------------------------------------------------------- */
.catalog-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
.search-box { position: relative; flex: 1; min-width: 260px; }
.search-box input {
  width: 100%;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 1rem;
  font-family: var(--font-body);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.15s ease;
}
.search-box input:focus { border-color: var(--primary); }
.category-filters { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.filter-btn {
  background: var(--card);
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.5rem 0.9rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.filter-btn:hover { color: var(--text); border-color: var(--muted); }
.filter-btn.active {
  background: hsl(48 100% 50% / .12);
  color: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
}

/* ----------------------------------------------------------------
   Code Sandbox / Playground
   ---------------------------------------------------------------- */
.playground-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 860px) {
  .playground-layout { grid-template-columns: 240px 1fr; }
}
.playground-sidebar { display: flex; flex-direction: column; gap: 0.75rem; }
.playground-editor-pane { background: var(--card); border-radius: var(--radius); }
.sandbox-panel { border-radius: var(--radius); }
.sandbox-textarea {
  width: 100%;
  min-height: 140px;
  background: #0d0d0d;
  color: #7aff7a;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.82rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  resize: vertical;
  line-height: 1.4;
  outline: none;
}
.sandbox-textarea:focus { border-color: var(--primary); }
.sandbox-iframe {
  width: 100%;
  min-height: 180px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ----------------------------------------------------------------
   Profile Panel
   ---------------------------------------------------------------- */
.profile-avatar-large {
  width: 4rem; height: 4rem;
  border-radius: 50%;
  background: var(--primary-bright);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 15px rgba(255, 204, 0, 0.2);
}
.profile-layout-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 860px) { .profile-layout-grid { grid-template-columns: 280px 1fr; } }
.level-dial-container {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 1.5rem 0; position: relative;
}
.level-badge-large {
  font-family: var(--font-display); font-size: 2.2rem; font-weight: 800;
  color: var(--primary); line-height: 1.1; text-transform: uppercase;
  text-shadow: 0 0 15px rgba(255, 204, 0, 0.15);
}

/* ----------------------------------------------------------------
   Leaderboard
   ---------------------------------------------------------------- */
.leaderboard-list { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.5rem; }
.leaderboard-row {
  display: flex; align-items: center;
  padding: 0.5rem 0.65rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  font-size: 0.8rem;
}
.leaderboard-row.active { border-color: var(--primary); background: hsl(48 100% 50% / 0.05); }
.leaderboard-row .rank   { font-weight: bold; color: var(--primary); width: 1.5rem; }
.leaderboard-row .user-name { flex: 1; color: #fff; }
.leaderboard-row .xp-score  { color: var(--muted); font-weight: 600; }

/* ----------------------------------------------------------------
   Badges Cabinet
   ---------------------------------------------------------------- */
.badges-cabinet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
}
.badge-item-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 1rem 0.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  transition: all 0.2s ease;
  cursor: help;
}
.badge-item-card.locked   { opacity: 0.25; }
.badge-item-card.unlocked { border-color: rgba(255, 204, 0, 0.3); box-shadow: 0 0 10px rgba(255, 204, 0, 0.05); }
.badge-item-card .badge-icon  { font-size: 2rem; margin-bottom: 0.4rem; }
.badge-item-card .badge-title { font-size: 0.78rem; font-weight: bold; color: #fff; margin-bottom: 0.2rem; }
.badge-item-card .badge-desc  { font-size: 0.68rem; color: var(--muted); line-height: 1.2; }

/* ── W3Schools-style academy features ─────────────────────────────────────
   Search-to-lesson, Try-it-Yourself editors, per-lesson exercises, and
   Next/Previous lesson navigation. Token-based so both themes work. */

/* Search results dropdown (jump straight to a matching lesson) */
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  max-height: 340px;
  overflow-y: auto;
}
.search-result-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.85rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  color: var(--text);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover,
.search-result-item:focus-visible { background: rgba(255, 204, 0, 0.10); }
.search-result-lesson { font-size: 0.88rem; font-weight: 600; }
.search-result-course { font-size: 0.74rem; color: var(--muted); }
.search-result-empty { padding: 0.7rem 0.85rem; font-size: 0.84rem; color: var(--muted); }

/* Next / Previous lesson navigation */
.lesson-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.lesson-nav-btn { font-size: 0.85rem; }
.lesson-nav-next { max-width: 65%; }
.lesson-nav-label {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

/* Try it Yourself */
.tryit-btn { display: inline-flex; margin: 0.5rem 0 0.75rem; font-size: 0.8rem; }
.tryit-panel {
  margin: 0 0 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
}
.tryit-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
body.light-theme .tryit-bar { background: hsl(220 14% 95%); }
.tryit-label { font-size: 0.78rem; color: var(--muted); }
.tryit-editor {
  width: 100%;
  height: 180px;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 0.8rem;
  background: #0d0d0d;
  color: #e6e6e6;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  resize: vertical;
  tab-size: 2;
}
.tryit-preview { display: block; width: 100%; height: 220px; border: none; background: #fff; }

/* Per-lesson practice exercises */
.exercises-block {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.exercises-title {
  font-family: var(--font-display);
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--primary);
}
.exercise {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 0.85rem;
}
.exercise-q { font-size: 0.9rem; line-height: 1.5; margin-bottom: 0.6rem; }
.exercise-num {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-right: 0.4rem;
}
.exercise-opts { display: flex; flex-direction: column; gap: 0.4rem; }
.exercise-opt {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.exercise-opt:hover { border-color: var(--primary); }
.exercise-opt.is-correct { border-color: var(--success); background: rgba(46, 160, 90, 0.14); color: var(--text); }
.exercise-opt.is-wrong   { border-color: var(--danger);  background: rgba(220, 60, 60, 0.12); }
.exercise-feedback { margin-top: 0.5rem; font-size: 0.82rem; font-weight: 600; }
.exercise-feedback.ok  { color: var(--success); }
.exercise-feedback.bad { color: var(--danger); }
.exercise-hint {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0.4rem 0.6rem;
  border-left: 3px solid var(--primary);
  background: rgba(255, 204, 0, 0.06);
  border-radius: 0 0.4rem 0.4rem 0;
}
