/*
 * CodeCampus LMS v2.9.70
 * System-wide Light Mode Readability & Contrast Repair
 * ---------------------------------------------------
 * Loaded last on every authenticated page so newer feature styles cannot
 * accidentally leave dark-theme text colors on light backgrounds.
 */

html[data-theme="light"] {
  color-scheme: light;
  --cc-lm-ink: #102a43;
  --cc-lm-ink-strong: #0b2038;
  --cc-lm-body: #294766;
  --cc-lm-muted: #5b718b;
  --cc-lm-soft: #74879e;
  --cc-lm-line: #cfdeec;
  --cc-lm-line-strong: #b9cee2;
  --cc-lm-surface: #ffffff;
  --cc-lm-surface-2: #f7fbff;
  --cc-lm-surface-3: #edf6fd;
  --cc-lm-cyan: #008cc0;
  --cc-lm-blue: #2563eb;
  --cc-lm-green: #087f5b;
  --cc-lm-amber: #a16207;
  --cc-lm-danger: #be123c;
}

html[data-theme="light"] body {
  color: var(--cc-lm-body);
  background: #eef5fb;
}

/* ---------- App chrome ---------- */
html[data-theme="light"] .sidebar,
html[data-theme="light"] .topbar {
  color: var(--cc-lm-ink);
}
html[data-theme="light"] .sidebar-caption,
html[data-theme="light"] .top-title small,
html[data-theme="light"] .sidebar small,
html[data-theme="light"] .server-pill {
  color: var(--cc-lm-muted) !important;
}
html[data-theme="light"] .top-title b,
html[data-theme="light"] .premium-brand b,
html[data-theme="light"] .sidebar-foot b {
  color: var(--cc-lm-ink-strong) !important;
}
html[data-theme="light"] .side-nav a:not(.active) {
  color: #43617f !important;
}
html[data-theme="light"] .side-nav a.active {
  color: #112d4d !important;
}
html[data-theme="light"] .sidebar-network-card b {
  color: var(--cc-lm-ink) !important;
}
html[data-theme="light"] .sidebar-network-card small {
  color: #66809a !important;
}

/* ---------- Global content typography ---------- */
html[data-theme="light"] .premium-content {
  color: var(--cc-lm-body);
}
html[data-theme="light"] .premium-content :is(h1,h2,h3,h4,h5,h6) {
  color: var(--cc-lm-ink-strong) !important;
  text-shadow: none !important;
}
html[data-theme="light"] .premium-content :is(p, .description, .subtitle, .subtext, .helper, .help-text) {
  color: var(--cc-lm-body) !important;
}
html[data-theme="light"] .premium-content :is(small, .muted, .meta, .caption, .hint, .eyebrow + small) {
  color: var(--cc-lm-muted) !important;
}
html[data-theme="light"] .premium-content .eyebrow {
  color: #0087b6 !important;
}

/* Keep interactive labels/colors controlled by their component. */
html[data-theme="light"] .premium-content :is(button,.btn,[role="button"],.badge,[class*="badge"],[class*="chip"],[class*="pill"]) :is(span,b,strong,small,em) {
  color: inherit !important;
}
html[data-theme="light"] .premium-content :is(button,.btn,[role="button"]) {
  text-shadow: none !important;
}

/* ---------- Common surfaces ---------- */
html[data-theme="light"] .premium-content :is(.glass,.card,.panel,.section-card,.surface,.widget,.content-card) {
  border-color: var(--cc-lm-line) !important;
}
html[data-theme="light"] .premium-content :is(.glass,.card,.panel,.section-card,.surface,.widget,.content-card):not([class*="dark"]):not([class*="code"]):not(pre) {
  box-shadow: 0 10px 30px rgba(31, 67, 102, .055);
}

/* ---------- Forms ---------- */
html[data-theme="light"] .premium-content label,
html[data-theme="light"] .premium-content legend,
html[data-theme="light"] .premium-content .field-label {
  color: #274765;
}
html[data-theme="light"] .premium-content :is(input:not([type="checkbox"]):not([type="radio"]), textarea, select) {
  color: #153450 !important;
  background-color: #fbfdff !important;
  border-color: #c7d9e9 !important;
  caret-color: #0b8fc2;
}
html[data-theme="light"] .premium-content :is(input,textarea)::placeholder {
  color: #71859c !important;
  opacity: 1 !important;
}
html[data-theme="light"] .premium-content select option {
  color: #153450 !important;
  background: #ffffff !important;
}
html[data-theme="light"] .premium-content :is(input,textarea,select):focus {
  border-color: #38a8d5 !important;
  box-shadow: 0 0 0 3px rgba(14,165,233,.12) !important;
}

/* ---------- Tables / list rows ---------- */
html[data-theme="light"] .premium-content table {
  color: var(--cc-lm-body);
}
html[data-theme="light"] .premium-content :is(th,.table-head,.list-head) {
  color: #34546f !important;
}
html[data-theme="light"] .premium-content :is(td,.table-row,.list-row) {
  border-color: #d6e3ef;
}

/* ---------- Engagement Hub ---------- */
html[data-theme="light"] .premium-content :is([class*="engagement"],[class*="recitation"],[class*="activity-card"]) :is(h1,h2,h3,h4,b,strong) {
  color: #102a43 !important;
}
html[data-theme="light"] .premium-content :is([class*="engagement"],[class*="recitation"],[class*="activity-card"]) :is(p,small) {
  color: #526d88 !important;
}
html[data-theme="light"] .premium-content :is([class*="engagement"],[class*="recitation"])[class*="card"],
html[data-theme="light"] .premium-content [class*="engagement"] [class*="card"] {
  border-color: #cfdeeb !important;
}
html[data-theme="light"] .premium-content [class*="engagement"] a:not(.btn) {
  color: #087da9;
}

