/* ==========================================================================
   PickleWeb Native Interactive Booking Matrix Stylesheet
   Faithfully modeled on Book A Court UX & architecture with PickleWeb Emerald Theme
   ========================================================================== */

:root {
  /* PickleWeb Emerald / Teal Color Tokens */
  --primary-button-color: #0f766e;
  --primary-hover: #115e59;
  --primary-dark: #042f2e;
  --primary-subtle: #f0fdfa;
  --primary-border: #ccfbf1;
  --on-primary-text: #ffffff;

  /* Slot Matrix Colors */
  --slot-available: #0f766e;
  --slot-available-hover: #115e59;
  --slot-selected: #042f2e;
  --slot-selected-border: #134e4a;

  /* Locked / Booked Slots */
  --booked-stripe-1: #cbd5e1;
  --booked-stripe-2: #e2e8f0;

  /* Surface & Typography */
  --bg-surface: #ffffff;
  --border-line: #e2e8f0;
  --border-light: #f1f5f9;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  /* Book A Court Corner Radii Tokens */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Typography */
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-condensed: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Shadows */
  --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-elevated: 0 12px 32px rgba(0, 0, 0, 0.15);
}

/* Page Intro Header in Booking Section */
.page-intro-header {
  text-align: center;
  max-width: 780px;
  margin: 0 auto 24px;
}

.page-category-tag {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--primary-button-color);
  background: var(--primary-subtle);
  border: 1px solid var(--primary-border);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.page-intro-header h2 {
  font-family: var(--font-condensed);
  font-size: 32px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.page-intro-desc {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ==========================================================================
   1. Search & Filter Card (Floating Top Card)
   ========================================================================== */
.search-filter-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-subtle);
  margin-bottom: 16px;
}

.search-bar-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.2fr auto;
  gap: 12px;
  align-items: flex-end;
}

.filter-item {
  display: flex;
  flex-direction: column;
}

.filter-item label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-wrap svg {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
}

.form-field-input,
.form-field-select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-line);
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-main);
  background-color: #ffffff;
  outline: none;
  transition: all 0.15s ease;
}

.input-icon-wrap .form-field-input {
  padding-left: 34px;
}

.form-field-input:focus,
.form-field-select:focus {
  border-color: var(--primary-button-color);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.btn-search-main {
  height: 40px;
  background-color: var(--primary-button-color);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0 22px;
  font-family: var(--font-condensed);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(15, 118, 110, 0.25);
}

.btn-search-main:hover {
  background-color: var(--primary-hover);
}

/* ==========================================================================
   2. Interactive Court Availability Matrix Card
   ========================================================================== */
.matrix-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* Sub-Filter Bar */
.matrix-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-line);
  background: #fafafb;
  flex-wrap: wrap;
  gap: 12px;
}

.tab-pill-group {
  display: inline-flex;
  gap: 4px;
  background: #eef2f6;
  padding: 3px;
  border-radius: var(--radius-sm);
}

.tab-btn {
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn.active {
  background-color: #ffffff;
  color: var(--primary-button-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-weight: 700;
}

/* Live Sync Indicator with Pulsing Emerald Dot */
.live-sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-subtle);
  border: 1px solid var(--primary-border);
  color: var(--primary-button-color);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}

.live-pulse-dot {
  width: 7px;
  height: 7px;
  background-color: var(--primary-button-color);
  border-radius: 50%;
  animation: pulseEmerald 1.8s infinite ease-in-out;
}

@keyframes pulseEmerald {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

/* Price Slider Filter */
.slider-filter-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.slider-filter-wrap label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.price-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100px;
  height: 5px;
  background: #cbd5e1;
  border-radius: var(--radius-sm);
  outline: none;
}

.price-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary-button-color);
  cursor: pointer;
  transition: transform 0.15s;
}

.price-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.slider-val-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-button-color);
  background: var(--primary-subtle);
  border: 1px solid var(--primary-border);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
}

