/*
 * Warm en speels: dit is een winkelier die op zijn telefoon een foto op zijn
 * scherm zet, geen beheerder achter een dashboard. Geen bestandsnamen, geen
 * megabytes, één grote knop.
 *
 * Kopie van app/src/main/assets/web/app.css (de lokale web-UI op de box); de
 * portaal-aanvullingen staan onderaan. De box moet zonder internet werken,
 * dus delen via een URL kan niet. Wijzig je de gedeelde stijl, doe het dan
 * op beide plekken.
 */

:root {
  --bg: #fff6ee;
  --card: #ffffff;
  --ink: #2a1b12;
  --muted: #8a7466;
  --line: #f0dccd;
  --soft: #fdeee3;
  --accent: #f26a3d;
  --accent-deep: #d9552b;
  --on-accent: #ffffff;
  --danger: #c8352b;
  --screen: #14100e;
  --shadow: 0 6px 20px rgba(90, 50, 20, .10);
  --tv-ink: #2a1b12;   /* omlijning van de tv; cream op donker, anders valt hij weg */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1512;
    --card: #2a211c;
    --ink: #f6ede6;
    --muted: #b19f92;
    --line: #3d302a;
    --soft: #3a2a22;
    --accent: #f6764a;
    --accent-deep: #d9552b;
    --shadow: 0 6px 20px rgba(0, 0, 0, .35);
    --tv-ink: #f4e3d0;
  }
}

* { box-sizing: border-box; }

/* Anders wint een display: grid/flex van het hidden-attribuut en staat de
   viewer over de pagina heen voordat er ooit op een foto getikt is. */
[hidden] { display: none !important; }

html { background: var(--bg); }

body {
  margin: 0;
  padding: 12px 16px 120px;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  max-width: 560px;
  margin-inline: auto;
  -webkit-tap-highlight-color: transparent;
}

h1 { font-size: 28px; margin: 0 0 2px; letter-spacing: -.01em; }
h2 { font-size: 22px; margin: 0 0 6px; }
.muted { color: var(--muted); font-size: 15px; margin: 0; }
.error { color: var(--danger); font-size: 15px; margin: 8px 0; }

.top { padding: 8px 0 4px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.brand svg { width: 22px; height: 22px; }

/* ---- koppelen --------------------------------------------------------- */

#pair {
  margin-top: 24px;
  padding: 24px 20px;
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
#pin {
  width: 100%;
  margin: 18px 0 12px;
  padding: 0 14px;
  min-height: 60px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: .4em;
  text-align: center;
}
#pin:focus { outline: none; border-color: var(--accent); }

/* Grote raakvlakken: dit wordt met een duim in een winkel bediend. */
button {
  font: inherit;
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  padding: 0 18px;
  background: var(--line);
  color: var(--ink);
  cursor: pointer;
}
button.primary { background: var(--accent); color: var(--on-accent); font-weight: 700; width: 100%; min-height: 56px; border-radius: 28px; }
button.danger { background: var(--danger); color: #fff; font-weight: 700; }
button.round {
  width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
}
button:disabled { opacity: .3; cursor: default; }

/* ---- de tv ------------------------------------------------------------ */

.tv {
  position: relative;
  width: min(100%, 340px);
  aspect-ratio: 400 / 360;
  margin: 10px auto 18px;
}
.tv > svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
/* Percentages en de clipPath komen uit docs/design/tv_generator.py. */
.tv-screen {
  position: absolute;
  left: 14%;
  top: 30%;
  width: 62%;
  height: 51.667%;
  background: var(--screen);
  clip-path: url(#tvScreenClip);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.tv-screen > * { grid-area: 1 / 1; }
.tv-screen canvas { width: 100%; height: 100%; }
.tv-video { color: #f4e3d0; font-size: 44px; }
.tv-empty { text-align: center; color: #f4e3d0; padding: 8px 14px; }
.tv-empty svg { width: 34%; height: auto; }
.tv-empty p { margin: 4px 0 0; font-size: 14px; line-height: 1.3; }
.tv-label {
  align-self: end;
  justify-self: end;
  margin: 0 8% 6% 0;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(244, 227, 208, .75);
}

.notice {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--soft);
  color: var(--ink);
  font-size: 15px;
}

/* ---- de strook --------------------------------------------------------- */

.strip { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }

.tile {
  background: var(--card);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.pic {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--screen);
  cursor: pointer;
}
.pic canvas { width: 100%; height: 100%; display: block; }
.pic.video { display: grid; place-items: center; color: #f4e3d0; font-size: 48px; }

/* Het nummer vervangt de bestandsnaam: de volgorde is het enige dat telt. */
.num {
  position: absolute;
  top: 10px;
  left: 10px;
  min-width: 30px;
  height: 30px;
  padding: 0 9px;
  border-radius: 15px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
  font-size: 15px;
  display: grid;
  place-items: center;
}

.bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
}
.secs {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 20px;
  background: var(--soft);
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
}
.bar .note { font-size: 14px; }
.actions { margin-left: auto; display: flex; gap: 6px; }

.confirm {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: var(--soft);
}
.confirm span { flex: 1; font-size: 15px; font-weight: 600; }
.confirm button { min-height: 42px; padding: 0 14px; border-radius: 21px; }
.tile.asking .bar { display: none; }
.tile:not(.asking) .confirm { display: none; }

/* ---- de knop ----------------------------------------------------------- */

.add-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 24px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 60%, transparent);
  pointer-events: none;
}
.add {
  pointer-events: auto;
  position: relative;
  display: block;
  max-width: 560px;
  margin-inline: auto;
  height: 58px;
  border-radius: 29px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
  font-size: 18px;
  text-align: center;
  line-height: 58px;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(242, 106, 61, .35);
  cursor: pointer;
  user-select: none;
}
.add.busy { cursor: default; }
.add-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--accent-deep);
  transition: width .2s;
}
.add-text { position: relative; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  padding: 12px 18px;
  border-radius: 22px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  box-shadow: var(--shadow);
  z-index: 5;
}

