/*
 * Buchungsportal - Kundenseite.
 *
 * Farbschema wie der Configurator (configurator/src/admin/admin.css):
 * Rot #b34e4e, Dunkelgrau #1e1e1e / #2c2c2c, Weiss. Kopf immer dunkel (dort
 * steht das helle Logo), Inhalt hell - bei dunklem System dunkel.
 *
 * Mobil zuerst: Die meisten Kunden oeffnen den Link aus WhatsApp heraus.
 * Keine externen Schriften (Datenschutz, siehe CSP in lib/bookingroutes.js).
 */

:root {
  --accent: #b34e4e;
  --accent-hover: #9e4242;
  --accent-text: #ffffff;
  --accent-soft: rgba(179, 78, 78, 0.1);
  --accent-ink: #a34444;
  --ink: #1e1e1e;
  --ink-2: #2c2c2c;

  --page: #f5f4f1;
  --surface: #ffffff;
  --surface-2: #f0efeb;
  --border: rgba(30, 30, 30, 0.12);
  --border-strong: rgba(30, 30, 30, 0.28);
  --text: #1e1e1e;
  --text-2: #4f4d49;
  --muted: #75736e;
  --good: #2c7a4b;
  --good-soft: rgba(44, 122, 75, 0.1);
  --warn: #9a6200;
  --warn-soft: rgba(250, 178, 25, 0.16);
  --error: #b42a2a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.05);

  --radius: 14px;
  --radius-sm: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #121211;
    --surface: #1c1c1b;
    --surface-2: #262625;
    --border: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.26);
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #8f8d87;
    --accent-soft: rgba(179, 78, 78, 0.2);
    --accent-ink: #e07c7c;
    --good: #4cbb78;
    --good-soft: rgba(76, 187, 120, 0.14);
    --warn: #f1b74a;
    --warn-soft: rgba(250, 178, 25, 0.14);
    --error: #ef6b6b;
    --shadow: none;
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Sonst schlaegt jedes "display: flex" das hidden-Attribut - das
   "Alles da"-Banner stand dann bei offenen Angaben auf der Seite. */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

/* --- Kopf ---------------------------------------------------------------- */

.top {
  background: var(--ink);
  color: #f0efec;
}

.top-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 16px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  height: 32px;
  width: auto;
}

.top-label {
  margin-left: auto;
  font-size: 0.85rem;
  color: #a9a79f;
  letter-spacing: 0.02em;
}

.hero {
  /* Dezentes Verlaufsband in Akzentrot - nimmt die Blende des Logos auf. */
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(179, 78, 78, 0.35) 0%, rgba(179, 78, 78, 0) 55%),
    var(--ink);
}

.hero-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 26px 16px 28px;
}

.hero-kicker {
  margin: 0 0 4px;
  color: #d9a3a3;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-weight: 750;
}

.hero-date {
  margin: 6px 0 0;
  color: #c3c2b7;
  font-size: 1.02rem;
}

.progress {
  margin-top: 22px;
}

.progress-text {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.92rem;
  color: #d8d6cf;
  margin-bottom: 8px;
}

.progress-text strong {
  color: #fff;
}

.progress-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.progress.done .progress-bar {
  background: #4cbb78;
}

/* --- Abschnittsleiste ---------------------------------------------------- */

.chips {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}

.chips:empty {
  display: none;
}

.chips-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chips-inner::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.88rem;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.chip .count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

.chip.complete .count {
  background: var(--good);
}

.chip svg {
  width: 12px;
  height: 12px;
}

/* --- Inhalt -------------------------------------------------------------- */

.main {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}

@media (min-width: 640px) {
  .card {
    padding: 24px 26px;
  }
}

.banner {
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid transparent;
}

.banner svg {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 1px;
}

.banner p {
  margin: 0;
}

.banner strong {
  display: block;
  margin-bottom: 2px;
}

.banner.good {
  background: var(--good-soft);
  border-color: color-mix(in srgb, var(--good) 35%, transparent);
}

