/* SignCast dashboard — thema-stelsel (CSS-variabelen)
 * Standaardthema = "dark" (de oorspronkelijke look). Wissel via
 * <html data-theme="..."> en <html data-density="...">. Accentkleur wordt
 * inline op :root gezet vanuit de gebruikersvoorkeur (localStorage).
 */
:root {
  --bg: #0f1420;
  --panel: #171e2e;
  --panel-2: #1d2740;
  --inset: #0b0f1a;
  --border: #2a3552;
  --text: #e8ecf5;
  --muted: #93a0b8;
  --accent: #2563eb;
  --ok: #22c55e;
  --danger: #ef4444;
  --link: #7aa5ff;
  --on-accent: #ffffff;
  --danger-text: #ff8f8f;
  --flash-ok-bg: rgba(34, 197, 94, .12);
  --flash-ok-text: #9ff0bd;
  --flash-err-bg: rgba(239, 68, 68, .12);
  --flash-err-text: #ffb4b4;
  --radius: 10px;
  --shadow: 0 8px 28px rgba(0, 0, 0, .35);
}
/* Licht thema */
:root[data-theme="light"] {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --panel-2: #eef1f7;
  --inset: #eef1f7;
  --border: #d8deea;
  --text: #14181f;
  --muted: #5b6678;
  --link: #1d4ed8;
  --danger-text: #dc2626;
  --flash-ok-bg: rgba(22, 163, 74, .12);
  --flash-ok-text: #14532d;
  --flash-err-bg: rgba(220, 38, 38, .10);
  --flash-err-text: #7f1d1d;
  --shadow: 0 8px 28px rgba(20, 30, 60, .14);
}
/* Midnight — dieper donker met indigo-accent (een ander "concept") */
:root[data-theme="midnight"] {
  --bg: #0a0a14;
  --panel: #131320;
  --panel-2: #1b1b2e;
  --inset: #07070f;
  --border: #2c2c44;
  --text: #eef0ff;
  --muted: #9aa0c4;
  --accent: #7c5cff;
  --link: #a78bff;
  --danger-text: #ff9aa6;
  --shadow: 0 8px 30px rgba(0, 0, 0, .55);
}
/* Auto — volgt de systeemvoorkeur (prefers-color-scheme) */
:root[data-theme="auto"] {
  --bg: #f4f6fb; --panel: #ffffff; --panel-2: #eef1f7; --inset: #eef1f7;
  --border: #d8deea; --text: #14181f; --muted: #5b6678; --link: #1d4ed8;
  --danger-text: #dc2626;
  --flash-ok-bg: rgba(22, 163, 74, .12); --flash-ok-text: #14532d;
  --flash-err-bg: rgba(220, 38, 38, .10); --flash-err-text: #7f1d1d;
  --shadow: 0 8px 28px rgba(20, 30, 60, .14);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0f1420; --panel: #171e2e; --panel-2: #1d2740; --inset: #0b0f1a;
    --border: #2a3552; --text: #e8ecf5; --muted: #93a0b8; --link: #7aa5ff;
    --danger-text: #ff8f8f;
    --flash-ok-bg: rgba(34, 197, 94, .12); --flash-ok-text: #9ff0bd;
    --flash-err-bg: rgba(239, 68, 68, .12); --flash-err-text: #ffb4b4;
    --shadow: 0 8px 28px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
body.app, body.login-page, body.error-page {
  margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px;
  transition: background .25s, color .25s;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--inset); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-size: 13px; }

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; flex-shrink: 0; background: var(--panel);
  border-right: 1px solid var(--border); padding: 18px 14px;
  display: flex; flex-direction: column; gap: 14px;
  transition: transform .2s ease, background .25s;
}
.brand { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.brand-lg { font-size: 24px; justify-content: center; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); display: inline-block; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a { padding: 9px 12px; border-radius: 8px; color: var(--text); }
.nav a:hover { background: var(--panel-2); text-decoration: none; }
.nav a.active { background: var(--accent); color: var(--on-accent); }
.sidebar-footer { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.userbox { display: flex; flex-direction: column; }
.userbox small { color: var(--muted); }

.main { flex: 1; padding: 26px 30px; max-width: 1200px; }
h1 { margin: 0 0 6px; font-size: 26px; }
h2 { margin: 0 0 12px; font-size: 17px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; margin: 0 0 18px;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

.stats { display: flex; gap: 14px; margin: 0 0 18px; flex-wrap: wrap; }
.stat {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 20px; display: flex; flex-direction: column; min-width: 130px;
}
.stat strong { font-size: 22px; }
.stat span { color: var(--muted); font-size: 13px; }

label { display: block; margin: 0 0 12px; font-size: 13.5px; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 5px;
  background: var(--inset); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 9px 11px; font: inherit;
}
input[type="color"] { height: 42px; padding: 4px; background: var(--inset); }
input[type="checkbox"] { width: auto; display: inline-block; margin: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
input.w-sm { width: 140px; display: inline-block; }
input.w-xs { width: 70px; display: inline-block; }
.url-box { font-family: ui-monospace, monospace; }

.row-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row-form input, .row-form select { width: auto; flex: 1; min-width: 160px; }
.inline { display: inline-flex; gap: 6px; align-items: center; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 14px; cursor: pointer; font: inherit; font-size: 14px;
  transition: border-color .15s, background .15s, transform .05s;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger-text); }
.btn-danger:hover { background: rgba(239, 68, 68, .12); border-color: var(--danger); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
.table th, .table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pill { border-radius: 999px; padding: 2px 10px; font-size: 12px; border: 1px solid var(--border); color: var(--muted); }
.pill-ok { border-color: var(--ok); color: var(--ok); }

.flash { border-radius: 8px; padding: 11px 14px; margin: 0 0 16px; font-size: 14px; }
.flash-success { background: var(--flash-ok-bg); border: 1px solid var(--ok); color: var(--flash-ok-text); }
.flash-error { background: var(--flash-err-bg); border: 1px solid var(--danger); color: var(--flash-err-text); }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  width: 380px; max-width: 92vw; background: var(--panel);
  border: 1px solid var(--border); border-radius: 14px; padding: 30px;
}
.login-help { text-align: center; margin: 14px 0 0; font-size: 13.5px; }
.login-card-wide { width: 460px; }
.recover-title { font-size: 20px; margin: 14px 0 10px; text-align: center; }
.seed-box { margin-top: 18px; border: 1px dashed var(--ok); border-radius: 10px; padding: 14px; }
.seed-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; align-items: center; }
.seed-row span { color: var(--muted); font-size: 13px; }

.error-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.error-card { text-align: center; padding: 40px; }
.error-card h1 { font-size: 64px; margin: 0; color: var(--accent); }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.media-card { background: var(--inset); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.media-card img, .media-card video { width: 100%; height: 130px; object-fit: cover; display: block; background: #000; }
.media-info { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.media-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 6px; }

.cat-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cat-head h2 { margin: 0; flex: 1; }
.edit-item { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--inset); border-radius: 8px; margin-top: 8px; }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.plainlist { margin: 0; padding-left: 18px; }
.docs { padding-left: 20px; line-height: 1.9; margin: 0; }
.logo-thumb { height: 44px; max-width: 160px; object-fit: contain; background: #fff; border-radius: 8px; padding: 4px; }
.logo-preview { max-height: 90px; max-width: 220px; background: #fff; padding: 6px; border-radius: 8px; }
.danger-zone { border-color: rgba(239, 68, 68, .5); }

/* Lege staten */
.empty-state {
  background: var(--panel); border: 1px dashed var(--border); border-radius: 14px;
  padding: 48px 24px; text-align: center; margin: 0 0 18px;
}
.empty-icon { font-size: 44px; margin-bottom: 8px; }
.empty-state h2 { margin: 0 0 6px; }
.empty-state p { color: var(--muted); max-width: 52ch; margin: 0 auto 16px; line-height: 1.6; }
.empty-actions { justify-content: center; }

/* Starttraject */
.stepper .steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.step {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--inset); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; color: var(--text); text-decoration: none;
}
.step:hover { border-color: var(--accent); text-decoration: none; }
.step-check {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--border); display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--ok);
}
.step-done { opacity: .62; }
.step-done .step-check { background: rgba(34, 197, 94, .15); border-color: var(--ok); }
.step-body { display: flex; flex-direction: column; gap: 2px; }
.step-body small { color: var(--muted); line-height: 1.4; }

/* Locatie-context in sidebar */
.ctx-switch { margin-bottom: 4px; }
.ctx-btn { width: 100%; justify-content: flex-start; font-weight: 600; }
.ctx-label {
  display: block; padding: 8px 12px; font-weight: 600; font-size: 13.5px;
  color: var(--muted); background: var(--panel-2); border-radius: 8px;
}
.ctx-hint {
  display: block; padding: 8px 12px; border-radius: 8px; font-size: 13.5px;
  border: 1px dashed var(--accent); color: var(--link);
}
.nav-disabled { opacity: .38; pointer-events: none; }

/* URL-cellen met kopieerknop */
.url-cell { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* Upload-zone (drag-and-drop op het dashboard) */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 14px;
  background: var(--inset);
  padding: 18px;
  text-align: center;
  cursor: default;
}
.upload-zone h2 { margin: 0 0 6px; }
.upload-zone .muted.small { display: block; margin: 0 auto 14px; max-width: 48ch; }
#dash-upload {
  display: inline-flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 auto;
}
#dash-upload input[type="file"] { margin: 0; }
#dash-input { cursor: pointer; }
.zone-hover { border-color: var(--accent); background: rgba(37, 99, 235, .08); }

.url-text {
  max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: inline-block; vertical-align: middle;
}
.loc-card { margin: 0; }
.loc-card .actions { margin-top: 8px; }

/* Achtergrondinstellingen (dashboard → Instellingen) */
.bg-preview {
  position: relative; margin: 12px 0 16px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border); aspect-ratio: 16 / 9; max-width: 520px;
  background: var(--inset);
}
.bg-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bg-preview-dim {
  position: absolute; inset: 0; background: #000; pointer-events: none;
  transition: opacity .1s linear;
}
.bg-preview-tag {
  position: absolute; left: 10px; bottom: 10px; padding: 3px 9px; border-radius: 999px;
  background: rgba(0, 0, 0, .6); color: #fff; font-size: 11px; letter-spacing: .02em;
}
.bg-options { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; margin-bottom: 14px; }
.bg-options label { flex: 1 1 220px; }
.bg-options input[type="range"] { width: 100%; padding: 0; height: 26px; }
.bg-options button { align-self: center; }

