/* Darija Academy — modern, vriendelijk thema met light/dark toggle */

/* ===== Light theme (standaard) ===== */
:root {
  --bg-page: #f7f8fb;
  --bg-card: #ffffff;
  --bg-soft: #f1f3f8;
  --bg-strong: #e6e9f0;
  --border: #e2e5ec;
  --border-strong: #cfd4de;
  --text: #1a1f2b;
  --text-dim: #606876;
  --text-muted: #8b94a3;

  --primary: #2563eb;          /* rustige blauwe kleur */
  --primary-hover: #1d4ed8;
  --primary-soft: #dbeafe;
  --primary-tint: rgba(37, 99, 235, 0.08);

  --accent: #f59e0b;            /* warme amber voor XP / highlights */
  --accent-soft: #fef3c7;

  --success: #16a34a;
  --success-soft: #dcfce7;
  --danger:  #dc2626;
  --danger-soft:  #fee2e2;
  --warning: #d97706;

  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.05);
  --shadow:    0 4px 16px rgba(17, 24, 39, 0.08);
  --shadow-lg: 0 12px 32px rgba(17, 24, 39, 0.12);

  --radius: 12px;
  --radius-sm: 8px;

  color-scheme: light;
}

/* ===== Dark theme ===== */
:root[data-theme="dark"] {
  --bg-page: #0f1420;
  --bg-card: #19202e;
  --bg-soft: #1f2839;
  --bg-strong: #2a3347;
  --border: #2a3347;
  --border-strong: #3a4459;
  --text: #eef1f6;
  --text-dim: #a3adbf;
  --text-muted: #7a8494;

  --primary: #60a5fa;
  --primary-hover: #3b82f6;
  --primary-soft: #1e3a8a;
  --primary-tint: rgba(96, 165, 250, 0.12);

  --accent: #fbbf24;
  --accent-soft: #422006;

  --success: #4ade80;
  --success-soft: #14532d;
  --danger:  #f87171;
  --danger-soft:  #7f1d1d;
  --warning: #fbbf24;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow:    0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-page);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  min-height: 100vh;
  line-height: 1.55;
  transition: background-color 0.25s, color 0.25s;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Navbar ===== */
.navbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.navbar .brand {
  font-weight: 700; font-size: 1.15rem;
  color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.navbar .brand .logo {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: white;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem;
  letter-spacing: -0.02em;
}
.navbar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.navbar nav a {
  color: var(--text-dim);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 500;
  transition: all .15s;
}
.navbar nav a:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.navbar nav a.active { color: var(--primary); background: var(--primary-tint); }

.navbar .actions { display: flex; align-items: center; gap: 10px; }
.navbar .user-badge {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 30px;
  font-size: 0.88rem;
}
.navbar .user-badge .avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.82rem;
}
.navbar .user-badge .xp {
  color: var(--accent); font-weight: 700;
  background: var(--accent-soft);
  padding: 2px 10px; border-radius: 12px;
  font-size: 0.82rem;
}

.theme-toggle {
  width: 38px; height: 38px; padding: 0;
  border-radius: 50%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 1.05rem;
  color: var(--text-dim);
  transition: all .2s;
  display: inline-flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { background: var(--bg-strong); color: var(--text); transform: rotate(20deg); }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ===== Typography ===== */
h1, h2, h3 { margin: 0 0 12px 0; font-weight: 700; letter-spacing: -0.015em; color: var(--text); }
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }

.subtitle { color: var(--text-dim); margin-bottom: 24px; }
.accent { color: var(--primary); }
.text-dim { color: var(--text-dim); }
.text-muted { color: var(--text-muted); }

/* ===== Cards ===== */
.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: all .2s ease;
  position: relative;
  color: var(--text);
}
.card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.card h3 { margin-bottom: 6px; }
.card p { color: var(--text-dim); margin: 6px 0; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-soft);
  color: var(--text-dim);
  margin-right: 6px;
}
.badge.beginner  { background: var(--success-soft); color: var(--success); }
.badge.gevorderd { background: var(--accent-soft);  color: var(--accent); }
.badge.expert    { background: var(--danger-soft);  color: var(--danger); }
.badge.done      { background: var(--primary-soft); color: var(--primary); }

