/* ═══════════════════════════════════════════════
   DecisionWeigh — Design System & Global Styles
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=Instrument+Serif:ital@0;1&display=swap');

/* ── CSS Variables ─────────────────────────── */
:root {
  /* Brand */
  --brand:        #2563eb;
  --brand-light:  #3b82f6;
  --brand-dim:    rgba(37,99,235,0.12);
  --brand-glow:   rgba(37,99,235,0.25);

  /* Surface */
  --bg:           #f8f9fc;
  --bg2:          #f0f2f8;
  --bg3:          #e8ebf4;
  --surface:      #ffffff;
  --surface2:     #f5f6fb;
  --surface3:     #eef0f8;

  /* Borders */
  --border:       rgba(0,0,0,0.07);
  --border-med:   rgba(0,0,0,0.11);

  /* Text */
  --text:         #0f1117;
  --text-2:       #3d4357;
  --text-3:       #6b718f;
  --text-4:       #9ba3bf;

  /* Semantic */
  --pro:          #059669;
  --pro-bg:       rgba(5,150,105,0.07);
  --pro-border:   rgba(5,150,105,0.18);
  --con:          #dc2626;
  --con-bg:       rgba(220,38,38,0.06);
  --con-border:   rgba(220,38,38,0.15);
  --warn:         #d97706;
  --warn-bg:      rgba(217,119,6,0.08);
  --winner:       #b45309;
  --winner-bg:    rgba(251,191,36,0.08);
  --winner-border:rgba(245,158,11,0.3);

  /* Elevation */
  --shadow-xs:    0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md:    0 4px 20px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.05);
  --shadow-lg:    0 12px 40px rgba(0,0,0,0.10), 0 4px 16px rgba(0,0,0,0.06);
  --shadow-xl:    0 24px 64px rgba(0,0,0,0.12), 0 8px 24px rgba(0,0,0,0.07);

  /* Geometry */
  --radius-xs:    6px;
  --radius-sm:    10px;
  --radius:       14px;
  --radius-lg:    20px;
  --radius-xl:    28px;
  --radius-full:  999px;

  /* Motion */
  --ease:         cubic-bezier(.4,0,.2,1);
  --ease-spring:  cubic-bezier(.34,1.56,.64,1);
  --t-fast:       0.15s;
  --t:            0.25s;
  --t-slow:       0.4s;

  /* Layout */
  --max-w:        1100px;
  --nav-h:        64px;
}

[data-theme="dark"] {
  --bg:           #080b12;
  --bg2:          #0d1018;
  --bg3:          #131820;
  --surface:      #141922;
  --surface2:     #1a2030;
  --surface3:     #1f2638;
  --border:       rgba(255,255,255,0.06);
  --border-med:   rgba(255,255,255,0.10);
  --text:         #eef0f7;
  --text-2:       #b8bdcf;
  --text-3:       #737a94;
  --text-4:       #454d66;
  --shadow-xs:    0 1px 3px rgba(0,0,0,0.3);
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.35);
  --shadow-md:    0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg:    0 12px 40px rgba(0,0,0,0.5);
  --shadow-xl:    0 24px 64px rgba(0,0,0,0.6);
  --pro-bg:       rgba(5,150,105,0.10);
  --con-bg:       rgba(220,38,38,0.09);
  --winner-bg:    rgba(251,191,36,0.07);
  --brand-dim:    rgba(59,130,246,0.14);
}

/* ── Reset ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background var(--t), color var(--t);
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; }
::selection { background: var(--brand); color: #fff; }

/* ── Typography ────────────────────────────── */
.serif { font-family: 'Instrument Serif', Georgia, serif; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.3px; }

/* ── Scrollbar ─────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

/* ── Layout ────────────────────────────────── */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }
@media(max-width:600px) { .container { padding: 0 16px; } }

