@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@700;800&family=DM+Sans:wght@400;600&display=swap');

/* ============================================================
   CSS Custom Properties – Light mode
   ============================================================ */
:root {
  --bg-primary:     #F2F1EE;
  --bg-surface:     #FFFFFF;
  --bg-elevated:    #FFFFFF;
  --accent:         #1B4F8A;
  --accent-light:   #EBF2FB;
  --status-ok:      #1A7F4B;
  --status-warning: #C97A10;
  --status-error:   #C0392B;
  --text-primary:   #111318;
  --text-secondary: #6B7585;
  --text-muted:     #9BA3AF;
  --border:         #E2E4E8;
  --shadow:         rgba(0, 0, 0, 0.07);
}

/* ============================================================
   CSS Custom Properties – Dark mode
   ============================================================ */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary:     #0D1117;
    --bg-surface:     #161B27;
    --bg-elevated:    #1E2536;
    --accent:         #4A90D9;
    --accent-light:   #1A2D45;
    --status-ok:      #27AE60;
    --status-warning: #E59C20;
    --status-error:   #E74C3C;
    --text-primary:   #EDF0F7;
    --text-secondary: #8B96AB;
    --text-muted:     #5A6478;
    --border:         #252E42;
    --shadow:         rgba(0, 0, 0, 0.35);
  }
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  min-height: 100vh;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent);
}

/* ============================================================
   Typography helpers
   ============================================================ */
.display-heading {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 36px;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.section-heading {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 19px;
  color: var(--text-primary);
}

/* ============================================================
   Navbar
   ============================================================ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 900;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.navbar-left,
.navbar-right {
  display: flex;
  align-items: center;
}

.navbar-left button,
.navbar-right button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 20px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.navbar-left button:hover,
.navbar-right button:hover {
  background: var(--bg-elevated);
}

.navbar-brand {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.01em;
  color: var(--text-primary);
  text-align: center;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* ============================================================
   Drawer (side menu)
   ============================================================ */
.drawer {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100%;
  background: var(--bg-surface);
  z-index: 1000;
  transition: left 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.drawer.open {
  left: 0;
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
}

.drawer-overlay.open {
  display: block;
}

.drawer-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-header-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 20px;
  color: var(--text-primary);
}

.drawer-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 18px;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drawer-nav {
  flex: 1;
  padding: 8px 0;
}

.drawer-nav a {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  color: var(--text-primary);
  text-decoration: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 400;
  transition: background 0.15s;
}

.drawer-nav a:hover {
  background: var(--bg-elevated);
}

.drawer-nav a .fa,
.drawer-nav a .fas,
.drawer-nav a .far,
.drawer-nav a .fab {
  width: 20px;
  margin-right: 12px;
  color: var(--accent);
  font-size: 15px;
  text-align: center;
}

.drawer-nav .nav-active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.drawer-nav .nav-active .fa,
.drawer-nav .nav-active .fas {
  color: var(--accent);
}

/* ============================================================
   Page layout
   ============================================================ */
.page-wrapper {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

.page-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 20px;
}

/* ============================================================
   Card
   ============================================================ */
.card {
  background: var(--bg-elevated);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 2px 12px var(--shadow);
  margin-bottom: 16px;
}

@media (prefers-color-scheme: dark) {
  .card {
    box-shadow: 0 4px 20px var(--shadow);
  }
}

.card-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  margin: 0 0 16px 0;
}

/* ============================================================
   Status banner (dashboard hero)
   ============================================================ */
.status-banner {
  padding: 24px;
  border-radius: 18px;
  background: var(--accent-light);
  margin-bottom: 28px;
}

.status-banner-greeting {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 32px;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.status-banner-sub {
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.status-counts {
  display: flex;
  gap: 24px;
  margin-top: 16px;
}

.status-count-item {
  text-align: center;
}

.status-count-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 36px;
  line-height: 1;
  color: var(--text-primary);
  display: block;
}

.status-count-label {
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  display: block;
}

/* ============================================================
   Product card
   ============================================================ */
.product-card {
  border-radius: 18px;
  background: var(--bg-elevated);
  padding: 16px;
  box-shadow: 0 2px 12px var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s;
  margin-bottom: 12px;
}

@media (prefers-color-scheme: dark) {
  .product-card {
    box-shadow: 0 4px 20px var(--shadow);
  }
}

.product-card:hover {
  box-shadow: 0 4px 18px var(--shadow);
}

.product-card-img {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--accent-light);
  flex-shrink: 0;
}

.product-card-img-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 28px;
  flex-shrink: 0;
}

.product-card-body {
  flex: 1;
  min-width: 0;
}

