/* ==========================================================================
   Bestell-Wizard (Startseite)
   Mobile-first: Basisstile gelten für schmale Viewports, Breakpoints
   erweitern das Layout für Tablet/Desktop.
   ========================================================================== */

.shop-wizard {
  flex: 1 0 auto; /* füllt <main>, damit der graue Hintergrund statt Weissraum bis zum Footer reicht (siehe Sticky-Footer-Regeln in index.css) */
  padding: clamp(24px, 4vw, 48px) clamp(18px, 5vw, 56px) clamp(48px, 8vw, 96px);
  background: var(--soft-grey);
  scroll-margin-top: 84px; /* Anker-Sprung berücksichtigt den sticky Header */
}

.wizard-intro {
  max-width: 640px;
  margin: 0 auto 20px;
  text-align: center;
}

.wizard-intro .eyebrow {
  color: var(--red);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* Der globale h1 ist für den früheren, breiten Zwei-Spalten-Hero ausgelegt
   (bis zu 92px). Im schmalen, zentrierten Wizard-Intro wirkt das gequetscht
   und schiebt das eigentliche Modul weit nach unten - hier bewusst kleiner
   und mit mehr Zeilenhöhe. */
.wizard-intro h1 {
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.25;
  max-width: none;
  margin-bottom: 8px;
}

.wizard-intro p {
  font-size: 16px;
  margin: 0;
}

.wizard-shell {
  max-width: 760px;
  margin: 0 auto;
}

/* Produktschritt auf der Startseite darf breiter sein, damit die Karten
   nicht zu schmal gequetscht werden (siehe updateCategoryLayout() in
   shop-wizard.js - nur aktiv, wenn data-card-style="featured" und Schritt
   "category"). */
.wizard-shell.wizard-shell--wide {
  max-width: 1180px;
}

/* ---- Fortschrittsanzeige ---- */

.wizard-progress {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 4px;
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
}

.wizard-progress li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--mid-grey);
  white-space: nowrap;
}

.wizard-progress li .wizard-progress-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--paper);
  color: var(--muted);
  font-size: 12px;
}

.wizard-progress li.active {
  background: var(--red);
  color: white;
}

.wizard-progress li.active .wizard-progress-num {
  background: white;
  color: var(--red);
}

.wizard-progress li.done {
  background: rgba(128, 187, 52, 0.16);
  color: var(--strong);
}

.wizard-progress li.done .wizard-progress-num {
  background: var(--pure-green);
  color: white;
}

/* ---- Panel / Steps ---- */

.wizard-panel {
  background: var(--paper);
  border-radius: var(--box-radius);
  padding: clamp(20px, 4vw, 36px);
  box-shadow: 0 1px 0 var(--mid-grey);
}

/* Kein weisser Kasten hinter den Produkt-Karten auf der Startseite - der
   Platz geht direkt an die Karten (siehe .wizard-shell--wide). */
.wizard-panel.wizard-panel--plain {
  background: transparent;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.wizard-step-title {
  font-size: clamp(20px, 3vw, 26px);
  margin-bottom: 18px;
}

.wizard-step-hint {
  margin-top: -10px;
  margin-bottom: 16px;
}

.wizard-field {
  display: grid;
  gap: 7px;
  font-weight: 500;
  margin-bottom: 16px;
}

.wizard-field input,
.wizard-field textarea {
  max-width: 280px;
}

.wizard-field textarea {
  max-width: none;
}

.wizard-hint {
  display: block;
  color: var(--muted);
  font-weight: 400;
  font-size: 13px;
}

.wizard-message {
  min-height: 20px;
  font-weight: 500;
  text-align: center;
  margin: 0 0 16px;
}

.wizard-error {
  color: var(--red);
  font-weight: 500;
  min-height: 20px;
  margin-top: 8px;
}

.wizard-error:empty {
  display: none;
}

/* ---- Auswahlkarten (Kategorie / Sprache) ---- */

.wizard-choice-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.wizard-choice-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  text-align: left;
  padding: 18px 20px;
  background: var(--soft-grey);
  border: 0;
  border-radius: var(--box-radius);
  box-shadow: inset 0 0 0 1px transparent;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.wizard-choice-card:hover:not(:disabled) {
  background: var(--mid-grey);
}

.wizard-choice-card:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.wizard-choice-card .wizard-choice-label {
  font-size: 17px;
  font-weight: 600;
  color: #000;
}

.wizard-choice-card .wizard-choice-desc {
  color: #000;
  font-size: 14px;
}

.wizard-choice-card:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.wizard-choice-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--mid-grey);
  padding: 4px 8px;
  border-radius: 999px;
  margin-bottom: 6px;
}

