@import url('https://fonts.googleapis.com/css2?family=Fraunces:wght@500;700&family=Space+Grotesk:wght@400;500;700&display=swap');

/* ================= THEME ================= */
html[data-theme="light"] {
  --ink: #121b2a;
  --ink-soft: #354258;
  --sky: #dff3ff;
  --mint: #b7f2d8;
  --sun: #ffd166;
  --coral: #ff7a59;
  --paper: #f8f5ef;
  --white: #ffffff;
  --shadow: 0 20px 50px rgba(17, 28, 53, 0.12);
  --radius: 24px;
  --bg: var(--paper);
  --panel: var(--white);
  --card: var(--white);
  --accent: var(--ink);
  --accent-soft: rgba(18, 27, 42, 0.08);
  --text: var(--ink);
  --muted: var(--ink-soft);
  --border: rgba(18, 27, 42, 0.12);
  --success: #22c55e;
  --error: #ff7a59;
}

html[data-theme="dark"] {
  --ink: #e6edf7;
  --ink-soft: #b9c2d0;
  --sky: #1d2a3a;
  --mint: #3fbf9c;
  --sun: #ffc857;
  --coral: #ff8a6d;
  --paper: #0b1220;
  --white: #121a2b;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  --radius: 24px;
  --bg: var(--paper);
  --panel: #151f32;
  --card: #151f32;
  --accent: #f3f6fb;
  --accent-soft: rgba(243, 246, 251, 0.14);
  --text: var(--ink);
  --muted: var(--ink-soft);
  --border: rgba(243, 246, 251, 0.18);
  --success: #22c55e;
  --error: #ff8a6d;
}