.product-card-naam {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-card-categorie {
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.product-card-badges {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* Grid layout for wider screens */
@media (min-width: 600px) {
  .product-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
  }

  .product-cards-grid .product-card {
    margin-bottom: 0;
  }
}

/* ============================================================
   Badges
   ============================================================ */
.badge {
  border-radius: 10px;
  padding: 3px 8px;
  font-size: 11px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-ok {
  background: #E8F8F0;
  color: var(--status-ok);
}

.badge-warning {
  background: #FEF4E6;
  color: var(--status-warning);
}

.badge-error {
  background: #FDECEA;
  color: var(--status-error);
}

@media (prefers-color-scheme: dark) {
  .badge-ok {
    background: #0D2B1A;
    color: var(--status-ok);
  }

  .badge-warning {
    background: #2D1F07;
    color: var(--status-warning);
  }

  .badge-error {
    background: #2D0D0A;
    color: var(--status-error);
  }
}

/* ============================================================
   Taak item
   ============================================================ */
.taak-item {
  display: flex;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.taak-item:last-child {
  border-bottom: none;
}

.taak-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 12px;
  flex-shrink: 0;
}

.taak-dot-ok {
  background: var(--status-ok);
}

.taak-dot-warning {
  background: var(--status-warning);
}

.taak-dot-error {
  background: var(--status-error);
}

.taak-body {
  flex: 1;
  min-width: 0;
}

.taak-naam {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.taak-interval {
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.taak-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 22px;
  border-radius: 50px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: filter 0.15s, transform 0.1s;
  text-decoration: none;
}

.btn-primary:hover {
  filter: brightness(0.92);
  transform: scale(0.98);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 9px 18px;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
  text-decoration: none;
}

.btn-secondary:hover {
  background: var(--bg-elevated);
}

.btn-danger {
  background: transparent;
  border: 1px solid var(--status-error);
  color: var(--status-error);
  padding: 9px 18px;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
  text-decoration: none;
}

.btn-danger:hover {
  background: #FDECEA;
}

@media (prefers-color-scheme: dark) {
  .btn-danger:hover {
    background: #2D0D0A;
  }
}

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

/* ============================================================
   Form elements
   ============================================================ */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  font-size: 14px;
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(27, 79, 138, 0.15);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239BA3AF' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============================================================
   Section header
   ============================================================ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
  margin: 0;
}

.section-link {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section-link:hover {
  text-decoration: underline;
}

/* ============================================================
   Historie item
   ============================================================ */
.historie-item {
  background: var(--bg-elevated);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 2px 12px var(--shadow);
  margin-bottom: 12px;
}

@media (prefers-color-scheme: dark) {
  .historie-item {
    box-shadow: 0 4px 20px var(--shadow);
  }
}

.historie-item-datum {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 6px;
}

.historie-item-body {
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  font-size: 14px;
  color: var(--text-primary);
}

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--bg-surface);
  border-radius: 18px 18px 0 0;
  padding: 24px;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 8px 32px var(--shadow);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

@media (min-width: 600px) {
  .modal-overlay {
    align-items: center;
  }

  .modal {
    border-radius: 18px;
    max-height: 90vh;
    overflow-y: auto;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 20px;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 20px;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.modal-close:hover {
  background: var(--bg-elevated);
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ============================================================
   Flash berichten
   ============================================================ */
.flash {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.4s ease;
}

.flash-success {
  background: #E8F8F0;
  color: var(--status-ok);
}

.flash-error {
  background: #FDECEA;
  color: var(--status-error);
}

@media (prefers-color-scheme: dark) {
  .flash-success {
    background: #0D2B1A;
    color: var(--status-ok);
  }

  .flash-error {
    background: #2D0D0A;
    color: var(--status-error);
  }
}

/* ============================================================
   Toggle switch
   ============================================================ */
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: 50px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle input[type="checkbox"]:checked + .toggle-track {
  background: var(--accent);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle input[type="checkbox"]:checked ~ .toggle-track .toggle-thumb {
  transform: translateX(20px);
}

.toggle-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  user-select: none;
}

/* ============================================================
   Prompt box (import)
   ============================================================ */
.prompt-box {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.prompt-box pre {
  font-family: monospace;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
}

.prompt-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.prompt-copy-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
}

/* ============================================================
   Kleur swatches
   ============================================================ */
.swatch-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color 0.15s, transform 0.1s;
}

.swatch:hover {
  transform: scale(1.1);
}

.swatch.selected {
  border-color: var(--accent);
}

/* ============================================================
   Inline km edit
   ============================================================ */
.km-display {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.15s;
}

.km-display:hover {
  background: var(--accent-light);
}

.km-inline-form {
  display: none;
  align-items: center;
  gap: 8px;
}

.km-inline-form.visible {
  display: flex;
}

.km-inline-input {
  width: 120px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
}

.km-inline-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(27, 79, 138, 0.15);
}

/* ============================================================
   Interval type fields
   ============================================================ */
.interval-datum-fields,
.interval-km-fields {
  display: none;
}

.interval-datum-fields.visible,
.interval-km-fields.visible {
  display: block;
}

/* ============================================================
   Validatie resultaten
   ============================================================ */
#validatie-fouten {
  display: none;
}

#validatie-fouten.visible {
  display: block;
}

#import-preview {
  display: none;
}

#import-preview.visible {
  display: block;
}

#import-bevestig {
  display: none;
}

#import-bevestig.visible {
  display: block;
}

.validatie-fout-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 0;
  font-size: 13px;
  color: var(--status-error);
  border-bottom: 1px solid var(--border);
}

.validatie-fout-item:last-child {
  border-bottom: none;
}

.import-preview-naam {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.import-preview-categorie {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.import-preview-taken {
  list-style: none;
  padding: 0;
}

.import-preview-taken li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}

.import-preview-taken li:last-child {
  border-bottom: none;
}

/* ============================================================
   Utilities
   ============================================================ */
.text-muted    { color: var(--text-muted); }
.text-ok       { color: var(--status-ok); }
.text-warning  { color: var(--status-warning); }
.text-error    { color: var(--status-error); }
.text-accent   { color: var(--accent); }
.text-secondary { color: var(--text-secondary); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.d-flex        { display: flex; }
.align-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8         { gap: 8px; }
.gap-12        { gap: 12px; }
.flex-1        { flex: 1; }
.w-100         { width: 100%; }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

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

.empty-state-icon {
  font-size: 40px;
  margin-bottom: 12px;
  color: var(--text-muted);
}

.empty-state-text {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text-muted);
}
