/* Tekening -> SVG — werkplaats-UI */
:root {
  --bg: #14161a;
  --bg2: #1b1e24;
  --card: #21252c;
  --lijn: #333944;
  --tekst: #e7eaf0;
  --zacht: #97a0b0;
  --accent: #ff8a3d;
  --accent2: #35d0c0;
  --waarschuw: #ffcc55;
  --fout: #ff6b6b;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--tekst);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* ── kop ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; background: var(--bg2);
  border-bottom: 1px solid var(--lijn); flex: none;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 34px; height: 34px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--accent), #ff5c7a);
  border-radius: 9px; color: #1a1200; font-size: 19px; font-weight: 700;
}
.topbar h1 { font-size: 15px; margin: 0; letter-spacing: .2px; }
.sub { margin: 0; font-size: 11.5px; color: var(--zacht); }
.topActions { display: flex; align-items: center; gap: 10px; }
.pill {
  font: 11px/1 var(--mono); color: var(--accent2);
  border: 1px solid #2c4a48; background: #16302e;
  padding: 5px 9px; border-radius: 999px;
}

/* ── indeling ── */
.layout { flex: 1; display: grid; grid-template-columns: 336px 1fr; min-height: 0; }
.panel {
  overflow-y: auto; padding: 14px; background: var(--bg2);
  border-right: 1px solid var(--lijn); display: flex; flex-direction: column; gap: 12px;
}
.panel::-webkit-scrollbar, .stage::-webkit-scrollbar { width: 10px; }
.panel::-webkit-scrollbar-thumb { background: #2f353f; border-radius: 6px; }

.card { background: var(--card); border: 1px solid var(--lijn); border-radius: var(--radius); padding: 12px; }
.card h2 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--zacht); margin: 0 0 10px;
}

/* ── formulier ── */
.field { display: block; margin-bottom: 9px; }
.field > span { display: block; font-size: 11.5px; color: var(--zacht); margin-bottom: 4px; }
.field b { color: var(--tekst); font-family: var(--mono); font-weight: 500; }
input[type=text], input[type=number], select {
  width: 100%; background: #171a1f; color: var(--tekst);
  border: 1px solid var(--lijn); border-radius: 7px; padding: 7px 8px; font-size: 13px;
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--zacht) 50%), linear-gradient(135deg, var(--zacht) 50%, transparent 50%);
  background-position: calc(100% - 14px) 14px, calc(100% - 9px) 14px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 26px; }
input:focus, select:focus { outline: none; border-color: var(--accent); }

