/* ===== PB Booking – Frontend CSS (Mobile-First) ===== */

:root {
    --pb-primary:   #C58415;
    --pb-secondary: #2A70B1;
    --pb-tertiary:  #475746;
    --pb-white:     #ffffff;
    --pb-border:    #e2e8e2;
    --pb-text:      #1a202c;
    --pb-muted:     #6b7280;
    --pb-shadow:    0 2px 8px rgba(0,0,0,0.07);
    --pb-radius:    8px;
}

/* ─── Base wrap ─────────────────────────────────────── */
.pb-booking-wrap {
    font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--pb-text);
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ─── Header ────────────────────────────────────────── */
.pb-header-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    background: var(--pb-white);
    padding: 18px 20px;
    border-radius: var(--pb-radius);
    border: 1px solid var(--pb-border);
}

.pb-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--pb-tertiary);
    margin: 0 0 3px;
    line-height: 1.2;
}

.pb-subtitle {
    font-size: 13px;
    color: var(--pb-muted);
    margin: 0;
}

.pb-date-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f8fafc;
    padding: 5px;
    border-radius: calc(var(--pb-radius) + 4px);
    border: 1px solid #e2e8f0;
}

.pb-date-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--pb-radius);
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 22px;
    color: #64748b;
    line-height: 1;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}
.pb-date-btn:hover { background: var(--pb-white);  }

.pb-current-date {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 12px;
    font-weight: 700;
    font-size: 13px;
    color: #374151;
    white-space: nowrap;
}

.pb-legend {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.pb-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: var(--pb-muted);
}
.pb-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.pb-dot--available { background: #e2e8f0; border: 1.5px solid #94a3b8; }
.pb-dot--selected  { background: var(--pb-secondary); }
.pb-dot--booked    { background: #d1d5db; border: 1.5px solid #9ca3af; }
.pb-dot--past      { background: #f3f4f6; border: 1.5px dashed #d1d5db; }

/* ─── Mobile Court Selector ─────────────────────────── */
/* Shows ONLY on mobile — replaced by full grid on desktop */
.pb-mobile-court-selector {
    display: none;
    flex-direction: column;
    gap: 8px;
    background: var(--pb-white);
    padding: 16px 18px;
    border-radius: var(--pb-radius);
    border: 1px solid var(--pb-border);
}

.pb-mobile-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
}

.pb-mobile-court-dropdown {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--pb-primary);
    border-radius: var(--pb-radius);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    background: #fffbf5;
    color: var(--pb-tertiary);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23C58415' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 38px;
    cursor: pointer;
}

.pb-mobile-court-info {
    font-size: 12px;
    color: var(--pb-muted);
    margin: 0;
}

/* ─── Rates Bar ─────────────────────────────────────── */
.pb-rates-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 12px 18px;
    background: var(--pb-white);
    border-radius: var(--pb-radius);
    border: 1px solid var(--pb-border);
    
}

.pb-rate-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 12px;
    background: #f8fafc;
    border-radius: var(--pb-radius);
    border: 1px solid #e2e8f0;
}
.pb-rate-item--afternoon { border-left: 3px solid var(--pb-secondary); }

.pb-rate-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 700;
    color: #9ca3af;
    margin: 0;
    line-height: 1;
}
.pb-rate-value {
    font-weight: 700;
    color: #374151;
    font-size: 14px;
    margin: 3px 0 0;
    line-height: 1;
}
.pb-rate-unit { font-size: 11px; font-weight: 400; }