/* Mobile Horizontal Swipe Hint */
.mobile-swipe-hint {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-line);
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.mobile-swipe-hint svg {
  color: var(--primary-button-color);
  animation: bounceX 1.4s infinite ease-in-out;
}

@keyframes bounceX {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(3px); }
}

/* Matrix Table Wrapper */
.matrix-scroll-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

.court-matrix-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: center;
}

.court-matrix-table th,
.court-matrix-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
}

.court-matrix-table th:last-child,
.court-matrix-table td:last-child {
  border-right: none;
}

.court-matrix-table thead th {
  background: #fdfdfd;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
  padding: 10px 8px;
}

/* Sticky Left Court Column */
.court-matrix-table th.col-court-header {
  text-align: left;
  padding-left: 16px;
  width: 190px;
  min-width: 170px;
  position: sticky;
  left: 0;
  z-index: 30;
  background: #ffffff;
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.04);
}

.court-matrix-table td.court-name-cell {
  text-align: left;
  padding-left: 16px;
  font-family: var(--font-condensed);
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text-main);
  position: sticky;
  left: 0;
  z-index: 20;
  background: #ffffff;
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.04);
}

.court-name-cell .tag-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  margin-top: 3px;
}

.tag-badge.indoor {
  background: #e0f2fe;
  color: #0369a1;
}

.tag-badge.outdoor {
  background: #fef3c7;
  color: #b45309;
}

/* ==========================================================================
   Slot Blocks & Connected Range Styling
   ========================================================================== */
.slot-cell {
  height: 52px;
  min-width: 92px;
  padding: 3px !important;
  vertical-align: middle;
}

.slot-block {
  width: 100%;
  height: 100%;
  min-height: 44px; /* Touch-friendly tap target */
  border-radius: var(--radius-sm); /* Sharp Book A Court corners (4px) */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.15s ease;
  user-select: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Available Slot */
.slot-block.available {
  background-color: var(--slot-available);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 118, 110, 0.25);
  font-family: var(--font-condensed);
}

.slot-block.available:hover {
  background-color: var(--slot-available-hover);
  transform: scale(1.02);
}

/* Booked Slot with Diagonal Stripes */
.slot-block.booked {
  background: repeating-linear-gradient(
    -45deg,
    var(--booked-stripe-1),
    var(--booked-stripe-1) 5px,
    var(--booked-stripe-2) 5px,
    var(--booked-stripe-2) 10px
  );
  color: transparent;
  cursor: not-allowed;
  opacity: 0.75;
}

/* Past Time Slot */
.slot-block.past {
  background: #e5e6e9;
  color: #9fa4a9;
  cursor: not-allowed;
  opacity: 0.6;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

/* Connected Multi-Slot Container (The connected cards) */
.selected-span-container {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--slot-selected) !important;
  color: #ffffff !important;
  font-family: var(--font-condensed);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-align: center;
  height: 100%;
  width: 100%;
  border-radius: var(--radius-sm); /* Sharp corners matching Book A Court */
  padding: 0 8px;
  line-height: 1.25;
  box-shadow: inset 0 0 0 1.5px var(--slot-selected-border);
}

/* Single Selected Slot fallback */
.slot-block.selected {
  background-color: var(--slot-selected) !important;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: inset 0 0 0 2px var(--slot-selected-border);
}

/* ==========================================================================
   Docked Sticky Bottom Summary Action Bar
   ========================================================================== */
.bottom-action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 900;
  background: #ffffff;
  border-top: 1px solid var(--border-line);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.08);
}

.bottom-action-inner {
  max-width: 1240px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.selected-court-info {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.court-title-primary {
  font-family: var(--font-condensed);
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-main);
  line-height: 1.1;
}

.meta-item {
  display: flex;
  flex-direction: column;
}

.meta-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.meta-value {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
}

.booking-action-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.total-amount-display {
  font-family: var(--font-condensed);
  font-size: 20px;
  font-weight: 800;
  color: var(--primary-button-color);
}

.btn-book-slot {
  background-color: var(--primary-button-color);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm); /* Book A Court sharp corner */
  padding: 11px 26px;
  font-family: var(--font-condensed);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.6px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 3px 10px rgba(15, 118, 110, 0.3);
  text-transform: uppercase;
  white-space: nowrap;
}

