/* ═══════════════════════════════════════════
   VAULT PRO — Design System
   3 themes: pro-dark (default), pro-light, original
   ═══════════════════════════════════════════ */

/* ── FONTS ── */
:root {
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
}

/* ═══ PRO DARK — Default (exact uit prototype) ═══ */
:root,
[data-theme="pro-dark"] {
  --bg: #060a13;
  --s1: #0c1220;
  --s2: #131c2e;
  --s3: #1a2540;
  --border: rgba(255,255,255,0.07);
  --borderH: rgba(255,255,255,0.14);
  --text: #f1f5f9;
  --text2: #8b9dc3;
  --muted: #4a5a7a;
  --pos: #34d399;
  --neg: #f87171;
  --warn: #fbbf24;
  --accent: #3b82f6;
  --prem: #a78bfa;
  --cyan: #22d3ee;
  --nav-bg: rgba(6,10,19,0.88);
  --card-shadow: 0 0 0 1px rgba(255,255,255,0.03), 0 2px 8px rgba(0,0,0,0.3);
  --card-shadow-hover: 0 0 0 1px rgba(255,255,255,0.06), 0 4px 16px rgba(0,0,0,0.4);
  --noise-opacity: 0.025;
  --scrollbar-thumb: #4a5a7a;
}

/* ═══ PRO LIGHT — Spiegelbeeld van dark ═══ */
[data-theme="pro-light"] {
  --bg: #f0f2f5;
  --s1: #ffffff;
  --s2: #f7f8fa;
  --s3: #e8ecf0;
  --border: rgba(0,0,0,0.08);
  --borderH: rgba(0,0,0,0.15);
  --text: #0f172a;
  --text2: #475569;
  --muted: #94a3b8;
  --pos: #059669;
  --neg: #dc2626;
  --warn: #d97706;
  --accent: #2563eb;
  --prem: #7c3aed;
  --cyan: #0891b2;
  --nav-bg: rgba(255,255,255,0.85);
  --card-shadow: 0 0 0 1px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.06);
  --card-shadow-hover: 0 0 0 1px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.08);
  --noise-opacity: 0.012;
  --scrollbar-thumb: #94a3b8;
}

/* ═══ ORIGINAL — Exact uit vault-dashboard-v5_14.html ═══ */
[data-theme="original"] {
  --bg: #06090f;
  --s1: #0c1119;
  --s2: #141c2b;
  --s3: #1b2538;
  --border: #2a3550;
  --borderH: #384766;
  --text: #e8ecf4;
  --text2: #9aa5bb;
  --muted: #65738d;
  --pos: #10b981;
  --neg: #ef4444;
  --warn: #f59e0b;
  --accent: #3b82f6;
  --prem: #a78bfa;
  --cyan: #22d3ee;
  --nav-bg: rgba(6,9,15,0.88);
  --card-shadow: none;
  --card-shadow-hover: none;
  --noise-opacity: 0;
  --scrollbar-thumb: #2a3550;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --card-radius: 12px;
}

/* Original theme: grid lines ipv noise texture */
[data-theme="original"] body::before,
[data-theme="original"]::before {
  background-image:
    linear-gradient(rgba(59,130,246,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59,130,246,0.02) 1px, transparent 1px) !important;
  background-size: 50px 50px !important;
  opacity: 1 !important;
}

/* Original theme: border-radius 12px ipv 14px */
[data-theme="original"] .pro-card,
[data-theme="original"] .grid-stack-item-content {
  border-radius: 12px;
}
[data-theme="original"] .grid-stack-placeholder > .placeholder-content {
  border-radius: 12px !important;
}

/* ═══ BASE ═══ */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Noise texture */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  opacity: var(--noise-opacity);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }

/* ═══ NAVBAR — Glassmorphism (exact uit prototype) ═══ */
.navbar {
  position: sticky; top: 0; z-index: 200;
  background: var(--nav-bg);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  padding: 0 28px; height: 52px;
  display: flex; align-items: center; gap: 14px;
}