.pb-morning-icon   { font-size: 17px; color: #f59e0b; }
.pb-afternoon-icon { font-size: 17px; color: var(--pb-secondary); }
.pb-evening-icon   { font-size: 17px; color: #818cf8; }

.pb-rates-hint {
    font-size: 12px;
    color: var(--pb-muted);
    margin: 0;
    margin-left: auto;
    font-style: italic;
}

/* Compact inline rates for mobile */
.pb-rates-bar--compact {
    flex-wrap: nowrap;
    padding: 10px 14px;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.pb-rates-bar--compact::-webkit-scrollbar { display: none; }
.pb-rates-bar--compact .pb-rate-item {
    flex-direction: row;
    padding: 6px 12px;
    gap: 6px;
    border-radius: 0;
    border: none;
    border-right: 1px solid #e2e8f0;
    background: transparent;
    flex-shrink: 0;
}
.pb-rates-bar--compact .pb-rate-item:last-of-type { border-right: none; }
.pb-rates-bar--compact .pb-rate-item--afternoon { border-left: none; }
.pb-rates-bar--compact .pb-rate-label { display: none; }
.pb-rates-bar--compact .pb-rate-value {
    font-size: 13px;
    margin: 0;
    white-space: nowrap;
}
.pb-rates-bar--compact .pb-rates-hint { display: none; }

/* ─── Grid Container ────────────────────────────────── */
.pb-grid-wrap {
    background: var(--pb-white);
    border-radius: var(--pb-radius);
    
    border: 1px solid var(--pb-border);
    overflow: hidden;
    overflow-x: auto;
}

.pb-grid-placeholder {
    padding: 40px;
    text-align: center;
    color: var(--pb-muted);
}

.pb-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 52px;
    color: var(--pb-muted);
}

.pb-spinner {
    width: 30px; height: 30px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--pb-primary);
    border-radius: 50%;
    animation: pb-spin 0.75s linear infinite;
    margin-bottom: 10px;
}
@keyframes pb-spin { to { transform: rotate(360deg); } }

/* ─── Grid Rows ─────────────────────────────────────── */
.pb-booking-grid { min-width: 340px; }

.pb-grid-header,
.pb-grid-row {
    display: grid;
    border-bottom: 1px solid #f1f5f1;
}

.pb-grid-header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #f8faf8;
    border-bottom: 2px solid var(--pb-border);
}

.pb-gh-time {
    padding: 13px 10px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--pb-muted);
    border-right: 1px solid var(--pb-border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pb-gh-court {
    padding: 11px 14px;
    border-right: 1px solid var(--pb-border);
    display: flex;
    flex-direction: column;
    gap: 2px;
    justify-content: center;
}
.pb-gh-court:last-child { border-right: none; }

.pb-gh-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--pb-tertiary);
    display: block;
}
.pb-gh-meta {
    font-size: 11px;
    color: var(--pb-muted);
    display: block;
}

