/**
 * Fotobox — extends Konfigurator shell (.kfg)
 */

.fbx {
  grid-template-columns: var(--sidebar-w, 380px) 1fr;
  align-items: start;
}

.fbx__side {
  grid-row: 1 / 2;
  height: auto;
  max-height: calc(100vh - 96px);
  position: sticky;
  top: calc(72px + 0.85rem);
  padding-bottom: 2rem;
  mask-image: none;
  -webkit-mask-image: none;
}

.fbx__hint {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text3, var(--ff-gray));
}

.fbx__capture-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.fbx__capture-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 120px;
  padding: 14px 10px;
  border: 1.5px dashed var(--border, var(--ff-line));
  border-radius: 14px;
  background: var(--card-inner, var(--ff-soft));
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
  overflow: hidden;
}

.fbx__capture-card:hover {
  border-color: rgba(0,0,0,.22);
  background: #fff;
}

.fbx__capture-card.has-photo {
  border-style: solid;
  border-color: var(--accent, var(--ff-ink));
  background: #fff;
}

.fbx__capture-icon {
  font-size: 28px;
  color: var(--text3, var(--ff-gray));
}

.fbx__capture-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text, var(--ff-ink));
}

.fbx__capture-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fbx__capture-card.has-photo .fbx__capture-icon,
.fbx__capture-card.has-photo .fbx__capture-label {
  opacity: 0;
}

.fbx__collage-preview {
  display: none !important; /* internal Gemini input — never show in UI */
}

.fbx__btn-block {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.fbx__btn-icon { flex: 0 0 auto; display: block; }
.fbx__btn-block:disabled { opacity: 0.55; cursor: not-allowed; }
.fbx__limit {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text2, var(--ff-gray));
}
.fbx__limit.is-leer { color: #b45309; font-weight: 600; }
.fbx__topf { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }

.fbx__wheel-summary {
  margin-top: 0;
}

.fbx__status {
  min-height: 1.2em;
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--text2, var(--ff-gray));
}

.fbx__status.is-error { color: #dc2626; }
.fbx__status.is-ok { color: #1b8a3a; }

.fbx__gallery-card {
  grid-column: 2;
  grid-row: 1;
  padding: 1.25rem 1.35rem 1.5rem;
  min-height: calc(100vh - 120px);
}

.fbx__gallery-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 1rem;
}

.fbx__gallery-title {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.fbx__gallery-sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text3, var(--ff-gray));
}

.fbx__gallery-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text3, var(--ff-gray));
  background: var(--card-inner, var(--ff-soft));
  border-radius: 999px;
  padding: 6px 10px;
}

.fbx__masonry {
  columns: 3 220px;
  column-gap: 12px;
}

.fbx__tile {
  break-inside: avoid;
  margin: 0 0 12px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--card-inner, #f5f5f4);
  border: 1px solid var(--border, var(--ff-line));
  position: relative;
}

.fbx__tile img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 16;
  object-fit: cover;
}

.fbx__tile.is-preview::after {
  content: 'Vorschau';
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(17,17,17,.65);
  border-radius: 999px;
  padding: 4px 8px;
}

.fbx__tile.is-loading {
  min-height: 280px;
  display: grid;
  place-items: center;
}

.fbx__tile.is-loading::before {
  content: '';
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent, var(--ff-ink));
  border-radius: 50%;
  animation: kfg-spin .7s linear infinite;
}

.fbx__tile-label {
  position: absolute;
  left: 10px;
  bottom: 10px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: rgba(17,17,17,.55);
  border-radius: 8px;
  padding: 4px 8px;
}

@media (max-width: 1024px) {
  .fbx__series-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: min(38vh, 360px);
  }
  .fbx {
    grid-template-columns: 1fr;
  }
  .fbx__side {
    position: static;
    max-height: none;
    grid-row: auto;
  }
  .fbx__gallery-card {
    grid-column: 1;
  }
  .fbx__masonry {
    columns: 2 160px;
  }
}

@media (max-width: 560px) {
  .fbx__capture-grid {
    grid-template-columns: 1fr;
  }
  .fbx__masonry {
    columns: 1;
  }
}

/* ── Felgenauswahl ─────────────────────────────────── */
.fbx__wheel-search {
  width: 100%;
  margin-bottom: 10px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border, var(--ff-line));
  border-radius: 10px;
  font-size: 13px;
  background: #fff;
}
/* Modell: bisheriges Kachel-Grid */
.fbx__series-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  max-height: min(46vh, 440px);
  overflow: auto;
  padding: 2px;
  scrollbar-width: thin;
}
.fbx__series-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 3px 6px;
  border: 1.5px solid var(--border, var(--ff-line));
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.fbx__series-card:hover { border-color: rgba(0, 0, 0, .2); }
.fbx__series-card.is-active {
  border-color: var(--accent, var(--ff-ink));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #111) 12%, transparent);
}
.fbx__series-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
}
.fbx__series-name {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--text, var(--ff-ink));
}
.fbx__series-fallback {
  font-size: 11px;
  font-weight: 700;
  padding: 1rem 0;
}