/* Course chooser / Engagement cards from the screenshot */
html[data-theme="light"] .premium-content :is([class*="course-card"],[class*="course-picker"],[class*="course-select"]) :is(b,strong,h3,h4) {
  color: #102a43 !important;
}
html[data-theme="light"] .premium-content :is([class*="course-card"],[class*="course-picker"],[class*="course-select"]) :is(p,small,span:not(.badge):not([class*="badge"]):not([class*="chip"])) {
  color: #466580;
}

/* ---------- Code Clash ---------- */
html[data-theme="light"] .clash-shell-v270 :is(h1,h2,h3,h4,b,strong) {
  color: #10283f !important;
}
html[data-theme="light"] .clash-shell-v270 :is(p,small) {
  color: #526b86 !important;
}
html[data-theme="light"] .clash-shell-v270 :is(.clash-bank-question-title-v2957,.cc-bank-title,.cc-bank-question-title) {
  color: #10283f !important;
}
html[data-theme="light"] .clash-shell-v270 :is(.clash-bank-copy-v2957,.cc-bank-copy) p {
  color: #536e89 !important;
}
html[data-theme="light"] .clash-shell-v270 :is(.clash-bank-copy-v2957,.cc-bank-copy) > small {
  color: #6a7f96 !important;
}
html[data-theme="light"] .clash-shell-v270 [class*="preview"] :is(h3,h4,b,strong) {
  color: #16324d !important;
}
html[data-theme="light"] .clash-shell-v270 [class*="preview"] :is(p,small) {
  color: #5b7088 !important;
}

/* ---------- Team Battle ---------- */
html[data-theme="light"] .premium-content :is([class^="tb-"],[class*=" tb-"]) :is(h1,h2,h3,h4,b,strong) {
  color: #10283f !important;
}
html[data-theme="light"] .premium-content :is([class^="tb-"],[class*=" tb-"]) :is(p,small) {
  color: #536d87 !important;
}
html[data-theme="light"] .premium-content .tb-answer-option {
  color: #16334f !important;
  background: #ffffff !important;
  border-color: #c9dbea !important;
}
html[data-theme="light"] .premium-content .tb-answer-option.active,
html[data-theme="light"] .premium-content .tb-answer-option[aria-checked="true"],
html[data-theme="light"] .premium-content .tb-answer-option.is-selected {
  color: #102b46 !important;
}

/* ---------- Spotlight ---------- */
html[data-theme="light"] .spotlight-picker-v260 :is(h1,h2,h3,h4,b,strong) {
  color: #112b46 !important;
}
html[data-theme="light"] .spotlight-picker-v260 :is(p,small) {
  color: #546f89 !important;
}
html[data-theme="light"] .spotlight-picker-v260 :is(input,select) {
  color: #153450 !important;
}

/* ---------- Live Coding Monitor ---------- */
html[data-theme="light"] .premium-content :is([class*="live-coding"],[class^="lc-"],[class*=" lc-"]) :is(h1,h2,h3,h4,b,strong) {
  color: #10283f !important;
}
html[data-theme="light"] .premium-content :is([class*="live-coding"],[class^="lc-"],[class*=" lc-"]) :is(p,small) {
  color: #536d87 !important;
}

/* ---------- Assessments / Quiz / Activities / Modules ---------- */
html[data-theme="light"] .premium-content :is([class*="assessment"],[class*="quiz"],[class*="activity"],[class*="module"]) :is(h1,h2,h3,h4,b,strong) {
  color: #10283f !important;
}
html[data-theme="light"] .premium-content :is([class*="assessment"],[class*="quiz"],[class*="activity"],[class*="module"]) :is(p,small) {
  color: #536d87 !important;
}

/* Preserve code/editor readability. Editors intentionally remain dark. */
html[data-theme="light"] .premium-content :is(pre,code,.code-editor,.java-editor,[class*="code-editor"],[class*="console"],[class*="terminal"]) {
  text-shadow: none;
}
html[data-theme="light"] .premium-content pre,
html[data-theme="light"] .premium-content pre code {
  color: #d8e7f8;
}

/* ---------- Status colors: readable on white ---------- */
html[data-theme="light"] .premium-content :is(.success,[class*="success"],[class*="available"],[class*="ready"]) {
  --cc-status-text: #087f5b;
}
html[data-theme="light"] .premium-content :is(.warning,[class*="warning"],[class*="live"]) {
  --cc-status-text: #946200;
}
html[data-theme="light"] .premium-content :is(.danger,[class*="danger"],[class*="error"]) {
  --cc-status-text: #b4234d;
}

/* ---------- High-risk legacy faded text ----------
   Newer feature files often use pale dark-mode colors. These rules repair only
   text inside light surfaces and intentionally avoid buttons/badges/code. */
html[data-theme="light"] .premium-content :is(.glass,.card,.panel,[class*="card"],[class*="panel"])
  :is(p,small,.muted,.meta,.caption,.hint):not(button *):not(.btn *):not([class*="badge"] *):not([class*="chip"] *) {
  opacity: 1 !important;
}

/* ---------- Mobile readability ---------- */
@media (max-width: 760px) {
  html[data-theme="light"] .premium-content {
    color: #294766;
  }
  html[data-theme="light"] .premium-content :is(p,small) {
    line-height: 1.5;
  }
  html[data-theme="light"] .premium-content :is(input,textarea,select) {
    font-size: 16px !important; /* avoids iOS/Android browser auto zoom */
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme="light"] .premium-content * {
    text-shadow: none !important;
  }
}