/* ---- Auswahlkarten: Startseite (Bild + Text + Preis) -----------------------
   Nur aktiv, wenn der Choice-Grid-Container data-card-style="featured" trägt
   (aktuell nur index.html). Ohne dieses Attribut bleibt die einfache
   Text-Karte oben unverändert - z.B. auf /products.

   Bewusst verschachteltes Flexbox statt CSS-Grid mit fr-Zeilen: Grid-Zeilen
   mit "1fr 1fr" brauchen eine definierte Container-Höhe, um sich korrekt
   aufzuteilen - ohne die kollabieren sie auf den Mindestinhalt und die
   gestapelten Karten wirken zerquetscht. Flexbox mit align-items: stretch
   löst das robust: aussen zwei Elemente (grosse Karte links, Stack rechts),
   innen im Stack nochmals Flex-Column für die zwei kleineren Karten. */

.wizard-choice-grid[data-card-style="featured"] {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wizard-choice-grid[data-card-style="featured"] .choice-card-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Mobil: Bild oben, Text darunter (volle Kartenbreite für den Text) - Bild
   links/Text rechts ist auf schmalen Screens zu eng (siehe Feedback). Erst
   ab 700px auf Bild-links/Text-rechts umgestellt (siehe Media Query unten). */
.wizard-choice-grid[data-card-style="featured"] .wizard-choice-card {
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  overflow: hidden;
  gap: 0;
  background: var(--paper);
}

.choice-card-media {
  overflow: hidden;
  background: var(--paper);
}

.choice-card-media img {
  width: 100%;
  /* Echte Produktfotos sind alle im gleichen Format (2658x1635, ~1.63:1).
     aspect-ratio statt fixer Pixel-Höhe, damit die Box immer zum Bild passt
     und nichts unnötig oben/unten oder seitlich weggeschnitten wird. */
  aspect-ratio: 2658 / 1635;
  object-fit: cover;
  display: block;
}

.choice-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
}

.choice-card-price {
  align-self: flex-start;
  margin-top: auto;
  background: var(--price-blue);
  color: white;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 15px;
}

.choice-card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  margin-bottom: 0;
  z-index: 1;
}

/* Ab 700px: aussen flex-row (grosse Karte links, Stack rechts, gleiche
   Höhe durch align-items: stretch), die zwei kleineren Karten im Stack
   teilen sich die Höhe gleichmässig (flex: 1). Innerhalb jeder Karte jetzt
   auch Bild links/Text rechts statt Bild oben - dafür ist ab hier genug
   Breite pro Karte vorhanden. */
@media (min-width: 700px) {
  .wizard-choice-grid[data-card-style="featured"] {
    flex-direction: row;
    align-items: stretch;
  }

  .wizard-choice-grid[data-card-style="featured"] > .wizard-choice-card {
    flex: 1.3;
  }

  .wizard-choice-grid[data-card-style="featured"] > .choice-card-stack {
    flex: 1;
  }

  .wizard-choice-grid[data-card-style="featured"] .choice-card-stack .wizard-choice-card {
    flex: 1;
  }

  .wizard-choice-grid[data-card-style="featured"] .wizard-choice-card {
    flex-direction: row;
  }

  .wizard-choice-grid[data-card-style="featured"] .choice-card-media {
    flex: 0 0 44%;
  }

  .wizard-choice-grid[data-card-style="featured"] .choice-card-media img {
    height: 100%;
    min-height: 140px;
  }

  /* Grosse Karte ("Personalisierte Jasskarten"): bleibt Bild links/Text
     rechts wie die gestapelten Karten. Sie wird aber per align-items:
     stretch auf die Höhe der beiden gestapelten Karten gezogen - würde das
     Foto diese grosse Höhe per height:100% ausfüllen, wirkt es entweder
     stark beschnitten (schmale Box) oder deutlich zu gross. Eigenes
     Seitenverhältnis + vertikal zentriert lässt das Bild in normaler Grösse
     stehen, der Rest der Spalte bleibt schlicht weiss (wie die Karte selbst). */
  .wizard-choice-grid[data-card-style="featured"] > .wizard-choice-card[data-key="personalisiert"] .choice-card-media {
    display: flex;
    align-items: center;
  }

  .wizard-choice-grid[data-card-style="featured"] > .wizard-choice-card[data-key="personalisiert"] .choice-card-media img {
    height: auto;
    aspect-ratio: 2658 / 1635;
    min-height: 0;
  }
}

