/* Booking Modal - Mobile-First Responsive Design */

#booking-modal-mount {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    transition: visibility 0s linear 0.8s;
}

#booking-modal-mount.open {
    visibility: visible;
    transition-delay: 0s;
    pointer-events: auto;
}

/* Backdrop */
.modal-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    transform: translateZ(0);
    will-change: backdrop-filter, background-color;
    transition:
        background-color 0.8s cubic-bezier(0.4, 0, 0.2, 1),
        backdrop-filter 0.8s cubic-bezier(0.4, 0, 0.2, 1),
        -webkit-backdrop-filter 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
}

#booking-modal-mount.loading .modal-backdrop,
#booking-modal-mount.open .modal-backdrop {
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

/* Modal Content Container */
.modal-content {
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    opacity: 0;
    transform: scale(0.94) translateY(40px);
    transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.8s ease;
    display: flex;
    flex-direction: column;
    position: relative;

    /* Mobile: Full Screen */
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
}

#booking-modal-mount.open .modal-content {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Grid Layout */
.modal-grid {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Main Area (Calendar) */
.modal-main {
    padding: 1.25rem;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
}

/* Sidebar (Summary) */
.modal-sidebar {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    /* Safe area for bottom notch */
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
}

/* --- CALENDAR STYLES --- */

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.calendar-header .nav-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.calendar-header .nav-btn:hover {
    background: rgba(204, 0, 0, 0.2) !important;
    color: var(--color-primary) !important;
}

.calendar-months {
    display: flex;
    justify-content: center;
    width: 100%;
}

.month-container {
    width: 100%;
}

.month-label {
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Fluid Day Grid — fills available width */
.days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    width: 100%;
}

.day-header {
    text-align: center;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 800;
    padding: 0.25rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
}

.day-btn {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    background: transparent;
    transition: all 0.15s ease;
    position: relative;
    cursor: pointer;
    border: 1px solid transparent;
    min-width: 0;
}

.day-btn:hover:not(:disabled) {
    background: rgba(204, 0, 0, 0.1);
    border-color: rgba(204, 0, 0, 0.2);
}

/* Today Indicator */
.day-btn.today::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--color-primary);
    pointer-events: none;
}

.day-btn.selected.today::after,
.day-btn.range-start.today::after,
.day-btn.range-end.today::after {
    background: white;
}

/* Selection States */
.day-btn.selected:not(.range-start):not(.range-end) {
    background: var(--color-primary);
    color: white;
    border-radius: 6px;
}

.day-btn.in-range {
    background: rgba(153, 27, 27, 0.25);
    color: white;
    border-radius: 0;
}

.day-btn.range-start {
    background: var(--color-primary);
    color: white !important;
    border-radius: 6px 0 0 6px;
}

.day-btn.range-end {
    background: var(--color-primary);
    color: white !important;
    border-radius: 0 6px 6px 0;
}

.day-btn:disabled {
    opacity: 0.15;
    cursor: not-allowed;
    filter: grayscale(1);
}

/* Day Price Tooltip */
.day-price {
    position: absolute;
    bottom: 2px;
    font-size: 0.5rem;
    opacity: 0.5;
    font-weight: 700;
    display: none;
}

.day-btn:hover:not(:disabled) .day-price {
    display: block;
}

/* Empty Day Slots */
.day-empty {
    aspect-ratio: 1;
}

/* --- UPSELL --- */
.upsell-card {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 0.5rem;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    animation: fadeIn 0.4s ease;
}

.upsell-card:hover {
    background: rgba(255, 215, 0, 0.2);
    transform: translateY(-2px);
}

.upsell-title {
    font-size: 0.8rem;
    color: #ffd700;
    font-weight: 700;
    margin-bottom: 2px;
}

.upsell-sub {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.8);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.upsell-card.max-level {
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.3);
    cursor: default;
}

.upsell-card.max-level:hover {
    transform: none;
    background: rgba(74, 222, 128, 0.15);
}

/* --- TICKET SUCCESS SCREEN --- */
.ticket-view {
    display: none;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    z-index: 50;
    pointer-events: none;
}

.ticket-view.active {
    display: flex;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
}

.ticket-card {
    background: #ffffff;
    color: #1a1a1a;
    width: 90%;
    max-width: 380px;
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
    font-family: sans-serif;
    transform: scale(0.8) translateY(20px);
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ticket-view.active .ticket-card {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Confetti */
.confetti-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 60;
}

.confetti {
    position: absolute;
    width: 8px;
    height: 16px;
    top: -20px;
    opacity: 0;
}

@keyframes fall {
    0% {
        transform: translateY(-10vh) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(110vh) rotate(720deg);
        opacity: 0;
    }
}

/* Ticket Internal */
.ticket-header {
    padding: 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.check-circle-bg {
    width: 3.5rem;
    height: 3.5rem;
    background: rgba(220, 38, 38, 0.1);
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: #dc2626;
}

.ticket-divider {
    position: relative;
    width: 100%;
    height: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0.5rem 0;
}

.ticket-divider::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    border-top: 2px dashed #e5e7eb;
}

.ticket-cutout {
    position: absolute;
    top: 50%;
    width: 2rem;
    height: 2rem;
    background: rgb(20, 20, 20);
    border-radius: 50%;
    transform: translateY(-50%);
    box-shadow: inset 2px 0 4px rgba(0, 0, 0, 0.2);
}

.ticket-cutout.left {
    left: -1rem;
    box-shadow: inset -2px 0 4px rgba(0, 0, 0, 0.1);
}

.ticket-cutout.right {
    right: -1rem;
    box-shadow: inset 2px 0 4px rgba(0, 0, 0, 0.1);
}

.ticket-body {
    padding: 0 1.5rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ticket-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.85rem;
}

.ticket-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
}

.ticket-value {
    font-weight: 600;
}

.ticket-value.mono {
    font-family: monospace;
    font-size: 1rem;
}

.ticket-value.large {
    font-size: 1.25rem;
}

.mastercard-row {
    background: #f3f4f6;
    padding: 0.75rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ========================================
   DESKTOP OVERRIDES (768px+)
   ======================================== */

@media (min-width: 769px) {
    .modal-content {
        width: 95%;
        max-width: 1000px;
        height: 85vh;
        max-height: 800px;
        border-radius: 1.5rem;
    }

    .modal-grid {
        display: grid;
        grid-template-columns: 1fr 320px;
        height: 100%;
    }

    .modal-main {
        padding: 2rem;
        border-right: 1px solid rgba(255, 255, 255, 0.05);
    }

    .modal-sidebar {
        padding: 2rem;
        border-top: none;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding-bottom: 2rem;
    }

    .day-btn {
        font-size: 1rem;
        font-weight: 800;
        border-radius: 0;
    }

    .day-header {
        font-size: 0.85rem;
        padding-bottom: 0.5rem;
    }

    .day-btn.range-start {
        border-radius: 0;
    }

    .day-btn.range-end {
        border-radius: 0;
    }

    .day-btn.selected:not(.range-start):not(.range-end) {
        border-radius: 0;
    }

    .day-price {
        bottom: 6px;
        font-size: 0.65rem;
    }

    .month-label {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    .ticket-header {
        padding: 2rem;
    }

    .ticket-body {
        padding: 0 2rem 2rem 2rem;
        gap: 1.5rem;
    }

    .ticket-row {
        font-size: 0.9rem;
    }

    .ticket-label {
        font-size: 0.75rem;
    }
}