/* Leerpad card */
.path-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px;
  position: relative;
  transition: all .2s;
  text-decoration: none;
  color: inherit;
  display: block;
  overflow: hidden;
}
.path-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border-radius: 4px 0 0 4px;
}
.path-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--primary); }
.path-card .level-label {
  position: absolute; top: 18px; right: 20px;
  font-size: 0.72rem; color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.path-card h2 { color: var(--text); font-size: 1.3rem; }
.path-card .progress-bar {
  height: 8px; background: var(--bg-strong); border-radius: 4px; margin-top: 16px; overflow: hidden;
}
.path-card .progress-bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #7c3aed);
  transition: width .4s;
  border-radius: 4px;
}
.path-card .progress-text { font-size: 0.85rem; color: var(--text-dim); margin-top: 8px; font-weight: 500; }

/* ===== Forms & buttons ===== */
.form-wrap {
  max-width: 440px; margin: 60px auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px;
  box-shadow: var(--shadow);
}
.form-wrap h1 { color: var(--text); font-size: 1.8rem; }

label { display: block; margin: 14px 0 6px; font-size: 0.9rem; color: var(--text-dim); font-weight: 500; }

input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  transition: all .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-tint);
}
input::placeholder { color: var(--text-muted); }

.btn {
  display: inline-block;
  padding: 11px 22px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
  text-decoration: none;
}
.btn:hover { background: var(--primary-hover); transform: translateY(-1px); text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn.btn-secondary {
  background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--border);
}
.btn.btn-secondary:hover { background: var(--bg-strong); color: var(--text); }
.btn.btn-danger { background: var(--danger); color: white; }
.btn.btn-success { background: var(--success); color: white; }
.btn.full { width: 100%; }
.btn.small { padding: 7px 14px; font-size: 0.85rem; }

.link-btn {
  background: transparent; color: var(--primary); border: none; cursor: pointer;
  padding: 0; font-family: inherit; font-size: inherit; font-weight: 600;
}
.link-btn:hover { text-decoration: underline; }

.error {
  background: var(--danger-soft); color: var(--danger);
  border: 1px solid transparent;
  padding: 10px 14px; border-radius: var(--radius-sm);
  margin-top: 14px; font-size: 0.9rem;
}
.success {
  background: var(--success-soft); color: var(--success);
  border: 1px solid transparent;
  padding: 10px 14px; border-radius: var(--radius-sm);
  margin-top: 14px; font-size: 0.9rem;
}

/* ===== Tables ===== */
table {
  width: 100%; border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
th {
  text-align: left;
  background: var(--bg-soft);
  padding: 14px 18px;
  font-size: 0.78rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 0.93rem;
  color: var(--text);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--primary-tint); }