/* ---- Auswahlkarten: /products (Bild oben, alle Karten gleich gross) ------
   Nutzt bewusst das normale .wizard-choice-grid-Raster (gleich grosse
   Spalten, siehe Responsive-Regeln unten) statt der Startseiten-Anordnung -
   "ganz normale Produktseite". */

.wizard-choice-grid[data-card-style="grid"] .wizard-choice-card {
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  overflow: hidden;
  gap: 0;
  background: var(--paper);
}

.grid-card-media {
  overflow: hidden;
  background: var(--paper);
}

.grid-card-media img {
  width: 100%;
  /* Wie .choice-card-media img: Höhe folgt aus dem echten Bildformat statt
     einer festen Pixelhöhe, egal ob 2 Spalten (Sprachauswahl) oder 3
     Spalten (/products). */
  aspect-ratio: 2658 / 1635;
  object-fit: cover;
  display: block;
}

.grid-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px 20px;
}

/* ---- Personalisierung ---- */

.wizard-personalization-options {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.wizard-personalization-options .checkbox-row {
  align-items: flex-start;
}

.wizard-personalization-options .checkbox-row input {
  margin-top: 2px;
}

.wizard-personalization-options.has-error {
  box-shadow: inset 0 0 0 2px var(--red);
  border-radius: var(--box-radius);
  padding: 10px;
  margin: -10px -10px 6px;
}

#pw-object-row.disabled,
#pw-back-row.disabled {
  opacity: 0.55;
}

.wizard-file-groups {
  display: grid;
  gap: 16px;
  margin: 8px 0 16px;
}

.wizard-file-group {
  background: var(--soft-grey);
  border-radius: var(--box-radius);
  padding: 16px;
}

.wizard-file-group.has-error {
  box-shadow: inset 0 0 0 2px var(--red);
}

.wizard-file-group h4 {
  margin: 0 0 4px;
  font-size: 15px;
}

.wizard-group-error {
  color: var(--red);
  font-weight: 500;
  font-size: 13px;
  margin: 0 0 10px;
}

.wizard-group-error:empty {
  display: none;
}

.wizard-file-group .wizard-hint {
  margin-bottom: 10px;
}