/* ── Navigation ────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(248,249,252,0.85);
  backdrop-filter: blur(20px) saturate(1.8);
  border-bottom: 1px solid var(--border);
  transition: background var(--t), border-color var(--t);
}
[data-theme="dark"] .nav {
  background: rgba(8,11,18,0.85);
}
.nav-inner {
  height: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; flex-shrink: 0;
}
.nav-logo-mark {
  width: 36px; height: 36px;
  background: var(--brand);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 12px var(--brand-glow);
  flex-shrink: 0;
}
.nav-logo-text {
  font-size: 16px; font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text);
}
.nav-logo-text span { color: var(--brand); }
.nav-right { display: flex; align-items: center; gap: 8px; }

/* ── Buttons ────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: inherit; font-size: 14px; font-weight: 500;
  border: none; border-radius: var(--radius-sm);
  padding: 9px 18px; cursor: pointer;
  transition: all var(--t) var(--ease);
  text-decoration: none; white-space: nowrap;
  position: relative; overflow: hidden;
}
.btn::after {
  content: ''; position: absolute; inset: 0;
  background: transparent;
  transition: background var(--t-fast);
}
.btn:hover::after { background: rgba(255,255,255,0.07); }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--brand); color: #fff;
  box-shadow: 0 2px 8px var(--brand-glow);
  font-weight: 600;
}
.btn-primary:hover { background: var(--brand-light); box-shadow: 0 4px 16px var(--brand-glow); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
  background: var(--surface); color: var(--text-2);
  border: 1px solid var(--border-med);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-dim); }

.btn-ghost {
  background: transparent; color: var(--text-3);
  padding: 8px 12px;
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

.btn-danger {
  background: var(--con-bg); color: var(--con);
  border: 1px solid var(--con-border);
}
.btn-danger:hover { background: rgba(220,38,38,0.12); }

.btn-lg { font-size: 16px; padding: 13px 28px; border-radius: var(--radius); font-weight: 600; }
.btn-sm { font-size: 13px; padding: 6px 14px; }
.btn-icon { padding: 8px; border-radius: var(--radius-xs); }
.btn-full { width: 100%; }

/* ── Icon Button ───────────────────────────── */
.icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  cursor: pointer;
  transition: all var(--t);
  font-size: 16px;
  color: var(--text-3);
  box-shadow: var(--shadow-xs);
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-dim); }

/* ── Cards ─────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 28px; }
@media(max-width:600px) { .card-pad { padding: 20px; } }

/* ── Form ───────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 13px; font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.7px;
  margin-bottom: 8px;
}
.form-label .opt {
  font-weight: 400; text-transform: none; letter-spacing: 0;
  color: var(--text-4); font-size: 12px; margin-left: 6px;
}
.form-input, .form-textarea {
  width: 100%;
  background: var(--surface2);
  border: 1.5px solid var(--border-med);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  padding: 12px 16px;
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
  outline: none;
}
.form-textarea { resize: vertical; min-height: 110px; line-height: 1.6; }
.form-input:focus, .form-textarea:focus {
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--brand-dim);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-4); }
.form-hint { font-size: 12px; color: var(--text-4); margin-top: 6px; }
.form-error { font-size: 12px; color: var(--con); margin-top: 6px; }

/* Checkbox */
.checkbox-label {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; user-select: none;
  font-size: 14px; color: var(--text-2);
}
.checkbox-label input[type="checkbox"] {
  width: 17px; height: 17px;
  accent-color: var(--brand);
  cursor: pointer; flex-shrink: 0;
}

/* Range slider */
.slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px;
  background: var(--bg3); border-radius: 4px; cursor: pointer;
  outline: none;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 1px 4px var(--brand-glow);
  cursor: pointer;
  transition: transform var(--t-fast);
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.15); }

/* ── Divider ────────────────────────────────── */
.divider {
  border: none; border-top: 1px solid var(--border);
  margin: 24px 0;
}
.divider-text {
  display: flex; align-items: center; gap: 12px;
  font-size: 13px; color: var(--text-4);
  margin: 20px 0;
}
.divider-text::before, .divider-text::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── Badge ──────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.4px;
  padding: 3px 10px; border-radius: var(--radius-full);
  text-transform: uppercase;
}
.badge-blue  { background: var(--brand-dim); color: var(--brand); }
.badge-green { background: var(--pro-bg); color: var(--pro); }
.badge-red   { background: var(--con-bg); color: var(--con); }
.badge-gold  { background: var(--winner-bg); color: var(--winner); border: 1px solid var(--winner-border); }

/* ── Toast ──────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-sm);
  padding: 13px 18px;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  pointer-events: auto;
  animation: toastIn var(--t) var(--ease-spring);
  max-width: 320px;
}
.toast.error { border-color: var(--con-border); }
.toast.success { border-color: var(--pro-border); }
.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-msg { color: var(--text-2); flex: 1; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(20px) scale(0.95); }
}

/* ── Modal ──────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--t);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%; max-width: 460px;
  padding: 36px;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--t) var(--ease-spring);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-close {
  position: absolute; top: 20px; right: 20px;
}
@media(max-width:500px) { .modal { padding: 24px; } }

/* ── Loading ────────────────────────────────── */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border-med);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-xs);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Animations ─────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
.anim-fade-up   { animation: fadeUp var(--t-slow) var(--ease) forwards; }
.anim-fade-in   { animation: fadeIn var(--t) var(--ease) forwards; }
.anim-scale-in  { animation: scaleIn var(--t) var(--ease-spring) forwards; }