.pb-time-cell {
    padding: 0 8px;
    min-height: 64px;
    font-size: 12px;
    font-weight: 700;
    color: var(--pb-muted);
    background: #f8faf8;
    border-right: 1px solid var(--pb-border);
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}
.pb-time-afternoon { color: var(--pb-secondary); background: rgba(42,112,177,0.04); }
.pb-time-evening   { color: #6366f1; background: rgba(99,102,241,0.04); }

.pb-grid-row.pb-row-afternoon { background: rgba(42,112,177,0.015); }
.pb-grid-row.pb-row-evening   { background: rgba(99,102,241,0.015); }

.pb-slot-cell {
    padding: 7px;
    border-right: 1px solid #f1f5f1;
    display: flex;
    align-items: center;
}
.pb-slot-cell:last-child { border-right: none; }

/* Slot buttons */
.pb-slot-btn {
    width: 100%;
    min-height: 50px;
    border-radius: var(--pb-radius);
    border: 2px dashed #d1d5db;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #d1d5db;
    transition: all 0.15s;
    font-weight: 700;
    font-family: inherit;
    /* Better tap target */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.pb-slot-btn:hover:not(:disabled):not(.pb-slot-booked):not(.pb-slot-past) {
    border-color: var(--pb-primary);
    border-style: solid;
    background: rgba(197,132,21,0.05);
    color: var(--pb-primary);
}

.pb-slot-btn.pb-slot-selected {
    background: var(--pb-primary);
    border: 2px solid var(--pb-primary);
    color: #fff;
    font-size: 15px;
}
.pb-slot-btn.pb-slot-selected:hover {
    background: #b07513;
    border-color: #b07513;
}

.pb-slot-btn.pb-slot-booked {
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-style: solid;
    color: #9ca3af;
    cursor: not-allowed;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.pb-slot-btn.pb-slot-past {
    background: #fafafa;
    border: 2px dashed #e5e7eb;
    color: #d1d5db;
    cursor: not-allowed;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ─── Filters + Notes ───────────────────────────────── */
.pb-filters-row {
    display: grid;
    grid-template-columns: 20% 80%;
    gap: 14px;
}

.pb-filter-card,
.pb-notes-card {
    background: var(--pb-white);
    border-radius: var(--pb-radius);
    border: 1px solid var(--pb-border);
    padding: 20px;
    
}

.pb-filter-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--pb-tertiary);
    margin: 0 0 14px;
}

/* Available times: dashed rounded tiles (horizontal grid) */
.pb-time-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 10px 12px;
    margin-top: 8px;
    padding: 12px 10px;
    border: none;
    border-radius: 16px;
    background: #f8fafc;
    max-height: 280px;
    overflow-y: auto;
    box-sizing: border-box;
}
.pb-time-checkboxes > .pb-time-checkboxes-empty {
    grid-column: 1 / -1;
    margin: 0;
}
.pb-time-check-row {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    margin: 0;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px dashed #b8c9db;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: var(--pb-text);
    cursor: pointer;
    text-align: center;
    line-height: 1.25;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
    box-sizing: border-box;
}
.pb-time-check-row:hover {
    border-color: #94a3b8;
    background: #fafbfc;
}
.pb-time-check-row:has(.pb-time-check:focus-visible) {
    outline: 2px solid rgba(42, 112, 177, 0.45);
    outline-offset: 2px;
}
.pb-time-check-row input.pb-time-check {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}
.pb-time-check-label {
    position: relative;
    z-index: 0;
    pointer-events: none;
}
.pb-time-checkboxes-empty {
    margin: 0;
    font-size: 13px;
    color: var(--pb-muted);
    padding: 14px 8px;
    text-align: center;
}
.pb-time-guide {
    margin: 8px 0 0;
    font-size: 12px;
    color: #C58415;
}
.pb-time-guide--desktop { display: block; }
.pb-time-guide--touch { display: none; }

.pb-filter-group { margin-bottom: 14px; }
.pb-filter-group:last-child { margin-bottom: 0; }

/* ─── Court Stepper (multi-court, sequential time selection) ───────────── */
.pb-court-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid var(--pb-border);
    border-radius: var(--pb-radius);
    background: #f1f5f9;
    padding: 10px;
    max-height: 320px;
    overflow-y: auto;
}
.pb-court-check-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0;
    min-height: 76px;
    padding: 12px 14px;
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
    color: #fff;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.pb-court-check-row--placeholder {
    background-image: linear-gradient(rgba(0, 0, 0, 0.48), rgba(0, 0, 0, 0.48)),
        linear-gradient(135deg, #5b6b7a 0%, #3d4a56 55%, #2f3d47 100%);
    background-size: cover, cover;
    background-position: center, center;
}
.pb-court-check-row:hover {
    filter: brightness(1.06);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08), 0 4px 14px rgba(0, 0, 0, 0.12);
}
.pb-court-check-row:has(.pb-court-check:checked) {
    outline: 2px solid var(--pb-primary);
    outline-offset: 2px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(197, 132, 21, 0.35);
}
.pb-court-check-text {
    position: relative;
    z-index: 1;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
    flex: 1;
    pointer-events: none;
}
.pb-court-check {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
    appearance: none;
    -webkit-appearance: none;
    border: none;
    border-radius: inherit;
}
.pb-court-check:focus {
    outline: none;
}
.pb-court-check-row:focus-within:has(.pb-court-check:focus-visible) {
    outline: 2px solid var(--pb-primary);
    outline-offset: 2px;
}
.pb-court-stepper {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    overflow-x: visible;
    padding: 6px 0 0;
}
.pb-court-step {
    flex: 1 1 180px;
    min-width: 170px;
    border: 1px solid var(--pb-border);
    border-radius: var(--pb-radius);
    background: #fff;
    padding: 10px 12px;
    opacity: 0.55;
    position: relative;
    cursor: pointer;
}
.pb-court-step--active {
    opacity: 1;
    border-color: var(--pb-secondary);
    background: rgba(42,112,177,0.06);
}
/* Court photo on every selected step; inactive = blurred; no times yet = extra darken (::after) */
.pb-court-step--has-court-image {
    padding: 0;
    min-height: 100px;
    overflow: hidden;
    background: #0f172a;
    opacity: 0.88;
}
.pb-court-step--has-court-image.pb-court-step--active {
    opacity: 1;
    border-color: rgba(42, 112, 177, 0.85);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.18);
    background: #0f172a;
}
.pb-court-step--has-court-image.pb-court-step--done:not(.pb-court-step--active) {
    opacity: 0.92;
}
.pb-court-step--has-court-image .pb-court-step-bg {
    position: absolute;
    top: -14px;
    right: -14px;
    bottom: -14px;
    left: -14px;
    z-index: 0;
    background-image:
        linear-gradient(180deg, rgba(0, 0, 0, 0.42) 0%, rgba(0, 0, 0, 0.14) 50%, rgba(0, 0, 0, 0.32) 100%),
        var(--pb-court-photo, none);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: filter 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
}
.pb-court-step--has-court-image:not(.pb-court-step--active) .pb-court-step-bg {
    filter: blur(6px);
    transform: scale(1.08);
    opacity: 0.9;
}
.pb-court-step--has-court-image.pb-court-step--active .pb-court-step-bg {
    filter: none;
    transform: none;
    opacity: 1;
}
.pb-court-step--has-court-image.pb-court-step--needs-times::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
    background: rgba(0, 0, 0, 0.45);
    pointer-events: none;
}
.pb-court-step--has-court-image.pb-court-step--needs-times:not(.pb-court-step--active)::after {
    background: rgba(0, 0, 0, 0.58);
}
.pb-court-step--has-court-image .pb-court-step-inner {
    position: relative;
    z-index: 2;
    padding: 12px 14px;
    min-height: 96px;
    box-sizing: border-box;
}
.pb-court-step--has-court-image .pb-court-step-title {
    margin: 0 0 6px;
    color: #ffffff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}
.pb-court-step--has-court-image .pb-court-step-meta {
    margin: 0;
    color: rgba(255, 255, 255, 0.94);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
.pb-court-step--done {
    opacity: 1;
    border-color: var(--pb-primary);
    background: rgba(197,132,21,0.07);
}
.pb-court-step--has-court-image.pb-court-step--done {
    background: #0f172a;
}
.pb-court-step--disabled {
    opacity: 0.45;
    cursor: default;
}
.pb-court-step--has-court-image.pb-court-step--disabled {
    opacity: 0.55;
    cursor: default;
}
.pb-court-step-title {
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 800;
    color: #111827;
}
.pb-court-step-meta {
    margin: 0;
    font-size: 12px;
    color: var(--pb-muted);
}

.pb-court-stepper-nav {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 10px;
}
.pb-stepper-btn {
    padding: 8px 14px;
    font-size: 13px;
    border-radius: var(--pb-radius);
}
.pb-court-stepper-nav .pb-review-btn {
    padding: 8px 14px;
    border-radius: var(--pb-radius);
}

/* Smaller "Add Time" button */
#pb-add-slot-btn {
    padding: 9px 16px;
    font-size: 13px;
}

/* ─── Available Times: fixed height + subtle striping ─────────────────────── */
#pb-time-select {
    display: none;
    height: 240px;              /* fixed height */
    overflow-y: auto;           /* scrollable */
    background: #fff;
    border: 1px solid var(--pb-border);
    border-radius: var(--pb-radius);
    padding: 6px;               /* inner breathing room around options */
    box-sizing: border-box;
}
#pb-time-select option {
    padding: 8px 10px;          /* some browsers ignore, safe to attempt */
    font-size: 14px;
    color: var(--pb-text);
}
#pb-time-select option:nth-child(odd) {
    background: #fafafa;        /* striping */
}
#pb-time-select option:checked {
    background: rgba(24,130,191,0.14); /* selected tint */
    color: #0f172a;
}
#pb-time-select:focus {
    outline: 2px solid rgba(24,130,191,0.35);
    outline-offset: 1px;
}

