/**
 * TelccFree — Global .dark theme palette (dashboard + exercises)
 */

:root {
  --telc-fb-blue: #1877f2;
}

html {
  transition: background-color 0.35s ease, color 0.35s ease;
}

body,
.navbar,
.hero,
.stat-card,
.section-card,
.header-frame,
.quiz-scroll-container,
.right-column-content,
.question-box,
.draggable,
.drop-target,
.results-panel-inner {
  transition:
    background-color 0.35s ease,
    color 0.35s ease,
    border-color 0.35s ease,
    box-shadow 0.35s ease;
}

/* ── Theme toggle button (legacy alias → icon-only capsule) ── */
.telc-theme-toggle,
#telcThemeToggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: none;
  border-radius: 9999px;
  background: transparent;
  cursor: pointer;
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  flex-shrink: 0;
  vertical-align: middle;
  box-shadow: none;
}

.telc-theme-toggle--nav {
  display: inline-flex;
  margin: 0 6px;
}

.telc-theme-toggle:hover {
  background: transparent;
  transform: translateY(-2px);
  box-shadow: none;
}

.telc-theme-icon {
  font-size: 15px;
  color: #0f172a;
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
  position: absolute;
}

html:not(.dark) .telc-theme-icon--moon {
  opacity: 1;
  transform: rotate(0deg);
  color: #0f172a;
}

html:not(.dark) .telc-theme-icon--sun {
  opacity: 0;
  transform: rotate(-90deg);
}

html.dark .telc-theme-icon--moon {
  opacity: 0;
  transform: rotate(90deg);
}

html.dark .telc-theme-icon--sun {
  opacity: 1;
  transform: rotate(0deg);
  color: #fbbf24;
}

html.dark .telc-theme-toggle {
  background: transparent;
  border: none;
}

.telc-exercise-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px 16px 0;
  position: relative;
  z-index: 2;
}

/* ── Shared dark palette (Tailwind slate scale) ── */
html.dark {
  color-scheme: dark;
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #243047;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --translation-text: #e2e8f0;
  --border: #334155;
  --pink-light: #3d1f35;
  --blue-light: #1e3a5f;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
}

html.dark body {
  background: #0f172a;
  color: #e2e8f0;
}