input[type=range] { width: 100%; appearance: none; height: 20px; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; background: #333944; border-radius: 3px; }
input[type=range]::-webkit-slider-thumb {
  appearance: none; width: 14px; height: 14px; margin-top: -5px;
  background: var(--accent); border-radius: 50%; border: 2px solid #1b1e24; cursor: pointer;
}
.slider.uit { opacity: .35; pointer-events: none; }

.check { display: flex; align-items: flex-start; gap: 7px; font-size: 12.5px; margin-bottom: 8px; cursor: pointer; }
.check input { margin: 2px 0 0; accent-color: var(--accent); }
.check em { color: var(--zacht); font-style: normal; }
.check.inline { margin: 0; align-items: center; font-size: 12px; }

.row { display: flex; gap: 8px; align-items: center; margin-bottom: 9px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

button {
  font: inherit; cursor: pointer; border-radius: 7px; padding: 8px 12px;
  border: 1px solid var(--lijn); background: #272c34; color: var(--tekst); transition: .12s;
}
button:hover { border-color: #4a525f; background: #2e343d; }
button.primair { background: var(--accent); border-color: var(--accent); color: #241200; font-weight: 600; }
button.primair:hover { filter: brightness(1.08); }
button.ghost { background: transparent; }
button.small { padding: 5px 9px; font-size: 12px; }
button:disabled { opacity: .4; cursor: not-allowed; }
.beta { font-style: normal; font-size: 9.5px; color: var(--waarschuw); border: 1px solid #5b4a1f; padding: 1px 4px; border-radius: 4px; margin-left: 4px; }

/* ── dropzone ── */
.dropzone {
  border: 1.5px dashed #414957; border-radius: var(--radius);
  padding: 18px 12px; text-align: center; cursor: pointer; transition: .15s; margin-bottom: 10px;
}
.dropzone p { margin: 2px 0; font-size: 13px; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: #2a211a; }
.hint { color: var(--zacht); font-size: 11.5px; margin: 4px 0 0; }

/* ── segmented ── */
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: #171a1f; padding: 3px; border-radius: 8px; margin-bottom: 8px; }
.segmented button { border: none; background: transparent; padding: 6px 4px; font-size: 12.5px; color: var(--zacht); }
.segmented button.actief { background: var(--accent); color: #241200; font-weight: 600; }

/* ── lagen ── */
.laagRij { display: grid; grid-template-columns: 58px 1fr 1fr; gap: 6px; align-items: center; margin-bottom: 8px; }
.laagNaam { font-size: 12px; color: var(--zacht); }
.kleurKeuze, .matKeuze { font-size: 12px; padding: 6px; }
.matInfo { font-size: 11.5px; color: var(--zacht); border-top: 1px solid var(--lijn); padding-top: 8px; margin-top: 2px; }
.matInfo table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 11px; }
.matInfo td { padding: 2px 0; }
.matInfo td:last-child { text-align: right; color: var(--tekst); }
.matInfo .let { color: var(--waarschuw); display: block; margin-top: 6px; font-family: inherit; font-size: 11px; }

.exportKnoppen { display: grid; gap: 7px; }
.waarschuwing { color: var(--waarschuw); font-size: 12px; margin: 6px 0 0; }
.waarschuwing.fout { color: var(--fout); }

/* ── podium ── */
.stageWrap { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.stageBar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; border-bottom: 1px solid var(--lijn); background: var(--bg2); flex: none;
}
.tabs { display: flex; gap: 3px; }
.tabs button { background: transparent; border: none; color: var(--zacht); padding: 5px 11px; font-size: 12.5px; border-radius: 6px; }
.tabs button.actief { background: #2e343d; color: var(--tekst); }
.status { font-size: 12px; color: var(--zacht); font-family: var(--mono); }
.status.bezig { color: var(--accent); }

.stage {
  flex: 1; min-height: 0; position: relative; overflow: auto;
  display: grid; place-items: center; padding: 22px;
  background:
    linear-gradient(45deg, #1a1d22 25%, transparent 25%) 0 0/22px 22px,
    linear-gradient(-45deg, #1a1d22 25%, transparent 25%) 0 11px/22px 22px,
    linear-gradient(45deg, transparent 75%, #1a1d22 75%) 11px -11px/22px 22px,
    linear-gradient(-45deg, transparent 75%, #1a1d22 75%) -11px 0/22px 22px,
    var(--bg);
}
.stage > canvas, .stage > svg {
  grid-area: 1 / 1; max-width: 100%; max-height: 100%;
  object-fit: contain; display: none;
}
.stage > canvas { image-rendering: auto; background: #fff; border-radius: 4px; }
#vectorLaag { background: #fdfdfb; border-radius: 4px; }
#bedLaag { background: #14161a; }
.stage.toon-origineel #raster, .stage.toon-binair #raster { display: block; }
.stage.toon-vector #vectorLaag { display: block; }
.stage.toon-bed #bedLaag { display: block; }
.leeg { grid-area: 1 / 1; text-align: center; color: var(--zacht); }
.leeg p { margin: 3px 0; }
.stage.geladen .leeg { display: none; }

.statsBar {
  flex: none; display: flex; gap: 20px; flex-wrap: wrap;
  padding: 9px 14px; border-top: 1px solid var(--lijn);
  background: var(--bg2); font-family: var(--mono); font-size: 11.5px; color: var(--zacht);
}
.statsBar b { color: var(--tekst); font-weight: 600; }
.statsBar .let { color: var(--waarschuw); }

/* ── modal ── */
.modal { position: fixed; inset: 0; background: #000b; display: grid; place-items: center; z-index: 20; padding: 20px; }
.modal[hidden] { display: none; }  /* zonder deze regel wint de klasse van het hidden-attribuut */
.modalBox {
  background: var(--card); border: 1px solid var(--lijn); border-radius: 14px;
  padding: 22px; max-width: 660px; width: 100%; max-height: 84vh; overflow: auto; position: relative;
}
.modalBox h2 { margin-top: 0; font-size: 17px; }
.modalBox h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); margin: 18px 0 6px; }
.modalBox table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.modalBox td { padding: 4px 6px; border-bottom: 1px solid #2b313a; }
.modalBox td:first-child { color: var(--zacht); width: 42%; }
.modalBox code { font-family: var(--mono); background: #171a1f; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.modalBox ol, .modalBox ul { padding-left: 20px; font-size: 13px; }
.modalBox li { margin-bottom: 5px; }
.sluit { position: absolute; top: 12px; right: 12px; border: none; background: transparent; font-size: 22px; color: var(--zacht); padding: 0 6px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; overflow: auto; }
  body { overflow: auto; }
  .panel { border-right: none; border-bottom: 1px solid var(--lijn); }
  .stage { min-height: 55vh; }
}