/* ================= GLOBAL ================= */
* { box-sizing: border-box; }
body { 
  margin: 0; 
  font-family: 'Space Grotesk', sans-serif; 
  color: var(--text); 
  background: radial-gradient(circle at top left, #fef4d7 0%, #f7f0ff 35%, #e6f7ff 70%, #fefefe 100%);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.4s; 
}
html[data-theme="dark"] body {
  background: radial-gradient(circle at top left, #18243a 0%, #0f1726 45%, #0b1220 100%);
}
.bg-orbit {
  position: fixed;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 209, 102, 0.4), rgba(255, 122, 89, 0.2), transparent 70%);
  top: -160px;
  right: -140px;
  filter: blur(10px);
  z-index: 0;
}
.bg-grid {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(18, 27, 42, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 27, 42, 0.05) 1px, transparent 1px);
  background-size: 80px 80px;
  opacity: 0.4;
  z-index: 0;
}
html[data-theme="dark"] .bg-orbit {
  background: radial-gradient(circle, rgba(63, 191, 156, 0.2), rgba(255, 138, 109, 0.12), transparent 70%);
}
html[data-theme="dark"] .bg-grid {
  background-image: linear-gradient(rgba(230, 237, 247, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(230, 237, 247, 0.08) 1px, transparent 1px);
  opacity: 0.25;
}
.app { max-width: 1200px; margin: auto; padding: 28px 8vw 60px; position: relative; z-index: 1; }

/* ================= HERO (GECENTREERD) ================= */
.hero {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 32px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
  box-shadow: var(--shadow);
  border: 1px solid rgba(18, 27, 42, 0.08);
}
.hero-right { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.clock-time { font-size: 48px; font-weight: 800; line-height: 1; font-family: 'Fraunces', serif; }
.theme-btn { 
  margin-top: 5px; background: var(--accent); border: none; 
  color: var(--white); padding: 8px 18px; border-radius: 999px; cursor: pointer; box-shadow: var(--shadow); 
}

/* ================= NAV ================= */
.nav { display: flex; gap: 12px; margin: 30px 0; flex-wrap: wrap; }
.nav button { 
  background: transparent; border: 1px solid rgba(18, 27, 42, 0.2); padding: 12px 20px; 
  border-radius: 999px; cursor: pointer; color: var(--text); font-weight: 600; transition: 0.2s;
}
.nav button.active { background: var(--accent); color: var(--white); border-color: var(--accent); box-shadow: var(--shadow); }
html[data-theme="dark"] .nav button {
  border-color: rgba(243, 246, 251, 0.28);
  color: var(--black);
}
html[data-theme="dark"] .nav button.active {
  color: #0b1220;
  background-color: #ff8a6d;
}

.section { display: none; }
.section.active { display: block; }

/* ================= CARDS & INPUTS ================= */
.card { background: var(--panel); border-radius: var(--radius); padding: 25px; border: 1px solid rgba(18, 27, 42, 0.08); margin-bottom: 25px; box-shadow: var(--shadow); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 25px; }
.stat-card { background: var(--panel); border-radius: 20px; padding: 20px; text-align: center; border: 1px solid rgba(18, 27, 42, 0.08); box-shadow: var(--shadow); }
.stat-card h2 { margin: 0; color: var(--accent); font-size: 32px; font-family: 'Fraunces', serif; }

input, textarea { 
  width: 100%; background: var(--panel) !important; color: var(--text) !important; 
  border: 1px solid rgba(18, 27, 42, 0.12); padding: 14px 15px; border-radius: 14px; margin-bottom: 12px; outline: none; font-size: 16px;
}
textarea {
  border: 1px solid rgba(18, 27, 42, 0.2);
}
.btn-primary { background: var(--accent); color: var(--white); border: none; padding: 15px 18px; border-radius: 999px; font-weight: 700; cursor: pointer; width: 100%; font-size: 16px; box-shadow: var(--shadow); }
html[data-theme="dark"] .card,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
  border-color: rgba(243, 246, 251, 0.2) !important;
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: rgba(247, 230, 230, 0.6);
}
html[data-theme="dark"] .btn-primary {
  color: #0b1220;
  background-color: #ff8a6d;
}

/* ================= TOETSEN & GRID ================= */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.toets-card { 
  background: var(--panel); border-radius: 20px; padding: 20px; border: 1px solid rgba(18, 27, 42, 0.08); 
  border-left: 6px solid var(--coral); position: relative; box-shadow: var(--shadow);
}
.toets-badge { background: var(--sky); color: var(--ink); padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; margin-bottom: 10px; display: inline-block; }
html[data-theme="dark"] .toets-badge {
  background: rgba(230, 237, 247, 0.14);
  color: rgba(230, 237, 247, 0.85);
}
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 22px;
}
.filter-btn {
  background: transparent;
  border: 1px solid rgba(18, 27, 42, 0.2);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.filter-btn.active {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
html[data-theme="dark"] .filter-btn.active { 
  background-color: #ff8a6d;
}
html[data-theme="dark"] .filter-btn {
  border-color: rgba(243, 246, 251, 0.28);
}
html[data-theme="dark"] .filter-btn.active {
  color: #0b1220;
}

/* ================= FLASHCARDS (3D) ================= */
.flashcard-container { perspective: 1000px; height: 160px; cursor: pointer; }
.flashcard-inner { position: relative; width: 100%; height: 100%; transition: transform 0.6s; transform-style: preserve-3d; }
.flashcard-container.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-front, .flashcard-back { 
  position: absolute; width: 100%; height: 100%; backface-visibility: hidden; 
  display: flex; align-items: center; justify-content: center; padding: 20px; border-radius: 20px; border: 1px solid rgba(18, 27, 42, 0.08); text-align: center; font-weight: 600;
}
.flashcard-front { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.flashcard-back { background: linear-gradient(120deg, var(--mint), var(--sun), var(--coral)); color: var(--ink); transform: rotateY(180deg); }
html[data-theme="dark"] .flashcard-back {
  color: #0b1220;
}

.button-group { display: flex; gap: 10px; margin-bottom: 15px; }
.btn-outline { background: transparent; border: 1px solid rgba(18, 27, 42, 0.2); color: var(--ink); flex: 1; padding: 14px 16px; border-radius: 999px; font-weight: 700; cursor: pointer; }
html[data-theme="dark"] .btn-outline {
  border-color: rgba(243, 246, 251, 0.28);
  color: var(--text);
}

/* ================= ANIMATIES & FEEDBACK ================= */
.success-glow { border-color: var(--success) !important; box-shadow: 0 0 12px rgba(34,197,94,0.3); }
.error-glow { border-color: var(--error) !important; box-shadow: 0 0 12px rgba(239,68,68,0.3); }

@media (max-width: 768px) { .hero { flex-direction: column; text-align: center; gap: 20px; } }
