/* ── Before / After Studio — KC Clean Carpets ──────────────────────────────
   Dark control UI matching the sovereign-os tool theme (catppuccin-ish).
   The canvas is the source of truth for the export; CSS only scales the
   on-screen preview down to fit the stage.                                  */

:root {
  --bg:        #1e1e2e;   /* base    */
  --surface:   #27293a;   /* panels  */
  --surface-2: #313347;   /* inputs  */
  --line:      #45475a;   /* borders */
  --text:      #cdd6f4;   /* primary */
  --muted:     #9399b2;   /* subtle  */
  --accent:    #00a6b8;   /* KC teal — also mirrored in app.js BRAND.color */
  --accent-2:  #89b4fa;
  --radius:    12px;
}

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

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.45;
}

/* ── Header ─────────────────────────────────────────────────────────── */
.app-header {
  padding: 1.4rem 1.6rem 1rem;
  border-bottom: 1px solid var(--line);
}
.app-header h1 { font-size: 1.35rem; font-weight: 700; }
.tagline { color: var(--muted); font-size: .9rem; margin-top: .15rem; }

/* ── Layout: controls + stage ───────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.4rem;
  padding: 1.4rem 1.6rem;
  align-items: start;
}

/* ── Control panel ──────────────────────────────────────────────────── */
.controls { display: flex; flex-direction: column; gap: 1.3rem; }
.control-group h2 {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-bottom: .55rem; font-weight: 600;
}

/* Drop slots */
.drop-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.drop-slot {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .25rem;
  aspect-ratio: 1 / 1;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface) center/cover no-repeat;
  cursor: pointer;
  text-align: center; padding: .5rem;
  transition: border-color .15s, background-color .15s;
}
.drop-slot:hover, .drop-slot.is-drag { border-color: var(--accent); }
.drop-slot.has-image { border-style: solid; }
.drop-slot.has-image .drop-hint { display: none; }
.drop-tag {
  font-size: .68rem; font-weight: 700; letter-spacing: .06em;
  background: rgba(0,0,0,.55); color: #fff; padding: .12rem .4rem; border-radius: 6px;
}
.drop-slot.has-image .drop-tag { position: absolute; top: .4rem; left: .4rem; }
.drop-hint { font-size: .72rem; color: var(--muted); }

/* Segmented button groups */
.seg { display: flex; gap: .35rem; }
.seg-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: .5rem .3rem;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 9px;
  font-size: .82rem; font-weight: 600; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.seg-btn small { font-size: .6rem; color: var(--muted); font-weight: 500; }
.seg-btn:hover { border-color: var(--accent-2); }
.seg-btn.is-active { background: var(--accent); border-color: var(--accent); color: #04222a; }
.seg-btn.is-active small { color: #04222a; }

/* Checkboxes */
.check {
  display: flex; align-items: center; gap: .5rem;
  font-size: .85rem; color: var(--text); margin-bottom: .4rem; cursor: pointer;
}
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

/* Primary action */
.btn-primary {
  width: 100%; padding: .8rem; font-size: .95rem; font-weight: 700;
  background: var(--accent); color: #04222a;
  border: none; border-radius: 10px; cursor: pointer;
  transition: filter .15s;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { filter: brightness(.95); }
.export-meta { margin-top: .5rem; font-size: .72rem; color: var(--muted); text-align: center; }

/* ── Stage / preview ────────────────────────────────────────────────── */
.stage {
  position: sticky; top: 1.4rem;
  background:
    repeating-conic-gradient(#26283a 0 25%, #2b2d40 0 50%) 0 0 / 28px 28px;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  min-height: 60vh;
}
.canvas-wrap { position: relative; line-height: 0; }
#canvas {
  max-width: 100%;
  max-height: 75vh;
  border-radius: 6px;
  box-shadow: 0 12px 40px rgba(0,0,0,.45);
}

/* Slider handle overlay (DOM, positioned over the canvas in slider mode) */
.slider-handle[hidden] { display: none; }   /* [hidden] must beat display:flex below */
.slider-handle {
  position: absolute; top: 0; bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 44px; cursor: ew-resize;
  display: flex; align-items: center; justify-content: center;
  touch-action: none;
}
.slider-line { position: absolute; top: 0; bottom: 0; width: 3px; background: #fff; box-shadow: 0 0 6px rgba(0,0,0,.6); }
.slider-grip {
  position: relative; z-index: 1;
  width: 38px; height: 38px; border-radius: 50%;
  background: #fff; color: #1e1e2e;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; box-shadow: 0 2px 8px rgba(0,0,0,.5);
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .stage { position: static; min-height: 40vh; order: -1; }
  #canvas { max-height: 55vh; }
}