.wizard-face-figure-select {
  border: 0;
  padding: 0;
  margin: 0 0 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.wizard-face-figure-select legend,
.wizard-face-suits legend {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  padding: 0;
  margin-bottom: 8px;
  width: 100%;
}

.wizard-face-figure-select .checkbox-row {
  background: none;
  padding: 0;
}

.wizard-face-card-fields {
  display: grid;
  gap: 12px;
}

.wizard-face-figure-block {
  background: var(--paper);
  border-radius: var(--box-radius);
  padding: 14px;
}

.wizard-face-figure-title {
  font-weight: 600;
  margin: 0 0 10px;
}

.wizard-face-suits {
  border: 0;
  padding: 0;
  margin: 0 0 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.wizard-face-suits .checkbox-row {
  background: var(--soft-grey);
  padding: 8px 12px;
}

.wizard-face-same-photo-row {
  margin-bottom: 10px;
}

/* Herz und Eck sind auf den Jasskarten selbst rot gedruckt, Kreuz und
   Schaufel schwarz - das übernehmen wir hier bei der Farbauswahl. */
.suit-red {
  color: var(--red);
  font-weight: 600;
}

.wizard-file-slots {
  display: grid;
  gap: 10px;
}

.wizard-file-slot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.wizard-file-slot label.file-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--mid-grey);
  border-radius: var(--button-radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

.wizard-file-slot label.file-upload-btn:hover {
  background: var(--light-grey);
}

.wizard-file-slot--missing label.file-upload-btn {
  box-shadow: inset 0 0 0 2px var(--red);
  background: white;
}

.file-upload-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.wizard-file-slot input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.wizard-file-slot-name {
  font-size: 13px;
  color: var(--muted);
}

.wizard-file-slot-clear {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 4px;
}

.wizard-file-slot-clear:hover {
  color: var(--red);
}

.wizard-price-preview {
  font-weight: 600;
  color: var(--strong);
  background: var(--soft-grey);
  border-radius: var(--button-radius);
  padding: 12px 14px;
  display: inline-block;
}

/* ---- Formular / Adresse ---- */

.wizard-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 14px;
}

.wizard-form-grid .wizard-field input {
  max-width: none;
}

.wizard-field-error {
  display: block;
  color: var(--red);
  font-size: 13px;
  font-weight: 500;
  min-height: 16px;
  margin-top: 2px;
}

.wizard-field-error:empty {
  display: none;
}

.wizard-field.has-error input {
  box-shadow: inset 0 0 0 2px var(--red);
  background: white;
}

.wizard-ship-toggle {
  margin: 20px 0 4px;
}

.wizard-shipping-block {
  margin-top: 8px;
  padding: 16px;
  background: var(--soft-grey);
  border-radius: var(--box-radius);
}

/* Inputs sind global gleich eingefärbt wie der Block-Hintergrund
   (--soft-grey) - ohne diese Regel verschwinden die Felder optisch. */
.wizard-shipping-block input {
  background: var(--paper);
}

.wizard-subheading {
  margin: 0 0 14px;
  font-size: 16px;
}

/* ---- Zusammenfassung ---- */

.wizard-summary {
  display: grid;
  gap: 16px;
}

.wizard-summary-group h4 {
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 12px;
}

.wizard-summary-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  margin: 0;
}

.wizard-summary-dl dt {
  color: var(--muted);
  font-weight: 500;
}

.wizard-summary-dl dd {
  margin: 0;
}

/* Preis bewusst nicht als grosser/fetter Blickfang, sondern als ruhiger
   Abschluss der Produktgruppe - abgesetzt durch Abstand + Trennlinie statt
   durch Schriftgrösse/-gewicht. */
.wizard-summary-price {
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--mid-grey);
  font-weight: 500;
  color: var(--strong);
}

.wizard-summary-files {
  margin-top: 10px;
}

.wizard-summary-files-label {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.wizard-summary-files ul {
  margin: 0;
  padding-left: 18px;
}

.wizard-summary-files li {
  margin-bottom: 2px;
}

.wizard-summary-files-sublist {
  margin: 2px 0 6px;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

/* ---- Navigation ---- */

.wizard-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.wizard-nav .button {
  flex: 1 1 auto;
}

.wizard-nav #wizard-back {
  order: 2;
}

.wizard-nav #wizard-next,
.wizard-nav #wizard-submit {
  order: 1;
}

/* ---- Done / Confirmation ---- */

#wizard-done-message {
  font-size: 17px;
}

/* ---- Responsive ---- */

@media (min-width: 620px) {
  .wizard-choice-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .wizard-form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .wizard-nav {
    justify-content: flex-end;
  }

  .wizard-nav .button {
    flex: 0 0 auto;
    min-width: 160px;
  }

  .wizard-nav #wizard-back {
    order: 1;
    margin-right: auto;
  }

  .wizard-nav #wizard-next,
  .wizard-nav #wizard-submit {
    order: 2;
  }
}

@media (min-width: 900px) {
  .wizard-choice-grid[data-choice-group="category"] {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 619px) {
  .wizard-panel {
    border-radius: 0;
    margin: 0 -18px;
    padding: 24px 18px;
  }

  .wizard-progress li span:not(.wizard-progress-num) {
    display: none;
  }
}