/* ── Language Picker ────────────────────────── */
.lang-picker {
  position: relative;
}
.lang-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: var(--surface); border: 1px solid var(--border-med);
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; color: var(--text-2);
  cursor: pointer; transition: all var(--t);
  box-shadow: var(--shadow-xs);
}
.lang-btn:hover { border-color: var(--brand); color: var(--brand); }
.lang-flag { font-size: 16px; }
.lang-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  min-width: 160px; z-index: 50;
  overflow: hidden;
  display: none;
}
.lang-dropdown.open { display: block; animation: scaleIn 0.15s var(--ease-spring); }
.lang-option {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  font-size: 13px; color: var(--text-2);
  cursor: pointer; transition: background var(--t-fast);
}
.lang-option:hover { background: var(--surface2); }
.lang-option.active { color: var(--brand); font-weight: 600; }

/* ── Theme Toggle ───────────────────────────── */
.theme-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-med);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer; transition: all var(--t);
  font-size: 16px; color: var(--text-3);
  box-shadow: var(--shadow-xs);
}
.theme-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-dim); }

/* ── User Avatar ────────────────────────────── */
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #7c3aed);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0; cursor: pointer;
  border: 2px solid var(--border);
  transition: border-color var(--t);
  overflow: hidden;
}
.avatar:hover { border-color: var(--brand); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── User Menu ──────────────────────────────── */
.user-menu-wrap { position: relative; }
.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  min-width: 200px; z-index: 50;
  overflow: hidden;
  display: none;
}
.user-dropdown.open { display: block; animation: scaleIn 0.15s var(--ease-spring); }
.user-dropdown-header {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.user-dropdown-name { font-weight: 600; font-size: 14px; }
.user-dropdown-email { font-size: 12px; color: var(--text-4); margin-top: 2px; }
.user-dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  font-size: 13px; color: var(--text-2);
  cursor: pointer; transition: background var(--t-fast);
  text-decoration: none;
}
.user-dropdown-item:hover { background: var(--surface2); }
.user-dropdown-item.danger { color: var(--con); }
.user-dropdown-item.danger:hover { background: var(--con-bg); }

/* ── Error Banner ───────────────────────────── */
.error-banner {
  display: none;
  background: var(--con-bg);
  border: 1px solid var(--con-border);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  font-size: 14px; color: var(--con);
  line-height: 1.5; margin-top: 16px;
}
.error-banner.show { display: flex; align-items: flex-start; gap: 10px; }

/* ── Misc Utility ───────────────────────────── */
.text-muted { color: var(--text-3); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0 !important; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Page Transition ────────────────────────── */
.page-enter { animation: fadeIn 0.2s var(--ease); }

/* ══════════════════════════════════════════
   MOBILE NAV FIXES
   ══════════════════════════════════════════ */
@media (max-width: 640px) {

  /* Nav height iets groter zodat alles past */
  :root { --nav-h: 56px; }

  .nav-inner { gap: 8px; }

  /* Logo tekst verbergen op kleine schermen */
  .nav-logo-text { display: none; }

  /* Lang knop: toon alleen vlag op mobiel */
  .lang-btn span:not(.lang-flag) { display: none; }
  .lang-btn {
    padding: 6px 8px;
    min-width: unset;
  }

  /* Theme button kleiner */
  .theme-btn {
    width: 32px; height: 32px;
    font-size: 14px;
  }

  /* Quota badge: compacter */
  #quota-badge {
    font-size: 11px !important;
    padding: 3px 7px !important;
    max-width: 90px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Upgrade knop verbergen op mobiel in nav (staat ook in dropdown) */
  .nav-right a[href="/pages/pricing.html"] {
    display: none;
  }

  /* Geschiedenis knop verbergen op mobiel (staat in dropdown) */
  .nav-right a[href="/pages/dashboard.html"] {
    display: none;
  }

  /* Knoppen inloggen/registreren kleiner */
  #nav-auth .btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  /* Nav-btn-group gap kleiner */
  .nav-btn-group { gap: 4px; }
}

@media (max-width: 380px) {
  /* Zeer kleine schermen: registreer knop verbergen, alleen inloggen tonen */
  #nav-auth .btn:last-child { display: none; }

  #quota-badge { display: none !important; }
}
