/* ============================================================
   München Textildruck Solution (MTD) — Konfigurator
   Layout (Steuerspalte + Bühne), Step-Übergänge, Swatches,
   Vorschau-Overlay. Ergänzt css/app.css, keine Token-Duplikate.
   ============================================================ */

.konf-intro { padding-bottom: 0; }

/* ---------- Layout: Steuerspalte + Bühne ---------- */
.konf-layout {
  display: grid;
  grid-template-columns: 1fr minmax(280px, 380px);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}
@media (max-width: 860px) {
  .konf-layout { grid-template-columns: 1fr; }
  .konf-buehne { order: -1; }
}

.konf-buehne {
  position: sticky;
  top: calc(76px + 1rem);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
@media (max-width: 860px) {
  .konf-buehne { position: static; }
}

/* ---------- Vorschau-Bühne: einfärbbares SVG-Kleidungsstück ---------- */
.konf-stage {
  position: relative;
  min-height: 300px;
  border-radius: var(--radius-lg);
  background: radial-gradient(120% 100% at 50% 0%, #F2F2EF, #E3E3DF);
  border: 1px solid var(--hairline);
  overflow: hidden;
}
/* Höhe kommt vom in-flow Viewport (aspect-ratio), nicht von der Bühne selbst.
   Das ist robust, auch wenn alle direkten Bühnenkinder absolut positioniert sind. */
.konf-garment { position: absolute; inset: 0; }
.garment-svg { width: 100%; height: 100%; display: block; }
.g-body { fill: var(--shirt-fill, #fff); stroke: rgba(0,0,0,.28); stroke-width: 2; stroke-linejoin: round; }
.g-shade { fill: rgba(0,0,0,.07); }
.g-detail { fill: none; stroke: rgba(0,0,0,.3); stroke-width: 2; stroke-linejoin: round; }
.g-dot { fill: rgba(0,0,0,.4); }
.g-hood { fill: rgba(0,0,0,.05); stroke: rgba(0,0,0,.3); stroke-width: 2; }
.g-string { stroke: rgba(0,0,0,.35); stroke-width: 3; stroke-linecap: round; }
.g-vneck { fill: none; stroke: rgba(0,0,0,.3); stroke-width: 2; stroke-linejoin: round; }
.g-stripe { fill: var(--red); opacity: .9; }
.g-seam { fill: rgba(0,0,0,.05); }
/* dunkle Shirts: Konturen heller, damit Details sichtbar bleiben */
.shirt-dunkel .g-body { stroke: rgba(255,255,255,.22); }
.shirt-dunkel .g-detail, .shirt-dunkel .g-vneck, .shirt-dunkel .g-hood { stroke: rgba(255,255,255,.28); }
.shirt-dunkel .g-shade { fill: rgba(0,0,0,.2); }

/* Zonen-Container über dem Shirt: Lücken lassen Klicks durch, nur die
   Druckbereiche selbst sind interaktiv. */
.konf-zonen { position: absolute; inset: 0; pointer-events: none; }

/* Druckbereich (Bounding Box) als Hilfslinie. Kein overflow:hidden auf der
   aktiven Zone, damit Motiv und Anfasser beim Vergrößern nicht abgeschnitten
   werden und immer greifbar bleiben. Der Rahmen zeigt die empfohlene Druckfläche. */
.konf-printarea {
  position: absolute;
  border: 1.5px dashed rgba(0,0,0,.4);
  border-radius: 4px;
  overflow: visible;
  touch-action: none;
  cursor: crosshair;
  pointer-events: auto;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
/* Ärmel-Mini-Vorschau bleibt beschnitten, damit sie nicht ins Shirt läuft */
.konf-ghost { overflow: hidden; }
.shirt-dunkel .konf-printarea { border-color: rgba(255,255,255,.5); }
/* aktive Druckstelle deutlich hervorheben */
.konf-printarea.active { border-style: solid; border-color: var(--red); box-shadow: 0 0 0 2px rgba(229,27,36,.18); }
.konf-zone-tag {
  position: absolute; top: 2px; left: 3px; z-index: 2;
  font-family: var(--font-display); font-size: 0.6rem; font-weight: 600;
  letter-spacing: 0.03em; color: rgba(22,24,27,.5); pointer-events: none;
  text-transform: uppercase;
}
.shirt-dunkel .konf-zone-tag { color: rgba(255,255,255,.6); }
.konf-printarea.active .konf-zone-tag { color: var(--red); }
.konf-printhint {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 0.5rem; font-size: 0.72rem; line-height: 1.35;
  color: rgba(22,24,27,.55); font-family: var(--font-display); pointer-events: none;
}
.shirt-dunkel .konf-printhint { color: rgba(255,255,255,.72); }

/* Motiv (Text/Bild), verschiebbar + skalierbar */
.konf-motiv {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%,-50%);
  transform-origin: center center;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  cursor: grab; touch-action: none; user-select: none;
}
.konf-motiv:active { cursor: grabbing; }
.motiv-img { display: block; max-width: none; pointer-events: none; }
.motiv-text { font-weight: 700; white-space: nowrap; line-height: 1.1; text-align: center; pointer-events: none; }
.motiv-handle {
  position: absolute; right: -9px; bottom: -9px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--red); border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
  cursor: nwse-resize; touch-action: none;
}

.konf-field-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.konf-field-row > div { flex: 1; min-width: 120px; }

.konf-ansicht-btn { align-self: center; }

/* ---------- Fortschrittsbalken ---------- */
.konf-progress-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-sunken);
  overflow: hidden;
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
}
.konf-progress-bar {
  height: 100%;
  background: var(--gradient-red);
  border-radius: inherit;
  transition: width 0.3s var(--ease);
}

/* ---------- Step-Übergänge ---------- */
[data-step] { display: none; }
[data-step].active { display: block; animation: konf-step-in 0.35s var(--ease); }
@keyframes konf-step-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.konf-group { margin-bottom: 1.6rem; }
.konf-group-label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--graphite);
  margin-bottom: 0.7rem;
}