.logo { font-weight: 800; font-size: 16px; letter-spacing: -0.3px; }
.logo span { color: var(--accent); font-weight: 400; }

.nav-tabs {
  display: flex; gap: 2px; flex: 1;
}

.nav-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 8px; border: none;
  background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 500; cursor: pointer;
  font-family: var(--font-body); transition: all 0.2s;
}

.nav-tab:hover { color: var(--text2); background: rgba(255,255,255,0.04); }
[data-theme="pro-light"] .nav-tab:hover { background: rgba(0,0,0,0.04); }

.nav-tab.active {
  color: var(--accent); font-weight: 600;
  background: rgba(59,130,246,0.1);
}

.nav-tab i { font-size: 16px; }

.nav-right {
  display: flex; align-items: center; gap: 8px;
}

.nav-user {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--text2);
  padding: 4px 8px; border-radius: 6px;
  background: rgba(255,255,255,0.04);
}
.nav-user i { font-size: 16px; color: var(--accent); }
.nav-user-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-clock {
  font-family: var(--font-mono);
  font-size: 12px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Buttons — exact uit prototype */
.btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 8px; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: var(--font-body); transition: all 0.2s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary { background: var(--s2); color: var(--text2); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--s3); color: var(--text); }
.btn-success { background: rgba(52,211,153,0.15); color: var(--pos); }
.btn-icon {
  width: 34px; height: 34px; padding: 0;
  border-radius: 8px; border: 1px solid var(--border);
  background: transparent; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px; transition: all 0.2s;
}
.btn-icon:hover { border-color: var(--borderH); color: var(--text2); }

/* Theme selector */
.theme-select {
  padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--s1); color: var(--text2);
  font-size: 12px; font-family: var(--font-body);
  cursor: pointer; outline: none;
}
.theme-select option { background: var(--s1); color: var(--text); }

/* ═══ EDIT BANNER ═══ */
.edit-banner {
  margin: 14px 28px 0; padding: 12px 18px; border-radius: 12px;
  background: rgba(59,130,246,0.06); border: 1px solid rgba(59,130,246,0.15);
  font-size: 12px; color: var(--text2); line-height: 1.6;
}
.edit-banner b { color: var(--text); }

/* ═══ GRIDSTACK OVERRIDES — Exact uit prototype ═══ */
.grid-stack { margin: 14px 28px 60px; }

.grid-stack-item-content {
  background: var(--s1);
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  display: flex; flex-direction: column;
  container-type: size;
  container-name: widget;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.grid-stack-item-content:hover {
  border-color: var(--borderH);
  box-shadow: var(--card-shadow-hover);
}

/* Placeholder */
.grid-stack-placeholder > .placeholder-content {
  background: rgba(59,130,246,0.08) !important;
  border: 2px dashed rgba(59,130,246,0.3) !important;
  border-radius: 14px !important;
}

/* Resize handles — SE corner, S edge, E edge */
.grid-stack > .grid-stack-item > .ui-resizable-handle { z-index: 10; }

.grid-stack > .grid-stack-item > .ui-resizable-se {
  width: 20px; height: 20px; right: 2px; bottom: 2px;
  background: none; cursor: se-resize;
}
.grid-stack > .grid-stack-item > .ui-resizable-se::after {
  content: ''; position: absolute; right: 4px; bottom: 4px;
  width: 10px; height: 10px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  border-radius: 0 0 3px 0; opacity: 0; transition: opacity 0.2s, border-color 0.2s;
}
.grid-stack > .grid-stack-item:hover > .ui-resizable-se::after { opacity: 1; }
.grid-stack > .grid-stack-item > .ui-resizable-se:hover::after { border-color: var(--accent); }

.grid-stack > .grid-stack-item > .ui-resizable-s {
  height: 8px; bottom: 0; left: 20px; right: 20px; cursor: s-resize;
}
.grid-stack > .grid-stack-item > .ui-resizable-s:hover {
  background: linear-gradient(to top, rgba(59,130,246,0.15), transparent);
}
.grid-stack > .grid-stack-item > .ui-resizable-e {
  width: 8px; right: 0; top: 20px; bottom: 20px; cursor: e-resize;
}
.grid-stack > .grid-stack-item > .ui-resizable-e:hover {
  background: linear-gradient(to left, rgba(59,130,246,0.15), transparent);
}

/* ═══ WIDGET INTERNALS — Exact uit prototype ═══ */
.w-inner {
  flex: 1; padding: 16px 18px;
  display: flex; flex-direction: column;
  overflow: hidden; min-height: 0;
}
.w-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px; flex-shrink: 0;
  cursor: grab; user-select: none;
  border-radius: 6px; padding: 2px 4px;
  margin: -2px -4px 8px; transition: background 0.15s;
}
.w-header:active { cursor: grabbing; }
.grid-stack:not(.locked) .w-header:hover { background: rgba(255,255,255,0.03); }
[data-theme="pro-light"] .grid-stack:not(.locked) .w-header:hover { background: rgba(0,0,0,0.03); }

