/* CloudBridge Learning — lightweight, accessible, framework-free styling */

:root {
  --bg: #0f172a;
  --bg-soft: #1e293b;
  --surface: #ffffff;
  --surface-muted: #f1f5f9;
  --border: #d8dee9;
  --text: #1e293b;
  --text-muted: #5b6b82;
  --primary: #1d4ed8;
  --primary-hover: #1740b8;
  --accent: #0d9488;
  --warn-bg: #fff7ed;
  --warn-border: #fdba74;
  --warn-text: #9a3412;
  --danger: #b42318;
  --good: #15803d;
  --hard: #b45309;
  --again: #b42318;
  --easy: #0e7490;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 8px 24px rgba(15, 23, 42, 0.06);
  --maxw: 960px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface: #111827;
    --surface-muted: #1f2937;
    --border: #334155;
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --warn-bg: #3a2a12;
    --warn-border: #92580f;
    --warn-text: #fbbf24;
  }
}

* { box-sizing: border-box; }

/* Ensure [hidden] always wins over display overrides (e.g. .field { display:flex }). */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface-muted);
  line-height: 1.55;
  font-size: 16px;
}

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 1rem; }

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--primary); color: #fff;
  padding: 0.5rem 1rem; z-index: 100; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* Header */
.site-header { background: var(--bg); color: #fff; position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1rem; }
.brand { display: flex; align-items: center; gap: 0.5rem; color: #fff; text-decoration: none; font-size: 1.15rem; }
.brand-mark { font-size: 1.4rem; color: #5eead4; }
.brand-text strong { color: #93c5fd; font-weight: 700; }
.header-auth { display: flex; align-items: center; gap: 0.5rem; }
.auth-status { font-size: 0.85rem; color: #cbd5e1; }
.btn-lang { min-width: 2.6rem; font-weight: 700; color: #fff; border-color: rgba(255,255,255,0.3); }
.btn-lang:hover { background: rgba(255,255,255,0.12); }

/* Hero */
.hero { padding: 2.5rem 0 1.5rem; text-align: center; }
.hero h1 { font-size: 2.2rem; margin: 0 0 0.5rem; }
.hero-subtitle { font-size: 1.15rem; color: var(--text-muted); margin: 0 0 0.75rem; }
.hero-lead { max-width: 620px; margin: 0 auto 1.5rem; color: var(--text-muted); }

/* Panels */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; margin: 1.25rem 0; box-shadow: var(--shadow);
}
.panel h2 { margin-top: 0; font-size: 1.3rem; }

/* Selector */
.selector-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field label { font-weight: 600; font-size: 0.9rem; }
select, input[type="file"] { font: inherit; }
select {
  padding: 0.6rem 0.7rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); width: 100%;
}
select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--primary); outline-offset: 2px;
}
.selector-actions { display: flex; align-items: center; gap: 1rem; margin-top: 1.25rem; flex-wrap: wrap; }
.path-preview { color: var(--text-muted); font-size: 0.95rem; }

/* Buttons */
.btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px;
  padding: 0.6rem 1.1rem; border: 1px solid transparent; transition: background 0.15s, border-color 0.15s;
}
.btn-lg { padding: 0.8rem 1.6rem; font-size: 1.05rem; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-muted); }
.btn-danger-ghost { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger-ghost:hover { background: rgba(180, 35, 24, 0.08); }
.file-label { display: inline-block; }

/* Badges */
.badge {
  display: inline-block; padding: 0.2rem 0.6rem; border-radius: 999px;
  background: var(--primary); color: #fff; font-size: 0.8rem; font-weight: 600;
}
.badge-muted { background: var(--surface-muted); color: var(--text-muted); border: 1px solid var(--border); }

/* Messages */
.inline-error { color: var(--danger); font-weight: 600; }
.inline-message { padding: 0.6rem 0.8rem; border-radius: 8px; background: var(--surface-muted); }
.inline-message.ok { color: var(--good); }
.inline-message.err { color: var(--danger); }
.empty-state { text-align: center; color: var(--text-muted); padding: 2rem 1rem; }
.muted { color: var(--text-muted); }
.hint { color: var(--text-muted); font-size: 0.85rem; }

/* Flashcards */
.card-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.progress-bar { height: 8px; background: var(--surface-muted); border-radius: 999px; overflow: hidden; margin-bottom: 1rem; }
.progress-fill { height: 100%; width: 0%; background: var(--accent); transition: width 0.25s ease; }

.flashcard {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem;
  background: var(--surface-muted); min-height: 180px;
}
.flashcard-type { text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.72rem; color: var(--text-muted); font-weight: 700; margin-bottom: 0.5rem; }
.flashcard-front { font-size: 1.15rem; font-weight: 600; }
.flashcard-back { margin-top: 1rem; }
.flashcard-back hr { border: none; border-top: 1px solid var(--border); margin: 0 0 1rem; }
.flashcard-gotcha {
  background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text);
  padding: 0.6rem 0.8rem; border-radius: 8px; font-size: 0.95rem;
}
.flashcard-gotcha::before { content: "Gotcha: "; font-weight: 700; }
html[lang="nl"] .flashcard-gotcha::before { content: "Let op: "; }
.not-equivalent { color: var(--warn-text); font-size: 0.9rem; font-weight: 600; }

