.reservation-map-scroll {
  overflow-x: hidden;
  display: flex;
  justify-content: center;
}

.reservation-map-stage {
  width: min(100%, 650px);
  min-width: 0;
  max-width: 650px;
  aspect-ratio: 420 / 661;
  margin-inline: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  background: transparent;
  box-shadow: none;
}

.reservation-map-image {
  object-fit: contain;
  background: transparent;
}

.reservation-map-button {
  /* EINE Statusfarbe fuer Rahmen UND Nummer: die Nummer erbt --map-state-color
     vom Button, dadurch sind Rahmen und Nummernring immer identisch.
     Farbe = Status (nicht Marke); die Marke ist ueber Foto + Name klar.
     Neutralgrau ist der Ausgangs-/Ladezustand. */
  --map-state-color: #6b7280;
  --map-state-rgb: 107, 114, 128;
  width: clamp(68px, 18%, 112px);
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1.42 / 1;
  padding: 3px;
  overflow: visible;
  border: 2px solid var(--map-state-color);
  border-radius: 11px;
  background: rgba(7, 11, 17, 0.82);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.24);
}

/* Prioritaet ueber Spezifitaet: belegt > ausgewaehlt > Reservierungen heute
   > verfuegbar. Jede Regel setzt nur die gemeinsame Farbvariable. */
.reservation-map-button.is-available {
  --map-state-color: #2faa4f;
  --map-state-rgb: 47, 170, 79;
}

.reservation-map-button.has-day-reservations:not(.is-reserved):not(.is-selected) {
  --map-state-color: #94a3b8;
  --map-state-rgb: 148, 163, 184;
}

.reservation-map-button.is-selected:not(.is-reserved) {
  --map-state-color: #f2b51d;
  --map-state-rgb: 242, 181, 29;
}

.reservation-map-button.is-reserved {
  --map-state-color: #e33a3a;
  --map-state-rgb: 227, 58, 58;
}

.reservation-map-button:hover,
.reservation-map-button:focus-visible {
  background: rgba(var(--map-state-rgb), 0.12);
  box-shadow: 0 0 0 3px rgba(var(--map-state-rgb), 0.16), 0 6px 16px rgba(0, 0, 0, 0.32);
}

.reservation-map-button.is-selected:not(.is-reserved),
.reservation-map-button.is-reserved {
  background: rgba(var(--map-state-rgb), 0.12);
  box-shadow: 0 0 0 3px rgba(var(--map-state-rgb), 0.2), 0 6px 18px rgba(0, 0, 0, 0.34);
}

.reservation-map-table-photo {
  position: absolute;
  inset: 4px;
  z-index: 0;
  width: calc(100% - 8px);
  height: calc(100% - 8px);
  border-radius: 8px;
  object-fit: contain;
  object-position: center;
  background: rgba(7, 11, 17, 0.92);
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 3px 7px rgba(0, 0, 0, 0.3));
  transition: transform 160ms ease, filter 160ms ease, opacity 160ms ease;
}

.reservation-map-button:hover .reservation-map-table-photo,
.reservation-map-button:focus-visible .reservation-map-table-photo,
.reservation-map-button.is-selected .reservation-map-table-photo {
  transform: scale(1.025);
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.4));
}

.reservation-map-button.is-reserved .reservation-map-table-photo {
  opacity: 0.7;
}

.reservation-map-number {
  position: absolute;
  left: -1.8rem;
  top: 50%;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  transform: translateY(-50%);
  /* Erbt --map-state-color vom Button -> Nummernring und Rahmen sind
     garantiert immer dieselbe (Status-)Farbe. */
  border: 2px solid var(--map-state-color);
  border-radius: 999px;
  background: rgba(7, 11, 17, 0.96);
  color: var(--map-state-color);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.34);
}

.reservation-map-button-label {
  top: calc(100% + 0.1rem);
  z-index: 5;
  max-width: 136px;
  text-align: center;
  white-space: normal;
}

.reservation-map-bookings {
  left: calc(100% + 0.34rem);
  top: 50%;
  bottom: auto;
  z-index: 5;
  gap: 0.18rem;
  max-width: 132px;
  transform: translateY(-50%);
}

.reservation-map-booking,
.reservation-map-booking-more {
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0.18rem 0.4rem;
  border-color: rgba(148, 163, 184, 0.72);
  background: rgba(71, 85, 105, 0.94);
  font-size: 0.62rem;
}

.reservation-map-booking.is-mine {
  background: rgba(54, 168, 82, 0.94);
  border-color: rgba(134, 239, 172, 0.92);
}

.reservation-map-legend .is-available i {
  background: #2faa4f;
}

.reservation-map-legend .is-reserved i {
  background: #e33a3a;
}

.reservation-map-legend .is-selected i {
  background: #f2b51d;
}

.reservation-map-legend .has-booking i {
  background: #94a3b8;
}

.reservation-map-selection {
  border-color: rgba(var(--theme-primary-rgb), 0.35);
  background: rgba(var(--theme-primary-rgb), 0.08);
}

.reservation-map-selection strong {
  color: var(--theme-primary);
}

@media (max-width: 820px) {
  .reservation-map-stage {
    width: 100%;
    max-width: 100%;
    border-radius: 16px;
  }

  .reservation-map-button {
    width: 19%;
    min-width: 52px;
    max-width: 82px;
    aspect-ratio: 1.42 / 1;
    border-radius: 9px;
  }

  .reservation-map-table-photo {
    inset: 3px;
    width: calc(100% - 6px);
    height: calc(100% - 6px);
    border-radius: 6px;
  }

  .reservation-map-number {
    left: -1.3rem;
    width: 1.18rem;
    height: 1.18rem;
    font-size: 0.58rem;
    border-width: 1px;
  }

  .reservation-map-button-label {
    max-width: 88px;
    font-size: 0.55rem;
  }

  .reservation-map-bookings {
    left: calc(100% + 0.22rem);
    max-width: 88px;
    gap: 0.1rem;
  }

  .reservation-map-booking,
  .reservation-map-booking-more {
    max-width: 88px;
    padding: 0.1rem 0.22rem;
    font-size: 0.5rem;
  }
}

@media (max-width: 430px) {
  .reservation-map-button {
    width: 18%;
    min-width: 46px;
    max-width: 66px;
  }

  .reservation-map-number {
    left: -1rem;
    width: 0.98rem;
    height: 0.98rem;
    font-size: 0.5rem;
  }

  .reservation-map-button-label {
    max-width: 72px;
    font-size: 0.48rem;
  }

  .reservation-map-bookings {
    left: calc(100% + 0.16rem);
    max-width: 72px;
  }

  .reservation-map-booking,
  .reservation-map-booking-more {
    max-width: 72px;
    font-size: 0.46rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reservation-map-table-photo {
    transition: none;
  }
}