/* ============================================================
   SeaRendipity — Booking page (Phase 6)
   Modern seasonal rates table + booking CTA panel.
   Depends on tokens.css (+ base.css helpers, pages.css primitives).
   Linked only on booking.html.
   ============================================================ */

.booking-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  gap: clamp(1.5rem, 1rem + 3vw, 3rem);
  align-items: start;
}

/* ------------------------------ RATES TABLE ------------------------------ */
.rates-panel__intro {
  font-size: clamp(1.02rem, 0.96rem + 0.35vw, 1.15rem);
  color: var(--color-muted);
  margin: 0 0 var(--space-5);
  max-width: 60ch;
}
.rates-panel__intro strong { color: var(--color-teal-deep); }

.rates-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-line);
}
.rates-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-paper);
  font-size: var(--fs-body);
  min-width: 520px;
}
.rates-table thead th {
  background: linear-gradient(90deg, var(--color-teal-deep), var(--color-teal));
  color: #fff;
  font-family: var(--font-body);
  font-weight: var(--fw-semibold);
  text-align: left;
  padding: var(--space-4) var(--space-4);
  white-space: nowrap;
}
.rates-table tbody td {
  padding: var(--space-4) var(--space-4);
  border-top: 1px solid var(--color-line);
  color: var(--color-text);
}
.rates-table tbody tr:nth-child(even) { background: var(--color-sand-soft); }
.rates-table tbody tr:hover { background: rgba(0, 168, 198, 0.08); }
.rates-table td:first-child { font-weight: var(--fw-semibold); color: var(--color-heading); }
.rates-table .rate-amt { font-variant-numeric: tabular-nums; }

.rates-notes {
  margin: var(--space-5) 0 0;
  padding: 0;
  list-style: none;
  color: var(--color-muted);
  font-size: var(--fs-small);
}
.rates-notes li {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: var(--space-2);
}
.rates-notes li::before {
  content: "*";
  position: absolute;
  left: 0;
  color: var(--color-teal);
  font-weight: var(--fw-bold);
}

/* ------------------------------ BOOKING ASIDE ------------------------------ */
.booking-aside {
  position: sticky;
  top: calc(var(--header-h, 72px) + var(--space-4));
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.book-panel {
  background: var(--color-paper);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
}
.book-panel h2,
.book-panel h3 {
  font-family: var(--font-display);
  color: var(--color-heading);
  margin: 0 0 var(--space-3);
}
.book-panel h3 { font-size: var(--fs-h3); }
.book-panel__price {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.1rem);
  color: var(--color-teal-deep);
  font-weight: var(--fw-semibold);
  line-height: 1.1;
  margin: 0 0 var(--space-2);
}
.book-panel__price span {
  display: block;
  font-family: var(--font-body);
  font-size: var(--fs-small);
  font-weight: var(--fw-regular);
  color: var(--color-muted);
}
.book-panel__text {
  color: var(--color-muted);
  font-size: var(--fs-body);
  margin: 0 0 var(--space-5);
}
.book-panel__btns {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.book-panel__btns .book-btn,
.book-panel__btns .btn {
  width: 100%;
  text-align: center;
  justify-content: center;
}
.book-panel .weather-widget { display: block; }

@media (max-width: 860px) {
  .booking-layout { grid-template-columns: minmax(0, 1fr); }
  .rates-panel { min-width: 0; }
  .booking-aside { position: static; }
}

/* Narrow phones: the 5-column rates table can't fit at ~390px without
   overflowing the viewport, so collapse each row into a labeled card. */
@media (max-width: 560px) {
  .rates-table-wrap {
    overflow-x: visible;
    border: none;
    box-shadow: none;
    border-radius: 0;
  }
  .rates-table {
    min-width: 0;
    width: 100%;
  }
  .rates-table thead { display: none; }
  .rates-table tbody,
  .rates-table tr,
  .rates-table td { display: block; width: 100%; }
  .rates-table tr {
    background: var(--color-paper);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
  }
  .rates-table tbody tr:nth-child(even) { background: var(--color-paper); }
  .rates-table tbody tr:hover { background: var(--color-paper); }
  .rates-table td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-4);
    padding: var(--space-2) 0;
    border-top: 1px solid var(--color-line);
    text-align: right;
  }
  .rates-table td::before {
    content: attr(data-label);
    font-weight: var(--fw-semibold);
    color: var(--color-muted);
    text-align: left;
  }
  .rates-table td:first-child {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--color-heading);
    padding: 0 0 var(--space-3);
    border-top: none;
    display: block;
    text-align: left;
  }
  .rates-table td:first-child::before { content: none; }
}