.w-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--muted); flex: 1;
}
.w-badge {
  font-size: 9px; font-weight: 700; padding: 2px 7px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.w-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.w-number {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-weight: 800; line-height: 1.1;
}
.w-sub { font-size: 12px; color: var(--text2); margin-top: 4px; }
.w-desc { font-size: 11px; color: var(--muted); line-height: 1.5; }

/* Hero gradient text */
.hero-gradient {
  background: linear-gradient(135deg, var(--text), var(--text2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Gauge bar */
.gauge-track {
  height: 6px; border-radius: 3px; background: var(--s3);
  overflow: hidden; position: relative; margin: 8px 0;
}
.gauge-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--pos), var(--warn), var(--neg));
}
.gauge-marker {
  position: absolute; top: -2px; width: 2px; height: 10px;
  background: var(--text); border-radius: 1px;
}

/* Pills — exact uit prototype */
.pill {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px; border-radius: 12px;
  font-size: 11px; font-weight: 600;
  font-family: var(--font-mono);
}
.pill-pos { background: rgba(52,211,153,0.12); color: var(--pos); }
.pill-neg { background: rgba(248,113,113,0.12); color: var(--neg); }
.pill-warn { background: rgba(251,191,36,0.12); color: var(--warn); }
[data-theme="pro-light"] .pill-pos { background: rgba(5,150,105,0.1); }
[data-theme="pro-light"] .pill-neg { background: rgba(220,38,38,0.1); }
[data-theme="pro-light"] .pill-warn { background: rgba(217,119,6,0.1); }

/* Signal chips */
.signal-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px; font-size: 11px;
}
.signal-dot { width: 6px; height: 6px; border-radius: 50%; }

/* SVG Sparkline */
.sparkline { width: 100%; flex: 1; min-height: 30px; }
.sparkline svg { width: 100%; height: 100%; }

/* Donut */
.donut-wrap { flex-shrink: 0; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 5px; }

/* ═══ CONTAINER QUERIES — Exact uit prototype ═══ */

@container widget (max-width: 220px) {
  .w-inner { padding: 10px 12px; }
  .w-number { font-size: 26px; }
  .w-expanded, .w-standard-extra { display: none; }
  .w-desc { display: none; }
  .sparkline { min-height: 20px; }
}

@container widget (220px <= width <= 450px) {
  .w-number { font-size: 32px; }
  .w-expanded { display: none; }
}

@container widget (min-width: 450px) {
  .w-number { font-size: 40px; }
}

@container widget (min-width: 400px) and (max-height: 160px) {
  .w-body { flex-direction: row; align-items: center; gap: 16px; }
  .w-body > .w-data { flex: 0 0 auto; }
  .w-body > .sparkline { flex: 1; }
  .w-desc { display: none; }
}

@container widget (max-height: 140px) {
  .w-desc { display: none; }
  .w-expanded { display: none; }
  .w-header { margin-bottom: 4px; }
}