.pb-time-check-row--selected {
    border-style: solid;
    border-width: 2px;
    border-color: var(--pb-secondary);
    background: rgba(42, 112, 177, 0.08);
    box-shadow: 0 1px 0 rgba(42, 112, 177, 0.06);
}
.pb-time-check-row--selected .pb-time-check-label {
    color: var(--pb-secondary);
    font-weight: 800;
}

/* Fallback when class sync lags */
.pb-time-check:checked + .pb-time-check-label {
    color: var(--pb-secondary);
    font-weight: 800;
}

.pb-filter-label {
    display: block;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    margin-bottom: 7px;
}

.pb-filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.pb-chip {
    padding: 5px 13px;
    border-radius: 9999px;
    border: 1.5px solid transparent;
    background: #f1f5f9;
    color: #4b5563;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    touch-action: manipulation;
}
.pb-chip--active { background: var(--pb-tertiary); color: #fff; }
.pb-chip:hover:not(.pb-chip--active) { border-color: var(--pb-tertiary); color: var(--pb-tertiary); }

.pb-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: var(--pb-radius);
    font-size: 13px;
    background: #f8fafc;
    color: var(--pb-text);
    font-family: inherit;
}

.pb-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: var(--pb-radius);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    background: #f8fafc;
    box-sizing: border-box;
    color: var(--pb-text);
}