/* ---- groot bekijken ---------------------------------------------------- */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(10, 6, 4, .94);
  display: grid;
  place-items: center;
}
.viewer img, .viewer video { max-width: 100%; max-height: 100%; }
.viewer-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: 12px;
  width: 48px;
  min-height: 48px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .15);
  color: #fff;
  font-size: 20px;
}

/* ---- promotie ---------------------------------------------------------- */

.promo {
  display: block;
  margin-top: 28px;
  padding: 16px;
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.promo strong { display: block; margin-bottom: 4px; }
.promo.install { margin: 0 0 14px; }
.promo.install button { margin-top: 12px; }
.promo span { color: var(--muted); font-size: 15px; }

.promo-frame {
  width: 100%;
  height: 132px;
  margin-top: 28px;
  border: 0;
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}

/* ---- bijsnijden ---------------------------------------------------------- */

.editor {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #0a0604;
  color: #f4e3d0;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.editor-top, .editor-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
}
.editor-bottom { justify-content: center; gap: 18px; padding-bottom: 20px; }
.editor-title { font-weight: 700; }
button.ghost { background: transparent; color: #f4e3d0; padding: 0 8px; }
button.accent { background: var(--accent); color: #fff; font-weight: 700; border-radius: 24px; }
button.pill { background: rgba(255, 255, 255, .14); color: #f4e3d0; border-radius: 24px; font-weight: 600; }
button.round.big { width: 52px; min-height: 52px; background: rgba(255, 255, 255, .14); color: #f4e3d0; font-size: 24px; }
.editor-hint { margin: 0; text-align: center; font-size: 14px; color: rgba(244, 227, 208, .7); }

.editor-stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  touch-action: none;      /* anders scrollt of zoomt de browser zelf mee */
  cursor: grab;
}
.editor-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  width: min(100%, calc((100vh - 220px) * 16 / 9));
}
.editor-wrap { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.editor-wrap img { position: absolute; transform-origin: 50% 50%; max-width: none; user-select: none; }
/* Buiten het kader dimmen; de rand toont het kader zelf. */
.editor-dim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: 0 0 0 200vmax rgba(10, 6, 4, .7);
  outline: 2px solid rgba(244, 227, 208, .9);
  border-radius: 4px;
}

/* ======================================================================
   Portaal: inloggen, schermkeuze, koppelcode, account. Zelfde kaarten en
   knoppen als hierboven, niets zakelijkers.
   ====================================================================== */

a { color: var(--accent-deep); }
@media (prefers-color-scheme: dark) { a { color: var(--accent); } }

.top-row { display: flex; align-items: center; justify-content: space-between; }
.brand { text-decoration: none; }
.nav-link {
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  padding: 10px 4px;
}
.back {
  display: inline-block;
  margin: 6px 0 2px;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
}
h1:empty { display: none; }
.small { font-size: 14px; }
.strong { font-weight: 700; margin: 2px 0 6px; overflow-wrap: anywhere; }

.card {
  margin: 14px 0;
  padding: 20px;
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.card h2 { margin-bottom: 8px; }

.field { display: block; margin: 0 0 14px; }
.field span { display: block; margin-bottom: 6px; font-size: 15px; font-weight: 600; }
.field input, .field select {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); }

button.wide { width: 100%; margin: 4px 0 10px; }
.button-link {
  display: block;
  margin: 18px 0;
  min-height: 56px;
  line-height: 56px;
  border-radius: 28px;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
}
a.primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 8px 22px rgba(242, 106, 61, .35); }
a.secondary { background: var(--line); color: var(--ink); }

.auth-links { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; font-size: 15px; }
.sent { font-size: 17px; margin: 0; }

/* ---- schermenlijst ---------------------------------------------------- */

.screens { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.screen-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--ink);
}
.screen-thumb {
  flex: 0 0 112px;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  background: var(--screen);
  overflow: hidden;
  display: grid;
  place-items: center;
  color: #f4e3d0;
  font-size: 24px;
}
.screen-thumb canvas { width: 100%; height: 100%; display: block; }
.screen-info { min-width: 0; }
.screen-info strong { display: block; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.screen-info > span { display: block; }
.screen-info > .state { display: flex; }

.state { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: 15px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: 0 0 10px; }
.dot.on { background: #3fa45b; }

/* ---- koppelcode ------------------------------------------------------- */

.code {
  margin: 4px 0;
  font-size: 40px;
  font-weight: 800;
  letter-spacing: .08em;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--accent-deep);
  user-select: all;
}
@media (prefers-color-scheme: dark) { .code { color: var(--accent); } }
.steps { padding-left: 22px; margin: 18px 0; }
.steps li { margin-bottom: 8px; }

/* ---- scherminstellingen, account -------------------------------------- */

details.card > summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  min-height: 28px;
}
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: " \25BE"; color: var(--muted); }
details.card[open] > summary { margin-bottom: 16px; }
.more { margin-top: 28px; }
.danger-zone summary { color: var(--danger); }

.confirm-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-radius: 16px;
  background: var(--soft);
}
.confirm-inline span { flex: 1; font-weight: 600; font-size: 15px; }
.confirm-inline button { min-height: 42px; border-radius: 21px; }

.waiting { text-align: center; padding: 20px 8px; }