.btn-book-slot:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

.btn-book-slot:disabled {
  background-color: #d1d5db;
  color: #9ca3af;
  cursor: not-allowed;
  box-shadow: none;
}

/* ==========================================================================
   Checkout Confirmation Modal (Book A Court Architecture)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.booking-modal-card {
  background: #ffffff;
  border-radius: var(--radius-md); /* Book A Court card corner */
  max-width: 490px;
  width: 100%;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-elevated);
  border: 1px solid var(--border-line);
  overflow: hidden;
  position: relative;
  z-index: 2001;
}

.booking-modal-card form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  margin: 0;
}

.modal-header {
  background: #fafafb;
  border-bottom: 1px solid var(--border-light);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-header h3 {
  font-family: var(--font-condensed);
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-main);
  margin: 0;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}

.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1 1 auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.modal-summary-box {
  background: var(--primary-subtle);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--text-muted);
}

.summary-row strong {
  color: var(--text-main);
}

.summary-row.total {
  border-top: 1px solid var(--primary-border);
  padding-top: 6px;
  margin-top: 6px;
  font-family: var(--font-condensed);
  font-weight: 700;
  font-size: 16px;
  color: var(--primary-button-color);
}

.summary-row.total strong {
  color: var(--primary-button-color);
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-main);
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.form-control:focus {
  border-color: var(--primary-button-color);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.modal-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  background: #fafafb;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.btn-secondary {
  background: #e9e9ea;
  color: var(--text-main);
  border: 1px solid var(--border-line);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary-button-color);
  color: #ffffff;
  border: none;
  padding: 9px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--font-condensed);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(15, 118, 110, 0.25);
  transition: all 0.15s ease;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

/* Toast Message */
.toast-msg {
  position: fixed;
  bottom: 84px;
  right: 16px;
  left: 16px;
  max-width: 400px;
  margin: 0 auto;
  background: var(--text-main);
  color: #ffffff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-elevated);
  font-size: 13.5px;
  font-weight: 600;
  z-index: 3000;
  display: none;
  text-align: center;
}

/* ==========================================================================
   3. Mobile & Responsive Layout (< 768px & < 480px)
   ========================================================================== */
@media (max-width: 768px) {
  .search-bar-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .search-bar-grid .filter-item:nth-child(1) {
    grid-column: 1 / -1; /* Date takes full width */
  }

  .search-bar-grid > div:last-child {
    grid-column: 1 / -1; /* Search CTA button takes full width */
  }

  .btn-search-main {
    width: 100%;
  }

  .mobile-swipe-hint {
    display: flex; /* Visible on tablet & mobile */
  }

  .matrix-subbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .matrix-subbar > div {
    justify-content: space-between;
  }

  .tab-pill-group {
    width: 100%;
    display: flex;
  }

  .tab-btn {
    flex: 1;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .search-bar-grid {
    grid-template-columns: 1fr; /* Single column on phones */
  }

  .court-matrix-table th.col-court-header {
    width: 110px;
    min-width: 110px;
  }

  .court-matrix-table td.court-name-cell {
    font-size: 13px;
    padding-left: 8px;
    width: 110px;
    min-width: 110px;
  }

  .slot-cell {
    min-width: 76px;
  }

  .bottom-action-bar {
    padding: 10px 14px;
  }

  .bottom-action-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
    align-items: center;
  }

  .selected-court-info {
    gap: 6px;
  }

  .court-title-primary {
    font-size: 15px;
  }

  .meta-item {
    display: none; /* Keep clean on small screens */
  }

  .booking-action-right {
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }

  .total-amount-display {
    font-size: 16px;
  }

  .btn-book-slot {
    padding: 8px 14px;
    font-size: 13px;
  }
}
