/*
 * Responsive additions for the production bundle supplied with this project.
 * Kept separate from the hashed stylesheet so the original build stays intact.
 */

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  overflow-x: hidden;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

/*
 * iPad layout:
 * 1. Choose Sport spans the top row.
 * 2. Select Date & Time and 3. Review & Confirm share the row below.
 * The second query also covers the wider iPad Pro in landscape without
 * changing the desktop layout on non-touch laptops.
 */
@media (min-width: 768px) and (max-width: 1180px),
  (min-width: 1181px) and (max-width: 1366px) and (pointer: coarse) {
  .container.py-4 {
    width: calc(100% - 2rem);
    max-width: 1080px;
    padding-top: 1.5rem !important;
    padding-bottom: 2rem !important;
  }

  .booking-heading {
    margin-bottom: 1.1rem;
    font-size: clamp(1.45rem, 2.8vw, 2rem);
    line-height: 1.2;
  }

  .booking-grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(270px, 0.85fr);
    grid-template-areas:
      "sport sport"
      "calendar summary";
    gap: 1rem;
  }

  .booking-grid__sport .booking-panel,
  .booking-grid__calendar .booking-panel,
  .booking-grid__summary .booking-panel {
    width: 100%;
    max-width: none;
    height: 100%;
    margin: 0;
  }

  .booking-panel {
    padding: 1rem;
  }

  .booking-panel__title {
    min-height: 28px;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
  }

  .booking-panel__step {
    width: 26px;
    height: 26px;
    font-size: 0.78rem;
  }

  .booking-panel__selection {
    max-width: 48%;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.75rem;
  }

  .sport-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
    margin: 0;
    border: 0;
    overflow: visible;
  }

  .sport-card {
    min-height: 82px;
    padding: 0.75rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    flex-direction: column;
    justify-content: center;
    gap: 0.35rem;
    text-align: center;
  }

  .sport-card.is-selected {
    box-shadow: inset 0 3px 0 var(--color-primary);
  }

  .sport-card__icon {
    font-size: 1.45rem;
  }

  .sport-card__name {
    font-size: 0.86rem;
  }

  .sport-card__court {
    display: none;
  }

  .date-selector {
    max-width: 100%;
  }

  .calendar-header {
    margin-bottom: 0.55rem;
  }

  .calendar-header__label {
    font-size: 0.9rem;
  }

  .calendar-nav-btn {
    width: 36px;
    height: 36px;
  }

  .calendar-weekdays,
  .calendar-grid {
    gap: 0.3rem;
  }

  .calendar-day,
  .calendar-grid--week .calendar-day {
    width: 38px;
    height: 38px;
    font-size: 0.82rem;
  }

  .slot-panel {
    padding: 0.75rem;
  }

  .slot-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.55rem;
  }

  .time-slot {
    min-height: 40px;
    padding: 0.55rem 0.35rem;
    font-size: 0.75rem;
  }

  .slot-legend {
    gap: 0.8rem;
    font-size: 0.75rem;
  }

  .slot-legend__off-days-btn {
    min-height: 36px;
  }

  .booking-grid__summary .booking-panel {
    min-height: 100%;
  }

  .summary-empty {
    padding: 1rem 0.35rem;
    font-size: 0.84rem;
    line-height: 1.5;
  }

  .continue-payment-btn {
    min-height: 44px;
  }
}

/* Wider iPads can comfortably show five slots per row. */
@media (min-width: 940px) and (max-width: 1180px),
  (min-width: 1181px) and (max-width: 1366px) and (pointer: coarse) {
  .slot-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

/* Phones and narrow split-screen views */
@media (max-width: 767.98px) {
  .container.py-4 {
    width: 100%;
    padding: 1.15rem 0.85rem 1.75rem !important;
  }

  .booking-grid {
    gap: 0.85rem;
  }

  .booking-panel {
    padding: 0.85rem;
  }

  .slot-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .time-slot {
    min-height: 38px;
    white-space: normal;
    font-size: 0.7rem;
  }
}

@media (max-width: 420px) {
  .slot-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (orientation: landscape) and (min-width: 768px) and (max-width: 1180px),
  (orientation: landscape) and (min-width: 1181px) and (max-width: 1366px) and (pointer: coarse) {
  .container.py-4 {
    width: calc(100% - 3rem);
  }

  .booking-grid {
    grid-template-columns: minmax(0, 1.6fr) minmax(290px, 0.8fr);
  }
}