.rank-cell { font-weight: 700; }
.rank-1 { color: #eab308; }
.rank-2 { color: #94a3b8; }
.rank-3 { color: #c77d39; }

/* ===== Lesson & quiz views ===== */
.lesson-view, .quiz-view { max-width: 820px; margin: 0 auto; }

.lesson-view .intro {
  background: var(--primary-tint);
  border: 1px solid transparent;
  border-left: 4px solid var(--primary);
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 22px;
  color: var(--text);
}

.vocab-list, .examples-list { list-style: none; padding: 0; margin: 0 0 22px 0; }
.vocab-list li, .examples-list li {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  flex-wrap: wrap;
  transition: border-color .15s;
}
.vocab-list li:hover, .examples-list li:hover { border-color: var(--primary); }
.vocab-list .d, .examples-list .d { color: var(--primary); font-weight: 600; }
.vocab-list .nl, .examples-list .nl { color: var(--text-dim); }

.quiz-question {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  margin-bottom: 18px;
}
.quiz-question h3 { margin-bottom: 16px; font-size: 1.15rem; }
.quiz-options { display: grid; gap: 10px; }
.quiz-options .option-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.quiz-options .option-main,
.quiz-options > button {
  flex: 1;
  text-align: left;
  padding: 13px 16px;
  background: var(--bg-soft);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all .15s;
  font-weight: 500;
}
.quiz-options .option-main:hover:not(:disabled),
.quiz-options > button:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-tint);
}
.quiz-options .option-main.selected,
.quiz-options > button.selected { border-color: var(--primary); background: var(--primary-tint); }
.quiz-options .option-main.correct,
.quiz-options > button.correct {
  border-color: var(--success);
  background: var(--success-soft);
  color: var(--success);
}
.quiz-options .option-main.wrong,
.quiz-options > button.wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}
.quiz-options .option-main:disabled,
.quiz-options > button:disabled { cursor: not-allowed; }
.quiz-options .option-row .speak-btn {
  align-self: center;
  flex-shrink: 0;
}

.image-big {
  font-size: 6rem;
  text-align: center;
  padding: 40px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

/* ===== Meters ===== */
.meter-row { display: flex; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.meter {
  flex: 1; min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.meter .label {
  font-size: 0.78rem; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 8px; font-weight: 600;
}
.meter .value {
  font-size: 1.9rem; font-weight: 700; color: var(--primary);
}
.meter .detail { font-size: 0.85rem; color: var(--text-dim); margin-top: 4px; }

/* ===== Dictionary ===== */
.dict-filter {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px;
}
.dict-filter input { flex: 1; min-width: 220px; }
.dict-entry {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  display: grid;
  grid-template-columns: 1.5fr 1.5fr 2fr auto;
  gap: 16px; align-items: center;
  transition: border-color .15s;
}
.dict-entry:hover { border-color: var(--primary); }
.dict-entry .cat {
  font-size: 0.75rem; padding: 3px 10px;
  background: var(--bg-soft); border-radius: 999px;
  color: var(--text-dim); justify-self: end;
  font-weight: 500;
}
.dict-entry .darija { color: var(--primary); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.dict-entry .arabic { font-size: 1.25rem; color: var(--text); text-align: right; direction: rtl; }
.dict-entry .nl { color: var(--text-dim); }

/* ===== Speak button (🔊) ===== */
.speak-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
  font-family: inherit;
}
.speak-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
  transform: scale(1.08);
}
.speak-btn:active { transform: scale(0.96); }
.speak-btn.small { width: 26px; height: 26px; font-size: 0.8rem; }
.vocab-list .d, .examples-list .d { display: inline-flex; align-items: center; gap: 8px; }
@media (max-width: 720px) {
  .dict-entry { grid-template-columns: 1fr; gap: 6px; }
  .dict-entry .arabic { text-align: left; }
  .dict-entry .cat { justify-self: start; }
}

/* ===== Hero & utilities ===== */
.hero { text-align: center; padding: 40px 20px 20px; }
.hero h1 { font-size: 2.6rem; margin-bottom: 14px; }
.hero .subtitle { font-size: 1.08rem; max-width: 640px; margin: 0 auto 28px; }

.center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.flex { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.space-between { justify-content: space-between; }

.loading { color: var(--text-dim); }

/* ===== Small screens ===== */
@media (max-width: 720px) {
  .navbar { padding: 10px 16px; flex-wrap: wrap; gap: 10px; }
  .navbar nav { order: 3; width: 100%; }
  .container { padding: 20px 14px; }
  h1 { font-size: 1.7rem; }
  .hero h1 { font-size: 2rem; }
  .image-big { font-size: 4rem; padding: 24px; }
}