/* ---------- Swatches: Produkt ---------- */
.konf-swatches { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.konf-produkt-btn {
  font: inherit;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.7em 1.2em;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--hairline-strong);
  background: var(--white);
  color: var(--carbon);
  cursor: pointer;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease), background 0.18s var(--ease);
}
.konf-produkt-btn:hover { border-color: var(--red); color: var(--red); }
.konf-produkt-btn.sel {
  border-color: var(--red);
  background: var(--red);
  color: var(--white);
}

/* ---------- Swatches: Farbe ---------- */
.konf-farb-btn {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1.5px solid var(--hairline-strong);
  background: var(--sw, var(--white));
  cursor: pointer;
  padding: 0;
  position: relative;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.konf-farb-btn:hover { transform: translateY(-2px); }
.konf-farb-btn.sel {
  box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--red);
}

/* ---------- Motiv-Tabs (Text / Datei hochladen, kombinierbar) ---------- */
.konf-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.2rem; border-bottom: 1px solid var(--hairline); }
.konf-tab-btn {
  font: inherit;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.6em 0.2em;
  margin-bottom: -1px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--graphite);
  cursor: pointer;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.konf-tab-btn:hover { color: var(--carbon); }
.konf-tab-btn.sel { color: var(--red); border-bottom-color: var(--red); }
.konf-tabpanel { display: none; }
.konf-tabpanel.active { display: block; }

/* ---------- Navigation Weiter/Zurück ---------- */
.konf-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: clamp(2rem, 4vw, 3rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--hairline);
}

/* ---------- Größenmatrix (Step 5) ---------- */
.konf-groessen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 0.7rem;
}
.konf-groesse-item { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; }
.konf-groesse-item label {
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--carbon);
}
.konf-groesse-item input[type="number"] {
  width: 100%;
  text-align: center;
  padding: 0.55em 0.3em;
  border: 1.5px solid var(--hairline-strong);
  border-radius: var(--radius-md);
  font: inherit;
  color: var(--carbon);
  background: var(--white);
}
.konf-groesse-item input[type="number"]:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(229, 27, 36, 0.12);
  outline: none;
}
.konf-menge-summe { font-weight: 600; margin-top: 0.4rem; }