/* ─── Sticky Footer ─────────────────────────────────── */
.pb-booking-footer {
    background: var(--pb-white);
    border-radius: var(--pb-radius);
    border: 1px solid var(--pb-border);
    padding: 14px 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: sticky;
    bottom: 12px;
    z-index: 20;
}

.pb-footer-info {
    font-size: 12px;
    color: var(--pb-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.pb-footer-total {
    display: flex;
    align-items: center;
    gap: 18px;
}

.pb-total-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: #9ca3af;
    margin: 0;
}

.pb-total-price {
    font-size: 22px;
    font-weight: 700;
    color: var(--pb-primary);
    margin: 2px 0 0;
    line-height: 1;
}

.pb-review-btn {
    background: var(--pb-primary);
    color: #fff;
    border: none;
    padding: 11px 28px;
    border-radius: var(--pb-radius);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.18s;
    font-family: inherit;
    touch-action: manipulation;
}
.pb-review-btn:hover:not(:disabled) { background: #b07513; transform: scale(1.02); }
.pb-review-btn:disabled { background: #d1d5db; box-shadow: none; cursor: not-allowed; transform: none; }

/* ─── Modal ─────────────────────────────────────────── */
.pb-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.48);
    z-index: 2147483646;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.pb-modal {
    background: var(--pb-white);
    border-radius: 12px;
    max-width: 520px;
    width: 100%;
    height: auto;
    padding: 28px;
    position: relative;
    max-height: 500px;
    overflow-y: auto;
}

.pb-modal-close {
    position: absolute;
    top: 12px; right: 12px;
    width: 30px; height: 30px;
    border: none;
    background: #f1f5f9;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.15s;
    font-family: inherit;
}
.pb-modal-close:hover { background: #e2e8f0; }

.pb-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--pb-tertiary);
    margin: 0 0 16px;
}

.pb-modal-body table { width: 100%; border-collapse: collapse; margin-bottom: 6px; }
.pb-modal-body td {
    padding: 9px 4px;
    border-bottom: 1px solid #f1f5f1;
    font-size: 13px;
}
.pb-modal-body td:first-child {
    font-weight: 600;
    color: var(--pb-muted);
    width: 38%;
}
.pb-modal-court-row td {
    padding-top: 16px;
    font-size: 14px;
    border-bottom: 2px solid var(--pb-border);
}
.pb-modal-court-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.pb-modal-court-thumb-wrap {
    flex-shrink: 0;
    line-height: 0;
}
.pb-modal-court-thumb {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e2e8e0;
    display: block;
}
.pb-modal-court-heading-text {
    flex: 1;
    min-width: 0;
}
.pb-modal-total {
    font-size: 22px;
    font-weight: 700;
    color: var(--pb-primary);
    text-align: right;
    margin: 14px 0 0;
}

.pb-modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.pb-btn-primary {
    background: var(--pb-primary);
    color: #fff;
    border: none;
    padding: 11px 24px;
    border-radius: var(--pb-radius);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.18s;
    font-family: inherit;
    touch-action: manipulation;
}
.pb-btn-primary:hover:not(:disabled) { background: #b07513; }
.pb-btn-primary:disabled { background: #d1d5db; box-shadow: none; cursor: not-allowed; }

.pb-btn-secondary {
    background: transparent;
    color: var(--pb-muted);
    border: 1.5px solid var(--pb-border);
    padding: 11px 20px;
    border-radius: var(--pb-radius);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.pb-btn-secondary:hover { background: #f8fafc; color: var(--pb-muted); }

/* ─── Waiver Popup ───────────────────────────────────── */
.pb-waiver-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    display: none;
}
.pb-waiver-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.48);
}
.pb-waiver-modal {
    position: relative;
    max-width: 720px;
    width: calc(100% - 32px);
    max-height: min(80vh, 720px);
    margin: 40px auto;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: var(--pb-shadow);
    padding: 18px 20px 20px;
    overflow: hidden;
}
.pb-waiver-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: #f3f4f6;
    color: #374151;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}
.pb-waiver-close:hover { background: #e5e7eb; }
.pb-waiver-title {
    margin: 0 28px 10px 0;
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
}
.pb-waiver-content {
    overflow-y: auto;
    max-height: calc(80vh - 100px);
    padding-right: 6px;
    color: #1f2937;
    font-size: 14px;
}
.pb-waiver-content h4 {
    margin: 12px 0 6px;
    font-size: 14px;
    color: #111827;
    font-weight: 800;
}
.pb-waiver-content p { margin: 0 0 10px; }
.pb-waiver-content ul { margin: 0 0 10px 18px; padding: 0; }
.pb-waiver-content li { margin: 0 0 6px; }

/* ══════════════════════════════════════════════════════
   MOBILE BREAKPOINT  (≤ 767px)
══════════════════════════════════════════════════════ */
@media (max-width: 767px) {

    .pb-booking-wrap { gap: 12px; }

    /* Header stacks */
    .pb-header-controls {
        flex-direction: column;
        align-items: flex-start;
        padding: 16px;
        gap: 12px;
    }

    .pb-date-nav { align-self: stretch; justify-content: space-between; }
    .pb-current-date { flex: 1; justify-content: center; }

    /* Legend row wraps tighter */
    .pb-legend { gap: 10px; }
    .pb-header-right { width: 100%; }

    /* ── Show mobile dropdown, hide nothing else ── */
    .pb-mobile-court-selector { display: flex; }

    /* ── Rates bar: compact single-line ── */
    .pb-rates-bar {
        flex-wrap: nowrap;
        padding: 10px 14px;
        gap: 0;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .pb-rates-bar::-webkit-scrollbar { display: none; }

    .pb-rate-item {
        flex-direction: row;
        padding: 6px 14px;
        gap: 6px;
        border-radius: 0;
        border: none;
        border-right: 1px solid #e2e8f0;
        background: transparent;
        flex-shrink: 0;
        align-items: center;
    }
    .pb-rate-item:last-of-type { border-right: none; }
    .pb-rate-item--afternoon   { border-left: none; }

    /* Hide text labels, keep icon + price */
    .pb-rate-label { display: none; }
    .pb-rate-value { font-size: 13px; margin: 0; white-space: nowrap; }
    .pb-rates-hint { display: none; }

    /* ── Grid: single column (1 court visible at a time) ── */
    /* Column headers hide court label (shown in dropdown) */
    .pb-gh-court { display: none; }

    /* Time cells narrower */
    .pb-time-cell {
        min-height: 58px;
        font-size: 11px;
        padding: 0 6px;
    }

    /* Slot buttons: bigger tap area */
    .pb-slot-btn {
        min-height: 54px;
        font-size: 22px;
    }
    .pb-slot-btn.pb-slot-booked,
    .pb-slot-btn.pb-slot-past {
        font-size: 10px;
        letter-spacing: 0.03em;
    }

    /* ── Filters: stack ── */
    .pb-filters-row { grid-template-columns: 1fr; }
    
    /* Court stepper: stack/wrap instead of single long row */
    .pb-court-stepper {
        flex-wrap: wrap;
        overflow-x: visible;
    }
    .pb-court-step {
        flex: 1 1 180px;
        min-width: 170px;
    }
    #pb-time-select { display: none; }
    .pb-time-checkboxes { display: block; }
    .pb-time-guide--desktop { display: none; }
    .pb-time-guide--touch { display: block; }

    /* ── Footer: compact ── */
    .pb-booking-footer {
        bottom: 0;
        border-radius: var(--pb-radius) var(--pb-radius) 0 0;
        border-bottom: none;
        padding: 12px 16px;
    }
    .pb-footer-info { display: none; } /* hide hint text on mobile */
    .pb-footer-total { width: 100%; justify-content: space-between; }
    .pb-total-price  { font-size: 20px; }
    .pb-review-btn   { padding: 12px 24px; font-size: 15px; flex: 1; text-align: center; }

    /* ── Modal: full-width bottom sheet feel ── */
    .pb-modal-overlay { align-items: flex-end; padding: 0; }
    .pb-modal {
        border-radius: 16px 16px 0 0;
        max-width: 100%;
        height: auto;
        max-height: min(500px, 85vh);
        padding: 24px 20px;
    }
    .pb-modal-footer { flex-direction: column; }
    .pb-btn-primary, .pb-btn-secondary { width: 100%; text-align: center; }
}

/* ══════════════════════════════════════════════════════
   TABLET (768px – 1024px): 2-col grid still fine
══════════════════════════════════════════════════════ */
@media (min-width: 768px) {
    /* Hide mobile dropdown — full grid handles court selection */
    .pb-mobile-court-selector { display: none !important; }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .pb-filters-row { grid-template-columns: 1fr 1fr; }
    
    /* Court stepper: wrap on narrower right column */
    .pb-court-stepper {
        flex-wrap: wrap;
        overflow-x: visible;
    }
    .pb-court-step {
        flex: 1 1 180px;
        min-width: 170px;
    }
    #pb-time-select { display: none; }
    .pb-time-checkboxes { display: block; }
    .pb-time-guide--desktop { display: none; }
    .pb-time-guide--touch { display: block; }
}