/* ── B2 Dashboard ── */
html.dark .navbar {
  background: rgba(15, 23, 42, 0.92);
  border-bottom-color: #334155;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

html.dark .hero {
  background: linear-gradient(135deg, #1a1030 0%, #0f2744 100%);
  border-bottom-color: #334155;
}

html.dark .stat-card,
html.dark .stat-card--analytics,
html.dark .section-card,
html.dark .modal-box {
  background: #1e293b;
  border-color: #334155;
}

html.dark .section-header {
  background: linear-gradient(135deg, rgba(233, 30, 140, 0.06), rgba(24, 119, 242, 0.06));
}

/* Neutral cards only — mastery premium (green/blue/gold) keeps semantic skins */
html.dark .ex-btn:not(.telc-m2-premium) {
  background: #243047;
  border-color: #334155;
  color: #f1f5f9;
}

html.dark .ex-btn:not(.telc-m2-premium):hover {
  border-color: #64748b;
  background: #2d3a4f;
}

html.dark .modal-overlay {
  background: rgba(0, 0, 0, 0.65);
}

/* Exercise version picker — light pastel cards + --text-main (#f1f5f9) washed out labels in Dark Mode */
html.dark .version-picker-box {
  background: #1e293b;
  border: 1px solid #334155;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

html.dark .version-picker-close {
  background: rgba(148, 163, 184, 0.15);
  color: #e2e8f0;
}

html.dark .version-picker-close:hover {
  background: rgba(148, 163, 184, 0.28);
  color: #f8fafc;
}

html.dark .version-picker-title {
  color: #f8fafc;
}

html.dark .version-picker-sub {
  color: #94a3b8;
}

html.dark .version-picker-option {
  background: #0f172a;
  border-color: #475569;
  color: #f8fafc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

html.dark .version-picker-option:hover {
  background: #243047;
  border-color: #94a3b8;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

html.dark .version-picker-option:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

html.dark .version-picker-option-label {
  color: #f8fafc;
}

html.dark .version-picker-option .score-dot:not(.has-score),
html.dark .version-picker-option .score-dot.is-unattempted {
  background-color: rgba(148, 163, 184, 0.12);
  border: 1px dashed rgba(148, 163, 184, 0.45);
  color: #94a3b8;
}

html.dark .modal-btn-cancel {
  background: #334155;
  color: #cbd5e1;
}

html.dark .telc-lang-trigger {
  background: #1e293b;
  color: #f1f5f9;
  border-color: var(--telc-fb-blue);
}

html.dark .telc-lang-menu {
  background: #1e293b;
  border-color: #334155;
}

html.dark .telc-lang-option:hover {
  background: #334155;
}

html.dark .hero-title {
  -webkit-text-fill-color: unset;
  color: #f8fafc;
}

html.dark .hero-sub {
  color: #94a3b8;
}

html.dark .gateway-header h1 {
  -webkit-text-fill-color: unset;
  color: #f8fafc;
}

html.dark .gateway-header p,
html.dark .level-card .level-sub,
html.dark .level-card .level-badge {
  color: #94a3b8;
}

html.dark .level-card {
  background: #1e293b;
  border-color: #334155;
}

html.dark body.portal-landing .level-card {
  background-color: #0f172a;
  background-image: none;
}

html.dark .level-card:hover {
  border-color: #64748b;
  background: #243047;
}

html.dark body.portal-landing .level-card:hover {
  background-color: #0f172a;
}

html.dark .level-card .level-title {
  -webkit-text-fill-color: unset;
}

html.dark body.portal-landing .level-card .level-title,
html.dark body.portal-landing .level-card.b1 .level-title,
html.dark body.portal-landing .level-card.b2 .level-title {
  color: #ffffff;
}

html.dark .level-card.b1 .level-title {
  color: #f48fb1;
}

html.dark .level-card.b2 .level-title {
  color: #90caf9;
}

html.dark .section-title {
  color: #f1f5f9;
}

html.dark .section-subtitle,
html.dark .stat-card-lbl {
  color: #94a3b8;
}

/* ── Leseverstehen Teil 3 & exercise pages ── */
html.dark .teil3-header-card,
html.dark .teil3-choice-card {
  background: #243047;
  border-color: #334155;
  color: #f1f5f9;
}

html.dark .teil3-choice-card.is-simulator,
html.dark .teil3-simulation-card {
  background: linear-gradient(135deg, #2a1f3d 0%, #243047 55%, #1e293b 100%);
  border-color: rgba(167, 139, 250, 0.35);
}

html.dark .teil3-choice-card:hover,
html.dark .teil3-header-card:hover,
html.dark .teil3-simulation-link:hover .teil3-simulation-card {
  border-color: #64748b;
  background: #2d3a4f;
}

html.dark .teil3-simulation-link:hover .teil3-simulation-card.is-simulator {
  background: linear-gradient(135deg, #352647 0%, #2d3a4f 55%, #243047 100%);
  border-color: rgba(167, 139, 250, 0.5);
}

html.dark .teil3-choice-title {
  color: #f1f5f9;
}

html.dark .teil3-choice-desc {
  color: #94a3b8;
}

html.dark {
  --bg: #0f172a;
  --surface: #1e293b;
  --text-charcoal: #e2e8f0;
  --text-muted: #94a3b8;
  --slate-700: #cbd5e1;
  --rose-border: rgba(148, 163, 184, 0.28);
  --rose-100: rgba(61, 31, 53, 0.6);
  --rose-200: rgba(71, 36, 58, 0.55);
  --rose-300: rgba(232, 69, 117, 0.35);
  --fb-blue-50: rgba(24, 119, 242, 0.12);
  --fb-blue-100: rgba(24, 119, 242, 0.18);
  --fb-blue-200: rgba(59, 130, 246, 0.45);
  --fb-blue-300: rgba(96, 165, 250, 0.55);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.35);
}

html.dark .header-frame {
  background: #1e293b;
  border-color: #475569;
  box-shadow:
    0 10px 32px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

html.dark .header-title {
  color: #f1f5f9;
}

html.dark .column-label {
  color: #94a3b8;
}

html.dark .quiz-scroll-container,
html.dark .right-column-content {
  background: rgba(30, 41, 59, 0.92);
  border-color: #475569;
}

html.dark .quiz-scroll-container:hover,
html.dark .right-column-content:hover {
  border-color: #64748b;
}

html.dark .question-box {
  background: #1e293b;
  border-color: #475569;
  border-left-color: #e84575;
}

html.dark .question-text {
  color: #e2e8f0;
}

html.dark .question-text h4 {
  color: #93c5fd;
}

html.dark .drop-target {
  background: rgba(15, 23, 42, 0.65);
  border-color: rgba(96, 165, 250, 0.45);
}

html.dark .drop-target.empty-drop-target::before {
  color: rgba(147, 197, 253, 0.75);
}

html.dark .drop-target:not(.empty-drop-target) {
  background: #334155;
  border-color: #475569;
}

html.dark .draggable,
html.dark .drop-target .draggable {
  background: #334155;
  color: #f1f5f9;
  border-color: #475569;
}

html.dark .draggable:hover {
  border-color: #64748b;
  background: #3d4f66;
}

html.dark .draggable.selected {
  background: #334155;
  color: #f8fafc;
  border-color: var(--telc-fb-blue);
}

html.dark .results-panel-inner {
  background: #1e293b;
  border-color: #475569;
}

html.dark .results-label {
  color: #94a3b8;
}

html.dark .results-score {
  color: #f8fafc;
}

html.dark .results-percent,
html.dark .results-feedback,
html.dark .results-trap {
  color: #cbd5e1;
}

html.dark .quiz-button.secondary {
  background: #334155;
  color: #e2e8f0;
  border-color: #475569;
}

html.dark .quiz-button.secondary:hover {
  background: #3d4f66;
}

/* ── Universal B1/B2 quiz & reading exercise pages ── */
html.dark {
  --telc-text: #e2e8f0;
  --telc-muted: #94a3b8;
  --telc-border: #475569;
}

html.dark body {
  background-color: #0f172a !important;
  color: #e2e8f0 !important;
}

html.dark p,
html.dark li,
html.dark td,
html.dark th,
html.dark label,
html.dark span,
html.dark div,
html.dark h1,
html.dark h2,
html.dark h3,
html.dark h4,
html.dark h5,
html.dark h6 {
  color: inherit;
}

html.dark p,
html.dark .question-text,
html.dark .task-side p,
html.dark .ad-full p,
html.dark .main-content p,
html.dark td,
html.dark li {
  color: #e2e8f0;
}

html.dark h1,
html.dark h2,
html.dark h3,
html.dark h4,
html.dark .header-title,
html.dark .section-title {
  color: #f1f5f9;
}

html.dark table {
  background: rgba(30, 41, 59, 0.85);
  border-color: #475569;
}

html.dark th {
  background: #334155;
  color: #f1f5f9;
  border-color: #475569;
}

html.dark td {
  border-color: #475569;
  background: rgba(30, 41, 59, 0.6);
}

html.dark .option,
html.dark label.option {
  background: #1e293b;
  border-color: #475569;
  color: #e2e8f0;
}

html.dark .option:hover,
html.dark label.option:hover {
  background: #334155;
  border-color: #64748b;
}

html.dark .quiz-scroll-container,
html.dark .right-column-content,
html.dark .question-box,
html.dark .ad-full,
html.dark .task-side,
html.dark .writing-side,
html.dark .yellow-box,
html.dark .correction-panel,
html.dark .textarea-container,
html.dark .main-content,
html.dark [class*="container"],
html.dark [class*="card"],
html.dark [class*="box"]:not(.logo-box) {
  background-color: rgba(30, 41, 59, 0.92);
  border-color: #475569;
  color: #e2e8f0;
}

html.dark .header-top,
html.dark .info-top {
  background: #1e293b;
  border-color: #475569;
  color: #e2e8f0;
}

html.dark .logo-box {
  background: linear-gradient(135deg, #334155, #1e293b);
  color: #f1f5f9;
}

html.dark textarea,
html.dark input[type="text"],
html.dark input[type="email"],
html.dark select {
  background: #0f172a;
  color: #f1f5f9;
  border-color: #475569;
}

html.dark textarea::placeholder {
  color: #64748b;
}

html.dark .auto-nav-wrap {
  background: transparent;
}

html.dark .btn-check,
html.dark .btn-green,
html.dark .btn-blue,
html.dark .quiz-button,
html.dark .auto-nav-btn {
  color: #fff;
}

html.dark .results-panel {
  background: rgba(15, 23, 42, 0.95);
  border-color: #475569;
}

html.dark .telc-theme-toggle--nav {
  margin: 0 4px;
}

html.dark .button-container {
  background: transparent;
}

@media (max-width: 640px) {
  .telc-exercise-toolbar {
    padding: 8px 8px 0;
  }
}