/* ---------- Mannschaftsliste (Step 6, nur Trikot) ---------- */
.konf-spieler-liste { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1.2rem; }
.konf-spieler-zeile {
  display: grid;
  grid-template-columns: 1fr 4.5rem 5.5rem auto;
  gap: 0.5rem;
  align-items: center;
}
.konf-spieler-zeile input,
.konf-spieler-zeile select {
  font: inherit;
  padding: 0.6em 0.7em;
  border: 1.5px solid var(--hairline-strong);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--carbon);
}
.konf-spieler-zeile input:focus,
.konf-spieler-zeile select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(229, 27, 36, 0.12);
  outline: none;
}
.konf-spieler-remove {
  background: none;
  border: none;
  color: var(--graphite);
  font-size: 1.2rem;
  line-height: 1;
  padding: 0.4em;
  cursor: pointer;
}
.konf-spieler-remove:hover { color: var(--red); }
@media (max-width: 480px) {
  .konf-spieler-zeile { grid-template-columns: 1fr 1fr auto; }
  .konf-spieler-zeile select { grid-column: 1 / -1; }
}

/* ---------- Richtpreis-Box + Zusammenfassung (Step 7) ---------- */
.konf-preisbox {
  background: var(--surface-sunken);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.4rem;
  margin-bottom: 1.4rem;
}
.konf-preis-haupt {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  margin: 0 0 0.35rem;
  color: var(--carbon);
}
.konf-zusammenfassung {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.5rem 1.2rem;
  margin: 0 0 1.8rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
}
.konf-zusammenfassung dt { font-weight: 600; color: var(--graphite); margin: 0; }
.konf-zusammenfassung dd { margin: 0 0 0.5rem; color: var(--carbon); }

@media (prefers-reduced-motion: reduce) {
  [data-step].active { animation: none; }
}