/* ------------------------------ AVAILABILITY CALENDAR ------------------------------ */
.availability-section .page-section__lead { max-width: 68ch; }

.cal {
  background: var(--color-paper);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: clamp(1rem, 0.6rem + 1.5vw, 1.75rem);
  max-width: 620px;
}

/* Centered single-line state used for "Loading…" and the error fallback. */
.cal--msg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  text-align: center;
  color: var(--color-muted);
}
.cal__error a { color: var(--color-teal-deep); font-weight: var(--fw-semibold); }

.cal__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.cal__nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  flex: none;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  background: var(--color-paper);
  color: var(--color-teal-deep);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
}
.cal__nav:hover:not(:disabled) {
  background: var(--color-sand-soft);
  border-color: var(--color-teal);
}
.cal__nav:disabled { opacity: 0.35; cursor: default; }

.cal__selects { display: flex; gap: var(--space-2); }
.cal__select {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  color: var(--color-heading);
  background: var(--color-paper);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.55rem;
  cursor: pointer;
}

.cal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal__weekday {
  text-align: center;
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  color: var(--color-muted);
  padding: var(--space-2) 0;
}
.cal__day {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: var(--fs-body);
  font-variant-numeric: tabular-nums;
}
.cal__day--available {
  background: rgba(47, 174, 122, 0.14);
  color: var(--color-palm-deep);
}
.cal__day--blank { background: transparent; }
.cal__day--past { background: transparent; color: var(--color-line); }
.cal__day--booked {
  background: repeating-linear-gradient(
    -45deg,
    rgba(255, 111, 89, 0.22),
    rgba(255, 111, 89, 0.22) 4px,
    rgba(255, 111, 89, 0.42) 4px,
    rgba(255, 111, 89, 0.42) 8px
  );
  color: var(--color-coral-hover);
  text-decoration: line-through;
}
.cal__day--today {
  outline: 2px solid var(--color-teal);
  outline-offset: -2px;
  font-weight: var(--fw-bold);
}

.cal__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: var(--space-4);
  font-size: var(--fs-small);
  color: var(--color-muted);
}
.cal__legend-item { display: inline-flex; align-items: center; gap: var(--space-2); }
.cal__swatch {
  width: 1rem;
  height: 1rem;
  border-radius: 4px;
  border: 1px solid var(--color-line);
}
.cal__swatch--avail { background: rgba(47, 174, 122, 0.14); }
.cal__swatch--booked {
  background: repeating-linear-gradient(
    -45deg,
    rgba(255, 111, 89, 0.22),
    rgba(255, 111, 89, 0.22) 4px,
    rgba(255, 111, 89, 0.42) 4px,
    rgba(255, 111, 89, 0.42) 8px
  );
}

.cal__updated {
  margin: var(--space-3) 0 0;
  font-size: var(--fs-small);
  color: var(--color-muted);
}

@media (prefers-reduced-motion: reduce) {
  .cal__nav { transition: none; }
}
@media (max-width: 560px) {
  .cal { padding: var(--space-4); }
  .cal__day { font-size: var(--fs-small); }
  .cal__nav { width: 2.25rem; height: 2.25rem; }
}
