/* ============================================================================
   aPunkt AI Fotostudio — STUDIO PRO (nicht-destruktives Fahrzeug-Fotostudio).
   Nur Studio-Pro-spezifisches (.sp-). Alle Farben über die Tokens aus app.css
   (--navy/--teal/--accent/…). Mandanten-Akzent durchgängig. Keine eigenen
   Primärfarben, keine generische AI-Ästhetik.
   ============================================================================ */

/* Vollbild-Editor (wie Masken-Studio): .sp füllt Breite + Höhe, Bühne = Hero,
   rechte Steuerspalte scrollt eigenständig. */
/* Editor-Ränder fluchten mit Navbar/Titelzeile: links 45px (= Anfang des Logos /
   Titel), rechts 26px (= rechte Kante des User-Menüs). */
.sp { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 18px 26px 18px 45px; }
.sp.sp-busy { pointer-events: none; }
.sp.sp-busy .sp-stage { pointer-events: auto; }   /* Overlay schluckt Klicks selbst */

/* ---------- Haupt-Grid: Bühne (groß) + rechte Steuerung ---------- */
.sp-grid {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 384px;
  grid-template-rows: minmax(0, 1fr);
  gap: 18px;
}
.sp-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; min-height: 0; }
/* rechte Spalte scrollt innerhalb der Viewport-Höhe (8 Karten passen so immer) */
.sp-side { display: flex; flex-direction: column; gap: 16px; min-height: 0; overflow-y: auto; overflow-x: hidden; padding-right: 4px; }

/* ---------- Bühne: füllt die Höhe; Composite ist object-fit:contain (zentriert) ---------- */
.sp-stagecard { overflow: hidden; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sp-stage {
  position: relative; flex: 1; min-height: 0; width: 100%;
  background:
    repeating-conic-gradient(#22243f 0% 25%, #1b1d36 0% 50%) 50% / 30px 30px,
    var(--navy);
  display: grid; place-items: center; overflow: hidden;
  touch-action: none; user-select: none; cursor: pointer;
}

/* ---------- Freistellen-Aufforderung (nach Foto-Laden, Klick startet Cutout) ---------- */
.sp-cta {
  position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; gap: 13px;
  background: rgba(20,21,43,.5); backdrop-filter: blur(1.5px); -webkit-backdrop-filter: blur(1.5px);
  padding: 24px; text-align: center;
}
.sp-cta-btn { box-shadow: 0 12px 34px -10px rgba(0,0,0,.55); }
.sp-cta-hint { color: rgba(255,255,255,.88); font-size: 12.5px; font-weight: 600; max-width: 360px; line-height: 1.4; }
.sp-stage:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
.sp-stage.drag { outline: 3px dashed var(--accent); outline-offset: -8px; }
.sp-stage.grab { cursor: grabbing; }

.sp-canvas, .sp-prev-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; display: block;
}

.sp-ph {
  position: relative; z-index: 2; display: grid; justify-items: center; gap: 6px;
  text-align: center; color: rgba(255,255,255,.78); padding: 24px; pointer-events: none;
}
.sp-ph svg.big { width: 56px; height: 56px; color: rgba(255,255,255,.5); margin-bottom: 8px; }
.sp-ph .h-title { color: #fff; }
.sp-ph .sub { color: rgba(255,255,255,.62); }

/* Vorher-Badge (Original) */
.sp-badge {
  position: absolute; top: 12px; right: 12px; z-index: 4;
  background: rgba(20,21,43,.82); color: #fff; font-weight: 800; font-size: 11px;
  letter-spacing: .1em; padding: 5px 11px; border-radius: 999px; backdrop-filter: blur(4px);
}
/* Trust-Banner: „Originalpixel · Fahrzeug unverändert · nur Hintergrund getauscht" */
.sp-trust {
  position: absolute; left: 12px; bottom: 12px; z-index: 4; max-width: calc(100% - 24px);
  display: flex; align-items: center; gap: 8px;
  background: rgba(20,21,43,.78); color: #fff; font-size: 11.5px; line-height: 1.3;
  padding: 7px 12px; border-radius: 999px; backdrop-filter: blur(5px);
}
.sp-trust b { font-weight: 800; }
.sp-trust-ic { width: 15px; height: 15px; flex: none; color: var(--teal-l); }

/* Bühnenleiste */
.sp-stagebar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 16px; border-top: 1px solid var(--line); background: var(--surface);
}
.sp-stagebar .spacer { flex: 1; min-width: 8px; }
.sp-stagebar .btn.on { background: var(--teal-pale); border-color: var(--accent); color: var(--accent-d); }

/* ---------- Lade-/Fortschritts-Overlay ---------- */
.sp-overlay {
  position: absolute; inset: 0; z-index: 6; display: none; place-items: center; align-content: center;
  background: rgba(14,15,28,.76); backdrop-filter: blur(3px); color: #fff; text-align: center;
}
.sp-overlay.show { display: grid; }
.sp-ovcard { display: grid; justify-items: center; gap: 11px; padding: 24px; }
.sp-spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.22); border-top-color: var(--teal-l);
  animation: sp-spin .8s linear infinite;
}
@keyframes sp-spin { to { transform: rotate(360deg); } }
.sp-ovlabel { font-weight: 800; font-size: 15.5px; }
.sp-ovsub { font-size: 12.5px; color: rgba(255,255,255,.72); max-width: 380px; }
.sp-ovtrack { width: 260px; max-width: 70vw; height: 6px; border-radius: 99px; background: rgba(255,255,255,.16); overflow: hidden; margin-top: 4px; }
.sp-ovbar { display: block; height: 100%; width: 0; background: var(--teal-l); border-radius: 99px; transition: width .35s ease; }