/* ---------- Mehrere Elemente je Zone ---------- */
.konf-add-btns { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.konf-upload-btn { position: relative; overflow: hidden; }
.konf-el-liste { display: flex; flex-direction: column; gap: 0.4rem; margin: 1rem 0 0.4rem; }
.konf-el-row {
  display: flex; align-items: center; gap: 0.4rem;
  border: 1.5px solid var(--hairline); border-radius: var(--radius-md);
  background: var(--white); overflow: hidden;
}
.konf-el-row.active { border-color: var(--red); box-shadow: 0 0 0 2px rgba(229,27,36,.14); }
.konf-el-select {
  flex: 1; text-align: left; font: inherit; font-size: 0.85rem; color: var(--carbon);
  background: none; border: none; padding: 0.6em 0.8em; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.konf-el-row.active .konf-el-select { color: var(--red); font-weight: 600; }
.konf-el-del {
  flex: 0 0 auto; background: none; border: none; border-left: 1px solid var(--hairline);
  color: var(--graphite); font-size: 1.2rem; line-height: 1; padding: 0 0.7em; cursor: pointer; align-self: stretch;
}
.konf-el-del:hover { color: var(--red); background: rgba(229,27,36,.06); }

/* Anfasser + aktives Element: nur das ausgewählte Element zeigt den Anfasser */
.konf-motiv .motiv-handle { display: none; }
.konf-motiv.active .motiv-handle { display: block; }
.konf-motiv.active { outline: 1.5px solid rgba(229,27,36,.7); outline-offset: 2px; }

/* ---------- Ärmel-Mini-Vorschau auf der Vorderseite (klickbar) ---------- */
.konf-ghost { border-style: dotted; border-color: rgba(0,0,0,.32); cursor: pointer; }
.shirt-dunkel .konf-ghost { border-color: rgba(255,255,255,.4); }
.konf-ghost:hover { border-color: var(--red); box-shadow: 0 0 0 2px rgba(229,27,36,.14); }
.konf-ghost .konf-motiv { pointer-events: none; cursor: default; }
.konf-ghost .motiv-handle { display: none; }
.konf-ghost-hint { font-size: 0.55rem !important; opacity: .8; }

/* ---------- Motiv-Schriftarten (selbst gehostet, laden nur bei Verwendung) ---------- */
@font-face{font-family:"Oswald";src:url("/assets/fonts/oswald.woff2") format("woff2");font-weight:600;font-display:swap}
@font-face{font-family:"Anton";src:url("/assets/fonts/anton.woff2") format("woff2");font-weight:400;font-display:swap}
@font-face{font-family:"Bebas Neue";src:url("/assets/fonts/bebas.woff2") format("woff2");font-weight:400;font-display:swap}
@font-face{font-family:"Bungee";src:url("/assets/fonts/bungee.woff2") format("woff2");font-weight:400;font-display:swap}
@font-face{font-family:"Rye";src:url("/assets/fonts/rye.woff2") format("woff2");font-weight:400;font-display:swap}
@font-face{font-family:"UnifrakturCook";src:url("/assets/fonts/unifraktur.woff2") format("woff2");font-weight:700;font-display:swap}
@font-face{font-family:"Metal Mania";src:url("/assets/fonts/metalmania.woff2") format("woff2");font-weight:400;font-display:swap}
@font-face{font-family:"Pirata One";src:url("/assets/fonts/pirata.woff2") format("woff2");font-weight:400;font-display:swap}
@font-face{font-family:"Playfair Display";src:url("/assets/fonts/playfair.woff2") format("woff2");font-weight:700;font-display:swap}
@font-face{font-family:"Dancing Script";src:url("/assets/fonts/dancing.woff2") format("woff2");font-weight:700;font-display:swap}
@font-face{font-family:"Great Vibes";src:url("/assets/fonts/greatvibes.woff2") format("woff2");font-weight:400;font-display:swap}
@font-face{font-family:"Pacifico";src:url("/assets/fonts/pacifico.woff2") format("woff2");font-weight:400;font-display:swap}
@font-face{font-family:"Special Elite";src:url("/assets/fonts/specialelite.woff2") format("woff2");font-weight:400;font-display:swap}
@font-face{font-family:"Permanent Marker";src:url("/assets/fonts/marker.woff2") format("woff2");font-weight:400;font-display:swap}
@font-face{font-family:"Fredoka";src:url("/assets/fonts/fredoka.woff2") format("woff2");font-weight:600;font-display:swap}

/* ---------- Dreh-Griff + sichtbare Anfasser (nur aktives Element) ---------- */
.motiv-rotate {
  position: absolute; left: 50%; top: -30px; transform: translateX(-50%);
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--red); border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
  display: none; align-items: center; justify-content: center;
  cursor: grab; touch-action: none;
}
.motiv-rotate::before {
  content: ""; position: absolute; top: 22px; left: 50%; width: 2px; height: 8px;
  background: var(--red); transform: translateX(-50%);
}
.motiv-rotate svg { width: 13px; height: 13px; stroke: #fff; fill: none; stroke-width: 2.4; pointer-events: none; }
.konf-motiv.active .motiv-rotate { display: inline-flex; }
.konf-ghost .motiv-rotate { display: none !important; }

/* ---------- Zoom (Mausrad + Steuerung) ---------- */
.konf-viewport { position: relative; width: 100%; aspect-ratio: 4 / 5; transform-origin: 0 0; will-change: transform; }
.konf-zoom {
  position: absolute; right: 8px; bottom: 8px; z-index: 5;
  display: flex; align-items: center; gap: 2px;
  background: rgba(255,255,255,.92); border: 1px solid var(--hairline);
  border-radius: 999px; padding: 2px; box-shadow: var(--shadow-sm);
  backdrop-filter: blur(4px);
}
.konf-zoom-btn {
  width: 30px; height: 30px; border: none; background: none; border-radius: 50%;
  font-size: 1.1rem; line-height: 1; cursor: pointer; color: var(--carbon);
  display: inline-flex; align-items: center; justify-content: center;
}
.konf-zoom-btn:hover { background: var(--surface-sunken); color: var(--red); }
.konf-zoom-lbl { font-size: .72rem; font-family: var(--font-display); color: var(--graphite); min-width: 36px; text-align: center; }

/* ---------- Rotes Shirt: kein roter Rahmen (sonst unsichtbar/kollidiert) ---------- */
.shirt-rot .konf-printarea { border-color: rgba(0,0,0,.5); }
.shirt-rot .konf-printarea.active { border-color: #0C0D0F; box-shadow: 0 0 0 2px rgba(12,13,15,.2); }
.shirt-rot .konf-zone-tag { color: rgba(0,0,0,.6); }
.shirt-rot .konf-printarea.active .konf-zone-tag { color: #0C0D0F; }
.shirt-rot .konf-printhint { color: rgba(0,0,0,.6); }
.shirt-rot .motiv-handle,
.shirt-rot .motiv-rotate { background: #16181B; }
.shirt-rot .motiv-rotate::before { background: #16181B; }
