/* ══════════════════════════════════════════════════════════════
   XXL ART — Room Preview (Live-Raumansicht)
   /room_preview/v1/css/room_preview.css

   Mobile-first, Breakpoint min-width 1024px.
   Alle Klassen mit Prefix .rp- — keine IDs, kollidiert nicht mit
   scaleBgZoom (#wrapper, #art …).
   Farben/Fonts aus css/tokens (colors.css, typography.css) —
   mit Fallbacks, falls die Tokens auf einer Seite fehlen.
   ══════════════════════════════════════════════════════════════ */

.rp {
  --rp-bg:        var(--color-bg, #f7f5f1);
  --rp-surface:   var(--color-surface, #fff);
  --rp-text:      var(--color-text, #1c1a17);
  --rp-muted:     var(--color-text-subtle, rgba(28, 26, 23, .55));
  --rp-line:      var(--color-border-strong, rgba(28, 26, 23, .12));
  --rp-gold:      var(--gold, #a8873a);
  --rp-dark:      var(--color-btn-inverse-bg, #1c1a17);
  --rp-dark-text: var(--color-btn-inverse-text, #f7f5f1);
  --rp-stage-bg:  var(--color-bg-deep, #efebe4);
  --rp-ease:      var(--ease, cubic-bezier(.16, 1, .3, 1));
  --rp-gap:       16px;

  box-sizing: border-box;
  font-family: var(--font-primary, "Inter", system-ui, sans-serif);
  color: var(--rp-text);
  background: var(--rp-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.rp[hidden],
.rp [hidden] { display: none !important; }

/* Layer */
.rp--layer {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 100000;
}

html.rp-lock,
html.rp-lock body { overflow: hidden; }

/* Seite (ohne Layer) */
.rp--page {
  position: relative;
  width: 100%;
}

/* ── Bausteine ─────────────────────────────────────────────── */
.rp-panel {
  background: var(--rp-surface);
  border: 1px solid var(--rp-line);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 8px 24px rgba(0, 0, 0, .08);
}

.rp-kicker {
  font-family: var(--font-display, "Antonio", "Arial Narrow", sans-serif);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 12px;
  color: var(--rp-muted);
}

.rp-btn {
  font-family: var(--font-display, "Antonio", "Arial Narrow", sans-serif);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--rp-text);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .2s ease, color .2s ease;
}

.rp-btn:hover { background: rgba(28, 26, 23, .06); }
.rp-btn.is-on { color: var(--rp-gold); }
.rp-btn:disabled { opacity: .4; cursor: default; }

.rp-btn-dark,
.rp-btn-dark:hover {
  background: var(--rp-dark);
  color: var(--rp-dark-text);
}
.rp-btn-dark:hover { color: var(--rp-gold); }

.rp-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: var(--rp-surface);
  color: var(--rp-text);
  cursor: pointer;
  transition: color .2s ease;
}
.rp-icon:hover,
.rp-icon.is-on { color: var(--rp-gold); }

.rp-btn:focus-visible,
.rp-icon:focus-visible,
.rp-chip:focus-visible,
.rp-thumb:focus-visible,
.rp-swatch:focus-visible {
  outline: 2px solid var(--rp-gold);
  outline-offset: 2px;
}

.rp-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.rp-scroll::-webkit-scrollbar { display: none; }

/* ── Kopf ──────────────────────────────────────────────────── */
.rp-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  background: var(--rp-surface);
  border-bottom: 1px solid var(--rp-line);
}

.rp-head .rp-panel { box-shadow: none; border: 0; }

.rp-head-help .rp-btn-text { display: none; }

.rp-head-spacer { width: 44px; }

.rp-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 0;
}

.rp-title-main {
  font-family: var(--font-display, "Antonio", "Arial Narrow", sans-serif);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: 18px;
  line-height: 1.2;
}

/* ── Bühne ─────────────────────────────────────────────────── */
.rp-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 260px;
  overflow: hidden;
  background: var(--rp-stage-bg);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: background-color .3s ease;
}

.rp--page .rp-stage {
  flex: 0 0 auto;
  height: 62vh;
  min-height: 300px;
  touch-action: pan-y;   /* Seite bleibt scrollbar — Bild ziehen geht trotzdem */
}

.rp-stage.is-zoomed { cursor: grab; }
.rp-stage.is-panning { cursor: grabbing; }
.rp-stage.is-calib-a4 { cursor: crosshair; }

.rp-world {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.rp-world.is-animated { transition: transform .35s var(--rp-ease); }

.rp-bg,
.rp-layer,
.rp-check {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.rp-check { opacity: .5; }

.rp-art {
  position: absolute;
  cursor: grab;
  touch-action: none;
  background: var(--color-placeholder, #ebe7e0);
}

.rp-stage.is-dragging-art .rp-art { cursor: grabbing; }

.rp-art-img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.rp-calib-rect {
  position: absolute;
  border: 2px dashed var(--rp-gold);
  background: rgba(168, 135, 58, .14);
  pointer-events: none;
}

.rp-stage.is-loading .rp-world { opacity: .6; transition: opacity .2s ease; }

/* Zoom */
.rp-zoom {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
}
.rp-zoom-line { height: 1px; background: var(--rp-line); }

/* Hilfe */
.rp-help {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  max-width: 320px;
  padding: 16px 18px;
  font-size: 14px;
  line-height: 1.55;
}
.rp-help p { margin: 6px 0 0; }

/* Kalibrieren — Handy: unten über dem Dock, damit die Bühne frei bleibt */
.rp-calib {
  position: fixed;
  z-index: 3;
  left: 12px;
  right: 12px;
  bottom: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rp-calib-text { margin: 0; font-size: 14px; line-height: 1.45; }
.rp-calib-actions { display: flex; gap: 8px; justify-content: flex-end; }

.rp-calib-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.rp-calib-tabs .rp-chip.is-on {
  background: var(--rp-dark);
  border-color: var(--rp-dark);
  color: var(--rp-dark-text);
}
.rp-calib-pane { display: flex; flex-direction: column; gap: 10px; }

/* Wandbreite: Regler + Zahlenfeld */
.rp-calib-width {
  display: flex;
  align-items: center;
  gap: 12px;
}
.rp-range {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  accent-color: var(--rp-gold);
  cursor: pointer;
}
.rp-calib-num {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}
.rp-calib-num input {
  width: 72px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--rp-line);
  border-radius: 0;
  background: var(--rp-surface);
  color: var(--rp-text);
  font: inherit;
  font-size: 16px;               /* iOS zoomt sonst beim Antippen */
  text-align: right;
}

/* Messlinie über die ganze Fotobreite (Stärke/Schrift setzt rp_stage.js gegen den Zoom) */
.rp-measure {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 2px dashed var(--rp-gold);
  pointer-events: none;
  text-align: center;
}
.rp-measure-label {
  display: inline-block;
  vertical-align: top;
  background: var(--rp-surface);
  color: var(--rp-text);
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}

/* Loader */
.rp-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.rp-spinner {
  display: block;
  width: 36px;
  height: 36px;
  border: 2px solid rgba(28, 26, 23, .15);
  border-top-color: var(--rp-gold);
  border-radius: 50%;
  animation: rp-spin .8s linear infinite;
}
@keyframes rp-spin { to { transform: rotate(360deg); } }

/* Toast */
.rp-toast {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  background: var(--color-glass-bg, rgba(28, 26, 23, .88));
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  pointer-events: none;
}

/* ── Steuerung (Dock) ─────────────────────────────────────── */
.rp-dock {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px var(--rp-gap) var(--rp-gap);
  background: var(--rp-bg);
}

/* Räume ein-/ausklappen */
.rp-rooms-toggle {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 14px;
  margin: 0 0 -4px;
  border-radius: 0;
  color: var(--rp-text);
  font-family: var(--font-display, "Antonio", "Arial Narrow", sans-serif);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
}
.rp-rooms-toggle:hover { color: var(--rp-gold); }
.rp-rooms-toggle:focus-visible { outline: 2px solid var(--rp-gold); outline-offset: 2px; }
.rp-rooms-toggle-icon { transition: transform .35s var(--rp-ease); }
.rp-dock.is-rooms-closed .rp-rooms-toggle-icon { transform: rotate(180deg); }

.rp-rooms {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  overflow: hidden;               /* für das Einklappen */
  transition: max-height .35s var(--rp-ease), opacity .25s ease;
}
.rp-dock.is-rooms-closed .rp-rooms { opacity: 0; }

.rp-chip {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 14px;
  margin: 0;
  border: 1px solid var(--rp-line);
  border-radius: 0;
  background: var(--rp-surface);
  color: var(--rp-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.rp-chip.is-on {
  background: var(--rp-dark);
  border-color: var(--rp-dark);
  color: var(--rp-dark-text);
}

.rp-chip-toggle {
  border-style: dashed;
  color: var(--rp-muted);
}
.rp-chip-toggle:hover { color: var(--rp-text); border-style: solid; }

/* Thumb-Streifen: Pfeile nur am Desktop (Handy wischt) */
.rp-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
}
.rp-strip-arrow { display: none; flex: 0 0 auto; }
.rp-strip-arrow:disabled { opacity: .35; cursor: default; }
.rp-strip-arrow:disabled:hover { color: var(--rp-text); }

.rp-thumbs {
  flex: 0 1 auto;
  min-width: 0;
  padding: 3px 2px;
}

.rp-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 96px;
  height: 64px;
  padding: 0;
  margin: 0;
  border: 2px solid transparent;
  border-radius: 0;
  background: var(--rp-stage-bg);
  overflow: hidden;
  cursor: pointer;
}
.rp-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.rp-thumb.is-on { border-color: var(--rp-gold); box-shadow: 0 0 0 2px var(--rp-surface); }

/* Farbkreis-Icon: Raum kann Wandfarbe (Thumb + Button an der Bühne) */
.rp-thumb-paint,
.rp-paint-dot {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .85);
  background: conic-gradient(#c96f4f, #d3a64a, #8fa585, #4f7f86, #4a5f85, #8c5a74, #c96f4f);
  pointer-events: none;
}
.rp-thumb-paint {
  position: absolute;
  right: 4px;
  top: 4px;
}

/* Wandfarbe-Button unter + / − */
.rp-paint-dot { box-shadow: 0 0 0 1px var(--rp-line); }
.rp-paint-btn.is-on .rp-paint-dot { box-shadow: 0 0 0 2px var(--rp-gold); }

/* "+ Foto" (Mein Raum) */
.rp-thumb-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px dashed var(--rp-line);
  background: var(--rp-surface);
  color: var(--rp-text);
  font-size: 12px;
}

/* "messen" — Foto noch nicht kalibriert */
.rp-thumb-badge {
  position: absolute;
  left: 4px;
  bottom: 4px;
  padding: 1px 6px;
  background: var(--rp-dark);
  color: var(--rp-dark-text);
  font-size: 10px;
  line-height: 1.5;
  pointer-events: none;
}

/* ── Leiste: Info + Aktionen + AR ──────────────────────────── */
.rp-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rp-info {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 46px;
  padding: 0 14px;
  white-space: nowrap;
  overflow: hidden;
}
.rp-size { font-size: 18px; }
.rp-info-line {
  flex: 0 0 auto;
  width: 1px;
  height: 22px;
  background: var(--rp-line);
}
.rp-room-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  color: var(--rp-muted);
}

.rp-actions {
  position: relative;            /* Anker für das Wandfarben-Popover */
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rp-actions-row {
  display: flex;
  flex-wrap: wrap;
}
.rp-actions-row .rp-btn { flex: 1 1 auto; }

.rp-colors {
  padding: 14px;
  max-height: 60vh;
  overflow-y: auto;
}
.rp-colors-grid { margin-top: 10px; }

.rp-colors-top {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.rp-swatch-orig,
.rp-swatch-custom {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 4px 10px;
  margin: 0;
  border: 1px solid var(--rp-line);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.rp-swatch-orig.is-on { border-color: var(--rp-gold); box-shadow: 0 0 0 1px var(--rp-gold); }
.rp-swatch-custom input {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}

.rp-colors-family + .rp-colors-family { margin-top: 10px; }
.rp-colors-family-name {
  display: block;
  margin-bottom: 5px;
  font-size: 11px;
  letter-spacing: .04em;
  opacity: .7;
}
.rp-colors-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  justify-items: center;
}
.rp-swatch {
  width: 100%;
  max-width: 40px;
  padding: 0;
  margin: 0;
  aspect-ratio: 1 / 1;
  border: 2px solid var(--rp-surface);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--rp-line);
  cursor: pointer;
}
@supports not (aspect-ratio: 1 / 1) {
  .rp-swatch { height: 30px; }
}
.rp-swatch.is-on { box-shadow: 0 0 0 2px var(--rp-gold); }

.rp-colors-current {
  display: block;
  margin-top: 12px;
  font-size: 13px;
  text-align: center;
}

/* Farbpunkt am Wandfarbe-Button */
.rp-btn.has-wall svg { color: var(--rp-wall-hex); }

.rp-ar { display: flex; justify-content: center; }

/* ── Desktop: alles schwebt über dem Raum (wie im Mockup) ── */
@media (min-width: 1024px) {

  /* Bühne füllt alles, Kopf + Dock schweben darüber */
  .rp--layer .rp-stage {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
  }

  .rp--page { height: min(86vh, 900px); }
  .rp--page .rp-stage {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    height: auto;
    touch-action: none;
  }

  .rp-head {
    position: absolute;
    top: 24px; left: 24px; right: 24px;
    z-index: 2;
    padding: 0;
    background: transparent;
    border: 0;
    align-items: flex-start;
    pointer-events: none;
  }
  .rp-head > * { pointer-events: auto; }
  .rp-head .rp-panel {
    border: 1px solid var(--rp-line);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 8px 24px rgba(0, 0, 0, .08);
  }
  .rp-head-help { padding: 0 18px; }
  .rp-head-help .rp-btn-text {
    display: inline;
    font-family: var(--font-display, "Antonio", "Arial Narrow", sans-serif);
    text-transform: uppercase;
    letter-spacing: .06em;
    font-size: 15px;
  }
  .rp-title { padding: 10px 22px; }
  .rp-title-main { font-size: 22px; }

  .rp-zoom { right: 24px; }

  .rp-help {
    top: 88px;
    left: 24px;
    right: auto;
    width: 320px;
  }

  .rp-calib {
    position: absolute;
    left: 50%;
    right: auto;
    bottom: auto;
    top: 96px;
    transform: translateX(-50%);
    width: 520px;
  }

  .rp-toast { bottom: 240px; }

  .rp-dock {
    position: absolute;
    left: 24px; right: 24px; bottom: 24px;
    z-index: 2;
    padding: 0;
    background: transparent;
    align-items: center;
    pointer-events: none;
  }
  .rp-dock > * { pointer-events: auto; max-width: 100%; }

  /* Raum-Block: volle Breite, aber nur Tabs/Thumbs fangen Klicks — daneben bleibt das Bild ziehbar */
  .rp-rooms {
    width: 100%;
    align-items: center;
    pointer-events: none;
  }
  .rp-rooms > * { pointer-events: auto; max-width: 100%; }

  .rp-thumb { width: 118px; height: 76px; }

  .rp-strip.has-overflow .rp-strip-arrow { display: inline-flex; }

  .rp-bar {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: nowrap;
    gap: 16px;
  }
  .rp-info { flex: 0 1 auto; min-width: 0; min-height: 52px; padding: 0 18px; gap: 18px; }
  .rp-size { font-size: 20px; }

  .rp-actions {
    flex: 0 0 auto;
    flex-direction: row;
    align-items: stretch;
    gap: 12px;
  }
  .rp-actions-row { flex-wrap: nowrap; }
  .rp-actions-row .rp-btn { flex: 0 0 auto; }

  /* AR-Button (buttons.css .button_ar) neben den Aktionen, gleiche Höhe */
  .rp-ar { flex: 0 0 auto; }
  .rp-ar .button_ar {
    width: auto;
    height: 100%;
    margin: 0;
    padding: 4px 22px 4px 12px;
    white-space: nowrap;
  }
  .rp-ar .button_ar > svg { width: 32px; height: 32px; }

  .rp-colors {
    position: absolute;
    right: 60px;                 /* lässt die Zoom-Spalte (+ / − / Farbkreis) frei */
    bottom: calc(100% + 12px);
    width: 300px;
    max-height: calc(100vh - 360px);
  }
}