@container widget (min-height: 280px) {
  .w-expanded { display: block; }
}

@container widget (max-width: 250px) {
  .donut-wrap svg { width: 70px; height: 70px; }
  .donut-legend { font-size: 10px; }
}
@container widget (250px <= width <= 400px) {
  .donut-wrap svg { width: 100px; height: 100px; }
}
@container widget (min-width: 400px) {
  .donut-wrap svg { width: 140px; height: 140px; }
}

@container widget (max-width: 250px) {
  .fg-gauge svg { width: 80px; height: 80px; }
  .fg-val { font-size: 28px; }
}
@container widget (min-width: 250px) {
  .fg-gauge svg { width: 110px; height: 110px; }
  .fg-val { font-size: 36px; }
}

@container widget (max-width: 500px) {
  .regime-chips { flex-wrap: wrap; }
  .regime-verdict { margin-top: 8px; width: 100%; text-align: center; }
}

/* ═══ LOCKED MODE ═══ */
.grid-stack.locked .grid-stack-item-content { cursor: default; }
.grid-stack.locked .w-header { cursor: default; }
.grid-stack.locked .w-header:hover { background: none !important; }
.grid-stack.locked .ui-resizable-handle { display: none !important; }

/* ═══ PRO CARD — voor niet-dashboard tabs ═══ */
.pro-card {
  background: var(--s1);
  border-radius: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  transition: all 0.2s;
}
.pro-card:hover { box-shadow: var(--card-shadow-hover); }

.section-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--muted); margin-bottom: 10px;
}
.section-label i { font-size: 14px; }

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.pro-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pro-table th {
  text-align: left; padding: 8px 12px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); border-bottom: 1px solid var(--border);
}
.pro-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text2);
}
.pro-table tr:hover td { background: var(--s2); }

.vault-footer {
  margin: 0 28px; padding: 16px 0;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--muted);
}

/* ═══ B1: SKELETON LOADERS ═══ */
.skeleton {
  background: linear-gradient(90deg, var(--s2) 25%, var(--s3) 50%, var(--s2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text { height: 14px; margin-bottom: 8px; width: 60%; }
.skeleton-number { height: 36px; width: 40%; margin-bottom: 4px; }
.skeleton-chart { height: 100px; width: 100%; }
.skeleton-card { height: 80px; width: 100%; margin-bottom: 8px; }

/* ═══ B2: TAB SWITCH ANIMATION ═══ */
.pg.on {
  animation: fadeSlideIn 0.25s ease-out;
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══ B4: RESPONSIVE FIXES ═══ */
@media (min-width: 769px) and (max-width: 1024px) {
  .pro-card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

@media (max-width: 768px) {
  .navbar { padding: 0 14px; gap: 8px; }
  .nav-tab span { display: none; }
  .grid-stack { margin: 10px 14px 40px; }
  .edit-banner { margin: 10px 14px 0; }

  .nav-tab {
    padding: 10px 8px;
    min-height: 44px;
  }
  .btn, .btn-icon {
    min-height: 44px;
    min-width: 44px;
  }
  .nav-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
  }
  .nav-tabs::-webkit-scrollbar { display: none; }
  .nav-right { gap: 4px; }
  .nav-clock { display: none; }
  .nav-user-name { display: none; }
  .theme-select { font-size: 11px; padding: 4px 6px; }
  .pro-card { margin-bottom: 8px; }
}

@media (max-width: 375px) {
  .navbar { height: 48px; padding: 0 10px; }
  .logo { font-size: 14px; }
  .hero-gradient { font-size: 28px !important; }
}

/* ═══ B7: TOAST IMPROVEMENTS ═══ */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  padding: 12px 20px; border-radius: 10px;
  background: var(--s1); border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  color: var(--text); font-size: 13px; font-weight: 500;
  opacity: 0; transform: translateY(12px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.toast.show {
  opacity: 1; transform: translateY(0);
  pointer-events: auto;
}