/* Farbe: Listen-Zeilen wie Summary (nicht Swatches) */
.fbx__color-swatches {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(36vh, 320px);
  overflow: auto;
  padding: 2px;
  scrollbar-width: thin;
}
.fbx__color-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1.5px solid var(--border, var(--ff-line));
  border-radius: 12px;
  background: var(--card-inner, #f3f3f1);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.fbx__color-option:hover {
  border-color: rgba(0, 0, 0, .22);
  background: #fff;
}
.fbx__color-option.is-active {
  border-color: var(--accent, var(--ff-ink));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #111) 14%, transparent);
  background: #fff;
}
.fbx__color-option img,
.fbx__pick-thumb {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
  border-radius: 8px;
  background: #fff;
}
.fbx__pick-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fbx__pick-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text, var(--ff-ink));
  line-height: 1.2;
}
.fbx__pick-meta {
  font-size: 12px;
  font-weight: 500;
  color: var(--text3, var(--ff-gray));
  line-height: 1.3;
}
.fbx__color-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-top: 12px;
}
.fbx__color-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text3, var(--ff-gray));
}
/* Summary below stays as confirmation; tighten spacing when list is active */
.fbx__wheel-summary {
  margin-top: 12px;
}

/* ── Galerie: Querformat-Paneele untereinander ─────── */
.fbx__hero {
  display: flex;
  justify-content: stretch;
  padding: 0.5rem 0 1rem;
}
.fbx__hero-stack {
  width: 100%;
  max-width: 100%;
}
.fbx__hero-stack .fbx__tile {
  margin: 0;
  border: none;
  background: transparent;
}
.fbx__hero-stack .fbx__tile > img {
  width: 100%;
  height: auto;
  aspect-ratio: auto;
  object-fit: contain;
  border-radius: 14px;
  border: 1px solid var(--border, var(--ff-line));
}
.fbx__tile.is-preview,
.fbx__tile.is-result-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: transparent;
  padding: 0;
  border: none;
}
.fbx__preview-panel {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: var(--card-inner, #f5f5f4);
}
.fbx__preview-panel img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.fbx__preview-panel-label {
  position: absolute;
  left: 8px;
  bottom: 8px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: rgba(17,17,17,.55);
  border-radius: 6px;
  padding: 3px 7px;
}

/* === dark mode fotobox === */
html[data-theme="dark"] .fbx__wheel-search {
  background: var(--ff-soft, var(--card-inner, #232326));
  color: var(--ff-ink, var(--text, #f4f4f2));
  border-color: var(--ff-line, var(--border, #2b2b2e));
}
html[data-theme="dark"] .fbx__wheel-search::placeholder {
  color: var(--ff-gray, #9b9ba1);
}
html[data-theme="dark"] .fbx__series-card {
  background: var(--ff-soft, var(--card-inner, #232326));
  border-color: var(--ff-line, var(--border, #2b2b2e));
}
html[data-theme="dark"] .fbx__series-card:hover {
  border-color: color-mix(in srgb, var(--ff-ink, #fff) 22%, var(--ff-line, #2b2b2e));
}
html[data-theme="dark"] .fbx__series-name {
  color: var(--ff-ink, var(--text, #f4f4f2));
}
html[data-theme="dark"] .fbx__series-card.is-active {
  border-color: var(--ff-accent, var(--accent, #e8941a));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ff-accent, #e8941a) 22%, transparent);
}

/* ── Einwilligung (Google / Nano Banana) ── eigene Box statt Browser-Checkbox */
.fbx__einwilligung {
  position: relative; display: flex; align-items: flex-start; gap: 10px;
  margin: 0 0 14px; padding: 12px 14px; border-radius: 12px;
  background: var(--bg, #f5f5f7); border: 1px solid var(--border, #e5e5ea);
  font-size: 12px; line-height: 1.45; color: var(--text3, #6e6e73); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.fbx__einwilligung input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.fbx__einwilligung-box {
  flex: 0 0 18px; width: 18px; height: 18px; margin-top: 1px; border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border: 1.5px solid rgba(0, 0, 0, .25); color: transparent;
  transition: background .15s, border-color .15s, color .15s;
}
.fbx__einwilligung:hover { border-color: rgba(0, 0, 0, .2); }
.fbx__einwilligung input:checked ~ .fbx__einwilligung-box { background: var(--text, #1d1d1f); border-color: var(--text, #1d1d1f); color: #fff; }
.fbx__einwilligung:has(input:checked) { border-color: var(--text, #1d1d1f); background: #fff; }
.fbx__einwilligung input:focus-visible ~ .fbx__einwilligung-box { outline: 2px solid #8A6508; outline-offset: 2px; }
.fbx__einwilligung-text a { color: var(--text, #1d1d1f); font-weight: 600; text-underline-offset: 2px; }

/* ── KI-Kennzeichnung auf dem Ergebnis, wie im Konfigurator ── */
.fbx__hero { position: relative; }
.fbx__ai { position: absolute; top: 12px; right: 12px; z-index: 5; }
.fbx__ai .ff-bhw__knopf {
  opacity: 1; height: 22px; color: #1d1d1f; border-color: rgba(0, 0, 0, .12);
  background: rgba(255, 255, 255, .88); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.fbx__ai .ff-bhw__box { left: auto; right: 0; }

/* ── Download des fertigen Bildes ── */
.fbx__gallery-aktionen { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.fbx__download {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px;
  border-radius: 999px; background: var(--text, #1d1d1f); color: #fff;
  font-size: 12px; font-weight: 600; text-decoration: none; transition: opacity .15s;
}
.fbx__download:hover { opacity: .85; color: #fff; }
.fbx__download:focus-visible { outline: 2px solid #8A6508; outline-offset: 2px; }
.fbx__download[hidden] { display: none; }
