/* ── Room layouts of a trip with stops (booking/room_layouts.php) ──────────
   One card per room layout: a radio, the rooms as person icons, an info button
   with the room types per hotel, and the price difference on the right. The
   row's label is stretched over the card, so a click anywhere on it chooses the
   layout; the info button and its panel sit above that. */

.bw-layouts {
  /* "Inbegrepen" in green; --green-booking is too light for text. */
  --bw-layouts-included: #1e7a35;
  /* A hotel that gives other rooms than the layout. */
  --bw-layouts-note-bg: #fff6e0;
  --bw-layouts-note-text: #6a4a00;
}
.bw-layouts[hidden],
.bw-layouts [hidden],
.bw-layout-summary[hidden],
.bw-summary-val[hidden],
.bw-summary-layout [hidden] { display: none; }

.bw-layouts-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bw-layouts-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── One row card ── */
.bw-layout {
  position: relative;
  display: flex;
  align-items: stretch;
  font-size: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.bw-layout:has([data-bw-layout-info-btn][aria-expanded="true"]) {
  z-index: 10;
}
@media (hover: hover) {
  .bw-layout:not(.is-selected):hover {
    border-color: var(--purple-light);
    box-shadow: 0 2px 12px rgba(61, 31, 140, 0.08);
  }
}
.bw-layout.is-selected {
  border-color: var(--purple);
  box-shadow: 0 2px 16px rgba(61, 31, 140, 0.14);
}

.bw-layout-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.bw-layout-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-height: 58px;
  padding: 10px 12px 10px 16px;
  box-sizing: border-box;
}

.bw-layout-radio {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  background: var(--bg-card);
  cursor: pointer;
}
.bw-layout-radio:checked {
  border-color: var(--purple);
  background: var(--purple);
  box-shadow: inset 0 0 0 2.5px var(--bg-card);
}
.bw-layout-radio:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

.bw-layout-label {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  margin: 0;
  padding-left: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  /* The row shows the choice; a phone's tap flash would cover only the label's own box. */
  -webkit-tap-highlight-color: transparent;
}
.bw-layout-label::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
}
.bw-layout-title {
  position: relative;
  z-index: 2;
  flex: none;
  min-width: 72px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

/* The rooms of a layout: a box per room with a person icon per guest. */
.bw-layout-rooms {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.bw-layout-room {
  display: inline-flex;
  align-items: flex-end;
  gap: 1px;
  padding: 6px 8px 4px;
  border: 1.5px solid var(--purple-border);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--purple);
}
.bw-layout-plus {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  color: var(--purple);
}
.bw-layout-person { width: 20px; height: 20px; flex: none; }
.bw-layout-person--child { width: 15px; height: 15px; }

/* ── Room types per hotel ── */
/* The info area runs the height of the row's content and lies above the row's stretched label.
   The panel opens at its bottom, so the pointer goes from the round button into the panel
   without leaving the area, and the panel never covers the row's own rooms. As a flex item it
   takes a z-index without being positioned, so the row (or summary wrap) still places the panel. */
.bw-layout-info {
  flex: none;
  align-self: stretch;
  display: flex;
  align-items: center;
  z-index: 2;
}
.bw-layout-info:has(> [aria-expanded="true"]) { z-index: 20; }
.bw-layout-info-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--purple);
  cursor: pointer;
}
.bw-layout-info-btn:hover,
.bw-layout-info-btn[aria-expanded="true"] { background: rgba(61, 31, 140, 0.08); }
.bw-layout-info-btn:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: -2px;
}

/* Placed under its button by room-layouts.js (top, left, width, --bw-caret-x). */
.bw-layout-hotels {
  position: absolute;
  z-index: 20;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: 0 12px 32px rgba(26, 26, 24, 0.18);
  text-align: left;
  font-weight: 400;
  cursor: default;
}
.bw-layout-hotels::before {
  content: '';
  position: absolute;
  top: -7px;
  left: calc(var(--bw-caret-x, 36px) - 6px);
  width: 12px;
  height: 12px;
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  transform: rotate(45deg);
}
.bw-layout-hotels-title {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--purple);
}
.bw-layout-hotel-list,
.bw-layout-hotel-rooms {
  list-style: none;
  margin: 0;
  padding: 0;
}
.bw-layout-hotel {
  display: grid;
  grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
  gap: 12px;
  padding: 8px 0 0;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}