/* ---------- Card-Header-Icon ---------- */
.card-ic { width: 18px; height: 18px; color: var(--accent); flex: none; }

/* ---------- Mini-Headline / Felder ---------- */
.sp-mini-h { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.sp-sech { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.sp-sech b { font-size: 13.5px; font-weight: 800; color: var(--navy); }

.sp-fieldrow { display: flex; align-items: center; gap: 12px; margin-top: 9px; }
.sp-fieldlbl { font-size: 12px; font-weight: 700; color: var(--muted); width: 64px; flex: none; }
.sp-range {
  flex: 1; min-width: 0; height: 4px; appearance: none; -webkit-appearance: none;
  background: var(--line); border-radius: 99px; outline: none; cursor: pointer;
}
.sp-range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 3px solid #fff; box-shadow: var(--sh-s); cursor: pointer;
}
.sp-range::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 3px solid #fff; box-shadow: var(--sh-s); cursor: pointer;
}
.sp-range:disabled { opacity: .5; cursor: default; }
.sp-range:focus-visible { outline: none; }
.sp-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--teal-pale), var(--sh-s); }
.sp-range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px var(--teal-pale), var(--sh-s); }

/* ---------- Toggle (Logo / Kennzeichen / Effekte) ---------- */
.sp-toggle {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 11px 13px; border-radius: 11px; border: 1.5px solid var(--line);
  background: var(--surface); transition: .12s; cursor: pointer;
}
.sp-toggle:hover { border-color: var(--accent); }
.sp-toggle.on { border-color: var(--accent); background: var(--teal-pale); }
.sp-toggle-dot {
  width: 38px; height: 22px; border-radius: 99px; background: var(--line); flex: none;
  position: relative; transition: .15s;
}
.sp-toggle-dot::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: var(--sh-s); transition: .15s;
}
.sp-toggle.on .sp-toggle-dot { background: var(--accent); }
.sp-toggle.on .sp-toggle-dot::after { transform: translateX(16px); }
.sp-toggle-l { font-size: 13px; font-weight: 700; color: var(--navy); display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sp-toggle-l b { font-size: 13px; font-weight: 800; color: var(--navy); }
.sp-toggle-l small { font-size: 11.5px; font-weight: 500; color: var(--muted); }

/* ---------- Hintergrund-Bibliothek ---------- */
.sp-bgtiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.sp-bgtile {
  display: flex; flex-direction: column; padding: 0;
  border-radius: 11px; border: 1.5px solid var(--line); background: var(--surface);
  overflow: hidden; transition: .12s; cursor: pointer;
}
.sp-bgtile:hover { border-color: var(--accent); }
.sp-bgtile.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--teal-pale); }
.sp-bgprev {
  display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 10;
  background-color: var(--surface-2); background-size: cover; background-position: center;
  border-bottom: 1px solid var(--line-2);
  box-shadow: inset 0 0 0 1px var(--line-2);   /* macht reinweiße Wand-Vorschau lesbar */
}
.sp-bgprev-trans {
  background-image:
    linear-gradient(45deg, #cfd4dc 25%, transparent 25%),
    linear-gradient(-45deg, #cfd4dc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #cfd4dc 75%),
    linear-gradient(-45deg, transparent 75%, #cfd4dc 75%);
  background-size: 12px 12px; background-position: 0 0, 0 6px, 6px -6px, -6px 0; background-color: #fff;
}
.sp-bgprev-up { width: 22px; height: 22px; color: var(--faint); }
.sp-bgtile-l { font-size: 10.5px; font-weight: 700; color: var(--muted); padding: 6px 4px; text-align: center; }
.sp-bgtile.sel .sp-bgtile-l { color: var(--accent-d); }

/* ---------- Logo: Positions-Presets ---------- */
.sp-logobody { margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line-2); }
.sp-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sp-preset {
  padding: 8px 6px; border-radius: 9px; border: 1.5px solid var(--line);
  background: var(--surface); font-size: 11.5px; font-weight: 700; color: var(--muted);
  transition: .12s; cursor: pointer;
}
.sp-preset:hover { border-color: var(--accent); }
.sp-preset.on { border-color: var(--accent); background: var(--teal-pale); color: var(--accent-d); }
.sp-logohint { margin: 9px 0 2px; line-height: 1.4; }

/* ---------- Kennzeichen: Segment-Schalter + Marken-Text ---------- */
.sp-platebody { margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line-2); }
.sp-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; }
.sp-seg-b {
  padding: 9px 8px; font-size: 12.5px; font-weight: 700; color: var(--muted);
  background: var(--surface); border: none; border-right: 1.5px solid var(--line); cursor: pointer; transition: .12s;
}
.sp-seg-b:last-child { border-right: none; }
.sp-seg-b:hover { color: var(--navy); }
/* accent-d statt --accent für sicheren Weiß-Kontrast (AA), Trenner verschwindet im aktiven Feld */
.sp-seg-b.on { background: var(--accent-d); color: #fff; border-color: var(--accent-d); }
.sp-seg-b.on + .sp-seg-b { border-left: 1.5px solid var(--accent-d); margin-left: -1.5px; }
.sp-brandlbl { display: block; margin-top: 12px; }
.sp-text {
  width: 100%; padding: 9px 12px; border-radius: 10px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--navy); font: inherit; font-size: 13px; font-weight: 800;
  letter-spacing: .04em; text-transform: uppercase;
}
.sp-text:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.sp-platehint { margin: 11px 0 2px; line-height: 1.4; }