.flashcard-actions { margin-top: 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; align-items: center; }
.rating-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; width: 100%; }
.btn-rate { color: #fff; }
.rate-again { background: var(--again); }
.rate-hard { background: var(--hard); }
.rate-good { background: var(--good); }
.rate-easy { background: var(--easy); }
.btn-rate:hover { filter: brightness(0.93); }

/* Comparison table */
.table-wrap { overflow-x: auto; }
.cmp-table { border-collapse: collapse; width: 100%; min-width: 640px; }
.cmp-table th, .cmp-table td { text-align: left; padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.cmp-table th { background: var(--surface-muted); }
.cmp-table .concept-name { font-weight: 600; }
.cmp-note-warn { display: block; margin-top: 0.35rem; color: var(--warn-text); font-size: 0.82rem; font-weight: 600; }

/* Gotchas + interview */
.gotcha-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.75rem; }
.gotcha-list li {
  background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: 8px; padding: 0.8rem 1rem;
}
.gotcha-list strong { color: var(--warn-text); display: block; margin-bottom: 0.25rem; }
.interview-list { display: grid; gap: 0.75rem; padding-left: 1.25rem; }
.interview-list li { padding-left: 0.25rem; }
.interview-q { font-weight: 600; }
.interview-a { color: var(--text-muted); margin-top: 0.25rem; }

/* Progress summary */
.progress-summary { display: grid; gap: 0.5rem; }
.concept-row { display: flex; align-items: center; gap: 0.75rem; }
.concept-row .concept-label { flex: 1; }
.mastery-bar { width: 120px; height: 8px; background: var(--surface-muted); border-radius: 999px; overflow: hidden; }
.mastery-fill { height: 100%; background: var(--accent); }
.status-weak { color: var(--danger); }
.status-learning { color: var(--hard); }
.status-familiar { color: var(--primary); }
.status-strong { color: var(--good); }
.progress-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem; }

/* Ask-AI helper */
.ai-help { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 1rem; }
.ai-help-label { font-size: 0.9rem; color: var(--text-muted); font-weight: 600; }
.btn-ai { padding: 0.35rem 0.7rem; font-size: 0.85rem; background: transparent; border-color: var(--border); color: var(--text); }
.btn-ai:hover { background: var(--surface-muted); }
.ai-note {
  font-size: 0.85rem; font-weight: 600; color: var(--good); flex-basis: 100%;
  background: var(--surface-muted); border: 1px solid var(--good);
  border-radius: 8px; padding: 0.5rem 0.7rem; margin-top: 0.25rem;
}
.ai-note::before { content: "📋 "; }

/* Feedback bar */
.feedback-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem;
  margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border);
}
.feedback-label { font-weight: 600; }
.feedback-hint { color: var(--text-muted); font-size: 0.82rem; flex-basis: 100%; }

/* Privacy */
.privacy-text { background: var(--surface-muted); border-left: 4px solid var(--primary); padding: 0.8rem 1rem; border-radius: 6px; }
.privacy-list { padding-left: 1.2rem; }
.privacy-note { color: var(--text-muted); font-size: 0.9rem; }

/* Footer */
.site-footer { background: var(--bg); color: #cbd5e1; padding: 1.25rem 0; margin-top: 2rem; text-align: center; font-size: 0.9rem; }

/* Responsive */
@media (max-width: 780px) {
  .selector-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .selector-grid { grid-template-columns: 1fr; }
  .rating-buttons { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 1.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
