/* ZO Dashboard - styling
   Geïnspireerd op zoschoon.nl: naturel & antraciet */

:root {
  /* === KLEUREN ===
     ZO-merk: antraciet als signatuurkleur, naturel als achtergrond,
     sage als subtiele eco-accent */
  --bg: #f7f4ec;              /* naturel cream */
  --bg-elevated: #fbf8f0;     /* iets lichter cream */
  --bg-card: #ffffff;
  --ink: #1c1c1a;             /* bijna zwart, warm */
  --ink-soft: #44443f;
  --ink-muted: #8a8a82;
  --line: #e8e2d2;
  --line-soft: #f0eadb;
  --primary: #1a1a18;         /* antraciet (ZO signatuurkleur) */
  --primary-soft: #3a3a36;
  --primary-tint: #ebe7d9;
  --accent: #5b7a5b;          /* sage green - subtiel, eco */
  --accent-soft: #7a9479;
  --accent-tint: #e8ede4;
  --warning: #b88a3d;
  --danger: #a04444;

  /* Segmenten — gedempte, harmonieuze palette */
  --g1: #6b8a6b;              /* sage - stabiele klant */
  --g2: #5d8794;              /* gedempte blauw */
  --g3: #2d4f3e;              /* diep groen - groei */
  --g4: #a85936;              /* warme klei - loyale klant */
  --g5: #9a7e4d;              /* warme zand */
  --g6: #75706a;              /* warme grijs */

  /* === TYPOGRAFIE === */
  --font-display: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;

  /* === LAYOUT === */
  --radius: 6px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(28, 28, 26, 0.04);
  --shadow: 0 1px 3px rgba(28, 28, 26, 0.06), 0 1px 2px rgba(28, 28, 26, 0.04);
  --shadow-lg: 0 8px 24px rgba(28, 28, 26, 0.08);
}

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

html, body {
  height: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

h1 { font-size: 32px; line-height: 1.1; font-weight: 700; }
h2 { font-size: 22px; line-height: 1.25; }
h3 { font-size: 17px; line-height: 1.35; }

/* Tabular nums voor uitgelijnde getallen in tabellen en metrics */
.mono, td.mono, .stat-meta, .stat-value, .segment-pct, .segment-count, .segment-revenue {
  font-variant-numeric: tabular-nums;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

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

/* === LOGO === */

.logo-svg {
  display: block;
  width: 56px;
  height: auto;
  color: currentColor;
}

.logo-svg svg {
  width: 100%;
  height: auto;
  display: block;
}

/* === LAYOUT === */

.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--primary);
  color: var(--bg);
  padding: 28px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  color: var(--bg);
  padding: 4px 12px 8px;
}

.brand .logo-svg {
  width: 64px;
  margin-bottom: 8px;
}

.brand-tagline {
  font-family: var(--font-display);
  font-size: 12px;
  color: rgba(247, 244, 236, 0.65);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: rgba(247, 244, 236, 0.75);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  text-align: left;
  width: 100%;
}

.nav-item:hover {
  background: rgba(247, 244, 236, 0.06);
  color: var(--bg);
}

.nav-item.active {
  background: rgba(247, 244, 236, 0.1);
  color: var(--bg);
}

.nav-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(247, 244, 236, 0.4);
  margin: 14px 12px 4px;
  font-weight: 500;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(247, 244, 236, 0.1);
  font-size: 11px;
  color: rgba(247, 244, 236, 0.5);
  font-family: var(--font-mono);
}

.sidebar-footer .status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-soft);
  box-shadow: 0 0 6px var(--accent-soft);
}

.status-dot.warn { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.status-dot.error { background: var(--danger); box-shadow: 0 0 6px var(--danger); }

.main {
  padding: 36px 44px 60px;
  max-width: 1400px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 16px;
}

.page-header-text .eyebrow {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  font-weight: 600;
}

.page-header-text h1 {
  font-weight: 700;
}

.page-header-text .lede {
  color: var(--ink-soft);
  margin-top: 6px;
  max-width: 600px;
}

/* === KAARTEN & GRIDS === */

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.card-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  margin-bottom: 8px;
  font-weight: 500;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
}

.stat-label {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 6px;
  color: var(--ink);
  line-height: 1.1;
}

.stat-meta {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 4px;
  font-family: var(--font-mono);
}

/* === SEGMENT GRID === */

.section-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.segment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.segment-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  overflow: hidden;
}

.segment-card:hover {
  border-color: var(--ink-soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.segment-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--seg-color);
}

.segment-card[data-segment="G1"] { --seg-color: var(--g1); }
.segment-card[data-segment="G2"] { --seg-color: var(--g2); }
.segment-card[data-segment="G3"] { --seg-color: var(--g3); }
.segment-card[data-segment="G4"] { --seg-color: var(--g4); }
.segment-card[data-segment="G5"] { --seg-color: var(--g5); }
.segment-card[data-segment="G6"] { --seg-color: var(--g6); }