.sp-kbhint { margin-top: 11px; line-height: 1.45; padding-top: 10px; border-top: 1px solid var(--line-2); }
.sp-kbhint b { color: var(--navy); font-weight: 800; }

/* ---------- Effekte ---------- */
.sp-fxbody { display: flex; flex-direction: column; gap: 9px; }

/* ---------- HD / Schärfen (optional, ausklappbar) ---------- */
.sp-upcard { overflow: hidden; }
.sp-quick { width: 100%; }
.sp-quick-sum {
  display: flex; align-items: center; gap: 11px; padding: 16px 20px; cursor: pointer; list-style: none;
}
.sp-quick-sum::-webkit-details-marker { display: none; }
.sp-quick-ic { width: 22px; height: 22px; color: var(--accent); flex: none; }
.sp-quick-sum > span { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.sp-quick-sum b { font-size: 13.5px; font-weight: 800; color: var(--navy); }
.sp-quick-sum small { font-size: 11.5px; color: var(--muted); }
.sp-quick-chev { width: 18px; height: 18px; color: var(--faint); flex: none; transition: transform .15s; transform: rotate(90deg); }
.sp-quick[open] .sp-quick-chev { transform: rotate(-90deg); }
.sp-quick-body { padding: 0 20px 18px; }
.sp-upnote { margin-top: 9px; line-height: 1.4; }

/* ---------- Export ---------- */
.sp-profiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin: 10px 0 14px; }
.sp-profile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 9px 12px; border-radius: 10px; border: 1.5px solid var(--line);
  background: var(--surface); transition: .12s; text-align: left; cursor: pointer;
}
.sp-profile:hover { border-color: var(--accent); }
.sp-profile.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--teal-pale); }
.sp-profile b { font-size: 13px; font-weight: 800; color: var(--navy); }
.sp-profile small { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sp-profile.sel b { color: var(--accent-d); }

.sp-exbtns { display: flex; flex-direction: column; gap: 9px; }
.sp-hr { border: none; border-top: 1px solid var(--line-2); margin: 16px 0 12px; }
.sp-batchhint { line-height: 1.4; margin-top: 8px; }

/* ---------- DSGVO-/Privacy-Karte ---------- */
.sp-privacy { background: var(--surface-2); }
.sp-privrow { display: flex; align-items: flex-start; gap: 12px; }
.sp-privrow > svg { width: 26px; height: 26px; flex: none; color: var(--teal-d); margin-top: 1px; }
.sp-privrow b { font-size: 13px; font-weight: 800; color: var(--navy); display: block; margin-bottom: 3px; }
.sp-privrow .sub { line-height: 1.45; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .sp-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .sp-bgtiles { grid-template-columns: repeat(2, 1fr); }
  .sp-profiles { grid-template-columns: 1fr; }
}

/* Haus-Stil-Aktiv-Badge */
.sp-stylebadge { font-size: 11px; font-weight: 800; color: #fff; background: var(--ok); border-radius: 999px; padding: 3px 10px; }
.sp-stylecard .card-h .spacer { flex: 1; }

/* Scheiben-Pinsel: Cursor im Markier-Modus */
.sp.sp-glasspaint .sp-canvas, .sp.sp-glasspaint .sp-stage { cursor: crosshair; }
.sp-glasscard .sp-seg-b.on { background: var(--accent); color: #fff; border-color: var(--accent); }