/* Achtergrond per slide (afspeellijst-editor) */
.slide-bg { min-width: 190px; }
.slide-bg-thumb {
  display: block; width: 76px; height: 43px; object-fit: cover;
  border-radius: 6px; border: 1px solid var(--border); background: var(--inset);
}
.slide-bg-thumb-empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--muted); border-style: dashed;
}
.slide-bg-state { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
.slide-bg-mini { margin-top: 6px; }
.slide-bg-mini > summary {
  cursor: pointer; list-style: none;
  font-size: 12px; padding: 6px 10px; white-space: nowrap;
}
.slide-bg-mini > summary::-webkit-details-marker { display: none; }
.slide-bg-mini[open] > summary { margin-bottom: 2px; }
.slide-bg-mini > form, .slide-bg-mini > p { margin: 8px 0 0; }
.slide-bg-mini input[type="file"] { width: 100%; font-size: 12px; margin-bottom: 6px; }
.slide-bg-mini .btn { font-size: 12px; padding: 6px 10px; }
.bg-options-mini {
  flex-direction: column; gap: 8px; align-items: stretch;
  margin: 10px 0 8px; padding-top: 10px; border-top: 1px solid var(--border);
}
.bg-options-mini label { flex: 1 1 auto; font-size: 12px; }
.bg-options-mini input[type="range"] { width: 100%; padding: 0; height: 22px; }
.bg-options-mini button { align-self: flex-start; }

/* ----------------------------------------------------------------
 * Weergave-switcher (thema / accent / dichtheid)
 * ---------------------------------------------------------------- */
.appearance { position: relative; }
.appearance-pop {
  position: absolute; bottom: calc(100% + 8px); left: 0; right: 0;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; box-shadow: var(--shadow); z-index: 70;
  display: flex; flex-direction: column; gap: 12px;
}
.appearance-pop[hidden] { display: none; }
.app-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.app-row > span { font-size: 13px; color: var(--muted); }
.theme-swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.swatch {
  border: 2px solid var(--border); border-radius: 10px; padding: 10px 0; cursor: pointer;
  background: var(--inset); font-size: 18px; display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, transform .05s;
}
.swatch:hover { transform: translateY(-1px); }
.swatch[aria-pressed="true"] { border-color: var(--accent); }
.swatch-dark { background: #0f1420; }
.swatch-light { background: #f4f6fb; }
.swatch-midnight { background: #131320; }
.swatch-auto { background: linear-gradient(135deg, #0f1420 50%, #f4f6fb 50%); }
.chip {
  border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; cursor: pointer;
  background: var(--inset); color: var(--text); font: inherit; font-size: 13px;
}
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: transparent; }
#accent-picker { width: 46px; padding: 2px; margin: 0; }

/* ----------------------------------------------------------------
 * Mobiele navigatie (hamburger + off-canvas)
 * ---------------------------------------------------------------- */
.nav-toggle {
  display: none; position: fixed; top: 12px; left: 12px; z-index: 60;
  width: 42px; height: 42px; align-items: center; justify-content: center;
  font-size: 20px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--border); color: var(--text); cursor: pointer;
}
.nav-backdrop {
  display: none; position: fixed; inset: 0; z-index: 40;
  background: rgba(0, 0, 0, .5);
}
@media (prefers-color-scheme: light) { .nav-backdrop { background: rgba(10, 15, 30, .4); } }
@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .nav-backdrop { display: none; }
  body.nav-open .nav-backdrop { display: block; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
    width: 264px; transform: translateX(-100%); overflow-y: auto;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .main { max-width: 100%; padding: 64px 16px 24px; }
}

/* ----------------------------------------------------------------
 * Bevestigingsmodal
 * ---------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .55); padding: 16px; animation: fadein .15s ease;
}
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 22px; max-width: 420px; width: 100%; box-shadow: var(--shadow);
}
.modal-title { font-size: 17px; font-weight: 700; margin: 0 0 8px; }
.modal-msg { color: var(--muted); line-height: 1.6; margin: 0 0 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ----------------------------------------------------------------
 * Tooltips (data-tooltip)
 * ---------------------------------------------------------------- */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: #11131c; color: #fff; font-size: 12px; line-height: 1.3;
  padding: 5px 9px; border-radius: 7px; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .15s; z-index: 90;
}
[data-tooltip]:hover::after, [data-tooltip]:focus-visible::after { opacity: 1; }

/* ----------------------------------------------------------------
 * Dichtheid: compact
 * ---------------------------------------------------------------- */
:root[data-density="compact"] .main { padding: 16px 20px; }
:root[data-density="compact"] .card { padding: 12px 14px; margin-bottom: 12px; }
:root[data-density="compact"] h1 { font-size: 22px; }
:root[data-density="compact"] h2 { font-size: 15px; margin-bottom: 8px; }
:root[data-density="compact"] label { margin-bottom: 8px; font-size: 12.5px; }
:root[data-density="compact"] .btn { padding: 6px 11px; font-size: 13px; }
:root[data-density="compact"] .stat { padding: 10px 14px; }
:root[data-density="compact"] .stat strong { font-size: 19px; }
:root[data-density="compact"] .table th, :root[data-density="compact"] .table td { padding: 6px 8px; }

@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* Toegankelijkheid: zichtbare focus-ring voor toetsenbord */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