.bw-layout-hotel-head {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.bw-layout-hotel-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.bw-layout-hotel-stay {
  font-size: 12px;
  color: var(--text-secondary);
}
.bw-layout-hotel-rooms {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bw-layout-hotel-room {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--text-primary);
}
.bw-layout-hotel-room-name { overflow-wrap: anywhere; }
.bw-layout-people {
  display: inline-flex;
  align-items: flex-end;
  flex: none;
  color: var(--purple);
}
.bw-layout-people .bw-layout-person { width: 15px; height: 15px; }
.bw-layout-people .bw-layout-person--child { width: 11px; height: 11px; }

/* ── Price and note ── */
.bw-layout-price {
  position: relative;
  z-index: 2;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 136px;
  padding: 10px 16px;
  border-left: 1px solid var(--border);
  border-radius: 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0;
  background: var(--bg-secondary);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.bw-layout-price.is-cheaper { color: var(--bw-layouts-included); }
.bw-layout.is-selected .bw-layout-price {
  background: var(--purple);
  border-left-color: transparent;
  color: #fff;
}

.bw-layout-note {
  margin: -2px 12px 12px 44px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--bw-layouts-note-bg);
  color: var(--bw-layouts-note-text);
  font-size: 13px;
}
.bw-layout-note p { margin: 0; }

/* ── More layouts, boards, children ── */
.bw-layouts-more {
  align-self: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 20px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}
.bw-layouts-more:hover {
  border-color: var(--purple);
  color: var(--purple);
}
.bw-layouts-more:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

.bw-layouts-boards {
  padding: 12px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
}
.bw-layouts-boards-title {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.bw-layouts-board-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.bw-layouts-board {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  font-size: 14px;
  color: var(--text-primary);
}
.bw-layouts-board-icon { flex: none; color: var(--purple); }
.bw-layouts-board-price {
  margin-left: auto;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--bw-layouts-included);
}

.bw-layouts-children {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--text-secondary);
}
.bw-layouts-children a {
  font-weight: 600;
  color: var(--purple);
}

/* ── Chosen room layout in the Your choice summary ── */
.bw-summary-row--rooms {
  align-items: center;
}
.bw-summary-layout {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}
.bw-summary-layout-info {
  align-self: auto;
  margin: -4px -6px -4px 0;
}
.bw-summary-layout-info-btn {
  width: 28px;
  height: 28px;
}

/* ── The chosen layout beside the book buttons ── */
.bw-layout-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 18px 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.bw-layout-summary:hover {
  border-color: var(--purple);
  background: var(--purple-pale);
  color: var(--text-primary);
  text-decoration: none;
}
.bw-layout-summary:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}
.bw-layout-summary .bw-layout-rooms { gap: 4px; }
.bw-layout-summary .bw-layout-room {
  padding: 3px 4px 1px;
  border-radius: 7px;
}
.bw-layout-summary .bw-layout-person { width: 13px; height: 13px; }
.bw-layout-summary .bw-layout-person--child { width: 10px; height: 10px; }
.bw-layout-summary .bw-layout-plus { font-size: 13px; }
/* In the mobile overlay's book bar the chosen layout is one line of text. */
.bw-layout-summary--text {
  display: inline-block;
  margin: 2px 0 0;
  padding: 0;
  border: none;
  background: none;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 2px;
}
.bw-layout-summary--text:hover {
  background: none;
  color: var(--purple);
  text-decoration: underline;
  text-decoration-color: var(--purple);
}

/* Forced colors (Windows contrast themes) drop the backgrounds and shadows that draw the custom
   radio and the chosen row. Both fall back to what survives: the native radio and an outline. */
@media (forced-colors: active) {
  .bw-layout-radio {
    appearance: auto;
    -webkit-appearance: radio;
  }
  .bw-layout.is-selected {
    outline: 2px solid Highlight;
    outline-offset: -2px;
  }
}

@media (max-width: 640px) {
  .bw-layout-main {
    gap: 6px;
    min-height: 54px;
    padding: 10px 8px 10px 12px;
  }
  .bw-layout-radio { width: 16px; height: 16px; }
  .bw-layout-label {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding-left: 4px;
  }
  .bw-layout-title { min-width: 0; font-size: 14px; }
  .bw-layout-room { padding: 5px 5px 3px; border-radius: 8px; }
  .bw-layout-person { width: 15px; height: 15px; }
  .bw-layout-person--child { width: 11px; height: 11px; }
  .bw-layout-plus { font-size: 15px; }
  .bw-layout-price {
    min-width: 96px;
    padding: 10px 10px;
    font-size: 14px;
  }
  .bw-layout-note { margin: -2px 10px 10px 38px; font-size: 12px; }
  .bw-layout-hotel {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
  .bw-layouts-boards { padding: 12px 14px; }
  .bw-layouts-board { font-size: 14px; }
}