.segment-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 4px;
}

.segment-id {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--seg-color);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.segment-pct {
  font-size: 12px;
  color: var(--ink-muted);
  font-weight: 500;
}

.segment-name {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 16px;
  min-height: 36px;
  line-height: 1.5;
}

.segment-count {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.segment-revenue {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 6px;
}

.segment-bar {
  height: 4px;
  background: var(--line-soft);
  border-radius: 2px;
  margin-top: 16px;
  overflow: hidden;
}

.segment-bar-fill {
  height: 100%;
  background: var(--seg-color);
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* === TABEL === */

.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-family: var(--font-display);
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elevated);
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
}

tr:last-child td { border-bottom: none; }

tbody tr:hover { background: var(--bg-elevated); }

td.mono { font-family: var(--font-mono); font-size: 13px; }
td.right { text-align: right; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  background: var(--primary-tint);
  color: var(--primary);
}

.badge[data-segment="G1"] { background: #e6ede5; color: var(--g1); }
.badge[data-segment="G2"] { background: #e2eaee; color: var(--g2); }
.badge[data-segment="G3"] { background: #e0eae3; color: var(--g3); }
.badge[data-segment="G4"] { background: #f1e5dd; color: var(--g4); }
.badge[data-segment="G5"] { background: #efe6d4; color: var(--g5); }
.badge[data-segment="G6"] { background: #e9e6e0; color: var(--g6); }

/* === KNOPPEN === */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  background: var(--primary);
  color: var(--bg);
  transition: opacity 0.15s ease, transform 0.05s ease;
  border: 1px solid transparent;
}

.btn:hover { opacity: 0.88; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: var(--bg); }
.btn-accent { background: var(--accent); color: white; }
.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-secondary:hover { background: var(--bg-elevated); opacity: 1; }

.btn-sm { padding: 6px 12px; font-size: 12px; }

/* === FORMULIEREN === */

.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-help {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 6px;
  line-height: 1.5;
}

.form-input,
.form-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-card);
  font-size: 14px;
  transition: border-color 0.15s ease;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
}

.form-input:disabled,
.form-select:disabled {
  background: var(--bg-elevated);
  color: var(--ink-muted);
  cursor: not-allowed;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* === LOGIN === */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 20% 20%, rgba(91, 122, 91, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(168, 89, 54, 0.04) 0%, transparent 50%);
  padding: 40px 20px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-card .logo-svg {
  width: 72px;
  color: var(--primary);
  margin-bottom: 24px;
}

.login-card h1 {
  font-weight: 700;
  font-size: 28px;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.login-card .lede {
  color: var(--ink-muted);
  margin-bottom: 28px;
  font-size: 14px;
}

/* === ALERT === */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-success {
  background: var(--accent-tint);
  color: var(--accent);
  border-color: var(--accent-soft);
}

.alert-error {
  background: #f5e3e3;
  color: var(--danger);
  border-color: var(--danger);
}

.alert-warning {
  background: #f8eed7;
  color: #876422;
  border-color: var(--warning);
}

.alert-info {
  background: #e7eef0;
  color: #345868;
  border-color: #88a8b8;
}

/* === EMPTY STATE === */

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-muted);
}

.empty h3 {
  color: var(--ink);
  margin-bottom: 8px;
  font-size: 20px;
  font-weight: 700;
}

.empty p {
  max-width: 460px;
  margin: 0 auto 20px;
  line-height: 1.6;
}

/* === PRODUCT LIJST === */

.product-row {
  display: grid;
  grid-template-columns: 1fr 240px 140px 100px;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.product-row:hover {
  background: var(--bg-elevated);
}

.product-name { font-weight: 500; }
.product-sku { font-family: var(--font-mono); font-size: 12px; color: var(--ink-muted); margin-top: 2px; }

/* === LOADER === */

.loader {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === MOBILE === */

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    height: auto;
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 16px 20px;
    gap: 16px;
    align-items: center;
  }
  .brand { padding: 0; }
  .brand .logo-svg { width: 48px; margin: 0; }
  .brand-tagline { display: none; }
  .nav { flex-direction: row; flex-wrap: wrap; flex: 1; justify-content: flex-end; }
  .nav-section-title { display: none; }
  .nav-item { padding: 6px 12px; }
  .sidebar-footer { width: 100%; border-top: 1px solid rgba(247, 244, 236, 0.1); padding-top: 12px; }
  .main { padding: 24px 20px; }
  .form-row { grid-template-columns: 1fr; }
  .product-row { grid-template-columns: 1fr; gap: 8px; }
  h1 { font-size: 28px; }
}