.banner.good svg {
  color: var(--good);
}

.banner.locked {
  background: var(--surface-2);
  border-color: var(--border);
}

.banner.locked svg {
  color: var(--muted);
}

.banner.error {
  background: color-mix(in srgb, var(--error) 10%, transparent);
  border-color: color-mix(in srgb, var(--error) 40%, transparent);
}

/* Nachricht des Teams */
.message {
  margin: 0 0 18px;
  padding: 2px 0 2px 14px;
  border-left: 3px solid var(--accent);
  color: var(--text-2);
  white-space: pre-line;
}

/* Von uns festgelegt */
.fixed-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.fixed-head svg {
  width: 14px;
  height: 14px;
}

.fixed-grid {
  display: grid;
  gap: 14px 20px;
  grid-template-columns: 1fr;
  margin: 0;
}

@media (min-width: 560px) {
  .fixed-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.fixed-grid dt {
  font-size: 0.85rem;
  color: var(--muted);
}

.fixed-grid dd {
  margin: 2px 0 0;
  font-weight: 600;
}

.fixed-grid .price {
  font-size: 1.35rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.fixed-grid .details {
  font-weight: 450;
  color: var(--text-2);
  white-space: pre-line;
}

.fixed-grid .wide {
  grid-column: 1 / -1;
}

.tax-note {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 400;
}

/* --- Abschnitte ---------------------------------------------------------- */

.section-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.section-num {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
  transition: background 0.25s, color 0.25s;
}

.section-num svg {
  width: 16px;
  height: 16px;
}

.complete .section-num {
  background: var(--good);
  color: #fff;
}

.section-head h2 {
  margin: 2px 0 2px;
  font-size: 1.2rem;
  line-height: 1.25;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.proposal {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
  display: grid;
  gap: 4px;
  font-size: 0.95rem;
}

.proposal b {
  font-weight: 650;
}

.proposal .muted {
  color: var(--muted);
}

/* --- Felder -------------------------------------------------------------- */

.fields {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px 12px;
}

.field {
  grid-column: span 6;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field.w-narrow {
  grid-column: span 3;
}

@media (min-width: 640px) {
  .field.w-wide {
    grid-column: span 4;
  }

  .field.w-half {
    grid-column: span 3;
  }

  .field.w-narrow {
    grid-column: span 2;
  }
}

.field[hidden] {
  display: none;
}

.field-label {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-weight: 600;
  font-size: 0.95rem;
}

.tag-missing {
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  color: var(--accent-ink);
  background: var(--accent-soft);
  padding: 1px 7px;
  border-radius: 99px;
}

.tag-optional {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--muted);
}

.help {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.field-error {
  margin: 0;
  font-size: 0.85rem;
  color: var(--error);
  font-weight: 550;
}

.field-warn {
  margin: 0;
  font-size: 0.85rem;
  color: var(--warn);
  background: var(--warn-soft);
  border-radius: 8px;
  padding: 6px 10px;
}

.input {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 16px; /* unter 16px zoomt iOS beim Antippen */
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

.input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

.input:hover:not(:disabled) {
  border-color: var(--muted);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input.invalid {
  border-color: var(--error);
}

.input:disabled {
  background: var(--surface-2);
  color: var(--text-2);
}

textarea.input {
  min-height: 96px;
  resize: vertical;
  line-height: 1.45;
}

input[type="time"].input {
  min-width: 0;
}

/* Auswahlknoepfe */
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice {
  position: relative;
  min-height: 46px;
  padding: 10px 16px;
  border-radius: 99px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-weight: 550;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-align: left;
}

.choice:hover:not(:disabled) {
  border-color: var(--accent);
}

.choice:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
  border-color: var(--accent);
}

.choice[aria-checked="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.choice svg {
  width: 16px;
  height: 16px;
  display: none;
}

.choice[aria-checked="true"] svg {
  display: block;
}

.choice:disabled {
  cursor: default;
  opacity: 0.6;
}

.choice[aria-checked="true"]:disabled {
  opacity: 0.85;
}

/* Mustergalerie */
.samples {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (min-width: 640px) {
  .samples {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }
}

.sample {
  position: relative;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--surface-2);
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, transform 0.15s;
}

.sample:hover:not(:disabled) {
  border-color: var(--border-strong);
}

.sample:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.sample[aria-checked="true"] {
  border-color: var(--accent);
}

.sample-img {
  aspect-ratio: 3 / 2;
  width: 100%;
  /* height:auto ist Pflicht: das height-Attribut am img (gegen Layoutspruenge
     beim Laden) schlaegt sonst aspect-ratio und macht die Kachel hochkant. */
  height: auto;
  /* Ganzes Design zeigen, nichts abschneiden - der Kunde waehlt danach aus. */
  object-fit: contain;
  background: var(--surface-2);
}

.sample-label {
  padding: 8px 10px 9px;
  font-size: 0.88rem;
  font-weight: 550;
  background: var(--surface);
  line-height: 1.3;
}

.sample-check {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.sample-check svg {
  width: 16px;
  height: 16px;
}

.sample[aria-checked="true"] .sample-check {
  display: inline-flex;
}

.sample-zoom {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: rgba(20, 20, 20, 0.6);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
}

.sample-zoom svg {
  width: 18px;
  height: 18px;
}

.sample-advice {
  aspect-ratio: 3 / 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  text-align: center;
  padding: 10px;
}

.sample-advice svg {
  width: 28px;
  height: 28px;
}

.sample-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Dateien */
.files {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  min-width: 0;
}

.file-row svg {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--muted);
}

.file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 550;
  font-size: 0.93rem;
  color: var(--text);
  text-decoration: none;
}

.file-size {
  flex: none;
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.file-progress {
  flex: none;
  width: 70px;
  height: 6px;
  border-radius: 99px;
  background: var(--border);
  overflow: hidden;
}

.file-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
}

.icon-btn {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--border);
  color: var(--text);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  color: inherit;
}

.btn {
  min-height: 48px;
  padding: 11px 18px;
  border-radius: 99px;
  border: 1px dashed var(--border-strong);
  background: transparent;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text);
}

.btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* --- Speicheranzeige ----------------------------------------------------- */

.save-pill {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 99px;
  background: var(--ink-2);
  color: #f0efec;
  font-size: 0.9rem;
  font-weight: 550;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
  transition: opacity 0.3s;
}

.save-pill svg {
  width: 16px;
  height: 16px;
}

.save-pill.ok svg {
  color: #4cbb78;
}

.save-pill.error {
  background: var(--error);
}

.save-pill.fade {
  opacity: 0;
}

.spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- Grossansicht -------------------------------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 10, 10, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 12px 24px;
  gap: 14px;
}

.lightbox img {
  max-height: calc(100vh - 160px);
  max-width: min(100%, 1200px);
  border-radius: 8px;
  object-fit: contain;
  background: #2c2c2c;
}

.lightbox-close {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: 10px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close svg {
  width: 22px;
  height: 22px;
}

.lightbox-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  color: #f0efec;
}

.lightbox-select {
  min-height: 46px;
  padding: 10px 20px;
  border-radius: 99px;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-weight: 650;
  cursor: pointer;
}

.lightbox-select:disabled {
  opacity: 0.6;
}

/* --- Fuss ---------------------------------------------------------------- */

.foot {
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 16px calc(90px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.85rem;
}

.foot p {
  margin: 0 0 6px;
}

.foot a {
  color: var(--text-2);
}

/* --- Laden --------------------------------------------------------------- */

.skeleton {
  height: 180px;
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-line {
  margin: 0 0 10px;
  height: 1rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
}

.skeleton-short {
  width: 9rem;
}

.skeleton-title {
  width: 14rem;
  height: 2rem;
}

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.noscript {
  max-width: 760px;
  margin: 16px auto;
  padding: 0 16px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
