/*
 * responsive.css — Shared mobile-first layer for the sports, booking and event pages.
 * Load after home.css / page styles. Reuses home.css tokens (--primary-pink, --bg-white, …)
 * and its breakpoints (480 / 860 / 1024); new components are written mobile-first with
 * min-width 600 / 900 / 1200.
 *
 * !important appears only where it has to beat home.css (which is !important throughout)
 * or inline styles in existing markup.
 */

:root {
  --cc-gutter: 16px;
  --cc-tap: 44px;
  --cc-accent: var(--primary-pink, #ef5b44);
  --cc-accent-strong: #c73a24;   /* 5.2:1 on white — buttons and small text (WCAG AA) */
  --cc-accent-soft: #fff1ee;
  --cc-ink: #0f172a;
  --cc-muted: #475569;           /* 7.6:1 on white */
  --cc-line: #cbd5e1;
  /* Fixed white: the cards these components sit in stay light in both themes (a themed surface
     turned slot pills near-black with dark text in dark mode). */
  --cc-surface: #ffffff;
  --cc-focus: #2563eb;
  --cc-safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── Accessibility ─────────────────────────────────────────────────────── */
:focus-visible {
  outline: 3px solid var(--cc-focus) !important;
  outline-offset: 2px !important;
}

.cc-visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Layout safety ─────────────────────────────────────────────────────── */
html, body { max-width: 100%; }
img, video, iframe { max-width: 100%; }

@media (max-width: 600px) {
  .navbar, header.navbar {
    position: sticky !important;
    top: 0 !important;
  }

  .event-grid,
  .event-main,
  .chat-container,
  .chat-body,
  .chat-input-area {
    min-width: 0;
    max-width: 100%;
  }

  .chat-messages {
    max-height: min(220px, 32vh);
    overflow-x: hidden;
    overscroll-behavior: contain;
  }

  .message,
  .message-text {
    min-width: 0;
    max-width: 100%;
  }

  .message-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .chat-input {
    box-sizing: border-box;
    min-width: 0;
    max-height: 96px;
    overflow-y: auto;
    resize: none;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
}

/* 16px text in form controls stops iOS Safari zooming on focus. */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
select,
textarea {
  font-size: 16px !important;
}

/* ── Shared header (home.css .navbar) ──────────────────────────────────── */
.navbar .theme-toggle,
.navbar .hamburger,
.navbar .search-btn {
  min-width: var(--cc-tap) !important;
  min-height: var(--cc-tap) !important;
  display: inline-flex;
  align-items: center !important;
  justify-content: center !important;
}
.navbar .theme-toggle { display: none !important; }
.navbar .logo { min-height: var(--cc-tap) !important; }
.mobile-menu .mobile-nav-links a {
  min-height: var(--cc-tap);
  display: flex !important;
  align-items: center;
}
/* 861–1180px: links + location + auth buttons overflowed by ~40px at 1024px. */
@media (min-width: 861px) and (max-width: 1180px) {
  .navbar .location-picker { display: none !important; }
  .navbar .nav-links { gap: 18px !important; }
}

/* ── Bottom sheet modal (CCSheet) ──────────────────────────────────────── */
html.cc-scroll-locked,
html.cc-scroll-locked body {
  overflow: hidden !important;
  overscroll-behavior: none;
}

.cc-sheet {
  position: fixed !important;
  inset: 0 !important;
  z-index: 100000 !important;
  display: none !important;
  align-items: flex-end !important;
  justify-content: center !important;
  padding: 0 !important;
  background: rgba(15, 23, 42, 0.62) !important;
}
.cc-sheet.is-open { display: flex !important; }
/* style.css scales .share-modal-content up only for inline display:flex; sheets use a class. */
.cc-sheet.is-open .cc-sheet-panel { transform: none; }

/* Mobile: full-height sheet sliding up from the bottom. */
.cc-sheet .cc-sheet-panel {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: none !important;
  height: calc(100dvh - 12px) !important;
  max-height: none !important;
  margin: 0 !important;
  border-radius: 20px 20px 0 0 !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(24px + var(--cc-safe-bottom)) !important;
  animation: ccSheetUp 0.22s ease-out;
}
.cc-sheet .cc-sheet-panel::before {
  content: "";
  display: block;
  width: 40px; height: 4px;
  margin: -8px auto 16px;
  border-radius: 4px;
  background: var(--cc-line);
}
.cc-sheet-close {
  min-width: var(--cc-tap) !important;
  min-height: var(--cc-tap) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}
@keyframes ccSheetUp {
  from { transform: translateY(24px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

@media (min-width: 600px) {
  .cc-sheet { align-items: center !important; padding: 16px !important; }
  .cc-sheet .cc-sheet-panel {
    width: 100% !important;
    max-width: 480px !important;
    height: auto !important;
    max-height: 90vh !important;
    border-radius: 24px !important;
    padding-bottom: 28px !important;
  }
  .cc-sheet .cc-sheet-panel::before { display: none; }
}

/* ── Sticky bottom CTA bar (mobile) ────────────────────────────────────── */
.cc-sticky-cta {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 950;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px var(--cc-gutter) calc(10px + var(--cc-safe-bottom));
  background: var(--cc-surface);
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.10);
  transition: transform 0.2s ease;
}
.cc-sticky-cta.is-hidden { transform: translateY(110%); }
.cc-sticky-cta__info { flex: 1 1 auto; min-width: 0; }
.cc-sticky-cta__price { font-weight: 800; font-size: 1.05rem; color: var(--cc-ink); }
.cc-sticky-cta__sub {
  font-size: 0.8rem; color: var(--cc-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cc-sticky-cta__btn {
  flex: 0 0 auto;
  min-height: 48px;
  min-width: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  background: var(--cc-accent-strong);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.cc-sticky-cta__btn:disabled { background: #e2e8f0; color: var(--cc-muted); cursor: not-allowed; }
body.has-cc-sticky-cta { padding-bottom: calc(76px + var(--cc-safe-bottom)) !important; }
[data-theme="dark"] .cc-sticky-cta { background: #121212; border-top-color: #2d2d2d; }
[data-theme="dark"] .cc-sticky-cta__price { color: #f0f0f0; }
[data-theme="dark"] .cc-sticky-cta__sub { color: #cbd5e1; }

@media (min-width: 900px) {
  .cc-sticky-cta { display: none !important; }
  body.has-cc-sticky-cta { padding-bottom: 0 !important; }
}

/* ── Slot picker: scrollable date strip + wrapping slot pills ──────────── */
.cc-slot-picker { display: flex; flex-direction: column; gap: 12px; }
.cc-slot-picker__title { font-size: 1rem; font-weight: 800; margin: 0; color: var(--cc-ink); }

.cc-date-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding: 2px 2px 8px;
  margin: 0 -2px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.cc-date-chip {
  flex: 0 0 auto;
  scroll-snap-align: start;
  min-width: 68px;
  min-height: 60px;
  padding: 6px 10px;
  border: 1px solid var(--cc-line);
  border-radius: 12px;
  background: var(--cc-surface);
  color: var(--cc-ink);
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
}
.cc-date-chip__day { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.cc-date-chip__date { font-size: 0.95rem; font-weight: 800; }
.cc-date-chip__count { font-size: 0.7rem; color: var(--cc-muted); }
.cc-date-chip[aria-pressed="true"] { background: var(--cc-ink); border-color: var(--cc-ink); color: #fff; }
.cc-date-chip[aria-pressed="true"] .cc-date-chip__count { color: #e2e8f0; }
.cc-date-chip.is-empty .cc-date-chip__count { font-style: italic; }

.cc-slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(98px, 1fr));
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.cc-slot-pill {
  box-sizing: border-box;
  min-height: 52px;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--cc-line);
  border-radius: 10px;
  background: var(--cc-surface);
  color: var(--cc-ink);
  font: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
}
.cc-slot-pill__time { font-weight: 800; font-size: 0.95rem; }
.cc-slot-pill__meta { font-size: 0.72rem; color: var(--cc-muted); }
a.cc-slot-pill:hover { border-color: var(--cc-accent-strong); }
.cc-slot-pill.is-selected {
  border: 2px solid var(--cc-accent-strong);
  background: var(--cc-accent-soft);
}
.cc-slot-pill.is-selected .cc-slot-pill__meta { color: var(--cc-accent-strong); font-weight: 700; }
.cc-slot-pill.is-disabled {
  cursor: not-allowed;
  color: #64748b;
  border-style: dashed;
  background: repeating-linear-gradient(135deg, #f8fafc 0 6px, #eef2f6 6px 12px);
}
.cc-slot-pill.is-disabled .cc-slot-pill__time { text-decoration: line-through; }
.cc-slot-pill.is-disabled .cc-slot-pill__meta { color: #475569; font-weight: 700; }
.cc-slot-empty { font-size: 0.9rem; color: var(--cc-muted); padding: 8px 0; }

/* Spots stepper */
.cc-stepper { display: inline-flex; align-items: center; gap: 8px; }
.cc-stepper button {
  width: var(--cc-tap); height: var(--cc-tap);
  border-radius: 10px;
  border: 1px solid var(--cc-line);
  background: var(--cc-surface);
  color: var(--cc-ink);
  font-size: 1.2rem; font-weight: 700;
  cursor: pointer;
}
.cc-stepper button:disabled { color: #94a3b8; cursor: not-allowed; }
.cc-stepper output { min-width: 2ch; text-align: center; font-weight: 800; font-size: 1.1rem; }

/* ── Tables → stacked cards below 900px (add class="cc-stack") ─────────── */
/* Scoped with max-width so existing desktop table styles stay untouched. */
@media (max-width: 899px) {
  table.cc-stack { width: 100%; border-collapse: collapse; }
  table.cc-stack thead {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip: rect(0 0 0 0);
  }
  table.cc-stack, table.cc-stack tbody, table.cc-stack tr, table.cc-stack td { display: block; }
  table.cc-stack tr {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 6px 14px;
    margin-bottom: 12px;
    background: var(--cc-surface);
  }
  /* Label floats left; the cell's own content (one or several lines) stays right-aligned beside it. */
  table.cc-stack td {
    display: block;
    padding: 10px 0 !important;
    border: 0 !important;
    border-bottom: 1px solid #f1f5f9 !important;
    text-align: right;
    overflow-wrap: anywhere;
  }
  table.cc-stack td::after { content: ""; display: block; clear: both; }
  table.cc-stack td:last-child { border-bottom: 0 !important; }
  table.cc-stack td > div[style*="display:flex"],
  table.cc-stack td > div[style*="display: flex"] { justify-content: flex-end; flex-wrap: wrap; }
  table.cc-stack td::before {
    content: attr(data-label);
    float: left;
    max-width: 45%;
    margin-right: 12px;
    text-align: left;
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--cc-muted);
  }
  table.cc-stack td[data-label=""]::before,
  table.cc-stack td[colspan]::before { display: none; }
  table.cc-stack td[colspan] { text-align: center; }
  table.cc-stack td .btn, table.cc-stack td button, table.cc-stack td a { min-height: var(--cc-tap); }
}

/* Loading placeholders (keep space reserved until data arrives) */
.cc-skeleton {
  border-color: transparent !important;
  background: linear-gradient(90deg, #eef2f6 25%, #f8fafc 50%, #eef2f6 75%) !important;
  background-size: 200% 100% !important;
  animation: ccShimmer 1.2s linear infinite;
  pointer-events: none;
}
.cc-date-chip.cc-skeleton { width: 68px; }
@keyframes ccShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Mobile tap targets for in-page links that are small by default */
@media (max-width: 899px) {
  .breadcrumb-nav a,
  .breadcrumbs a {
    min-height: var(--cc-tap);
    min-width: var(--cc-tap);
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }
  #openGoogleMapsBtn,
  #btnOpenExactMap,
  .seo-internal-links a {
    min-height: var(--cc-tap);
    display: inline-flex !important;
    align-items: center;
  }
}

/* Footer and newsletter controls (shared footer markup) */
@media (max-width: 899px) {
  .footer .social-links a {
    width: var(--cc-tap) !important;
    height: var(--cc-tap) !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }
  .footer .footer-logo,
  .footer .footer-col a {
    min-height: var(--cc-tap);
    min-width: var(--cc-tap);
    display: inline-flex;
    align-items: center;
  }
  .newsletter-form input,
  .newsletter-form button {
    min-height: var(--cc-tap);
  }
}
