/**
 * ESB Booking Modal Styles
 * Eventbrite-style booking experience
 */

/* CSS Variables */
:root {
    --esb-primary: #5a55d2;
    --esb-primary-hover: #4a45c2;
    --esb-text: #1e0a3c;
    --esb-text-secondary: #6f7287;
    --esb-border: #dbdae3;
    --esb-bg: #ffffff;
    --esb-bg-light: #f8f7fa;
    --esb-success: #2dc26b;
    --esb-warning: #f5a623;
    --esb-danger: #d93900;
    --esb-radius: 8px;
    --esb-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Modal Base */
body.esb-modal-open {
    overflow: hidden;
}

.esb-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.esb-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.esb-modal-container {
    position: relative;
    z-index: 1;
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    background: var(--esb-bg);
    border-radius: var(--esb-radius);
    box-shadow: var(--esb-shadow);
    overflow: hidden;
}

.esb-modal-content {
    display: flex;
    height: 100%;
    max-height: 90vh;
}

.esb-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: none;
    background: var(--esb-bg);
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 10;
    transition: transform 0.2s, box-shadow 0.2s;
}

.esb-modal-close:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Modal Layout */
.esb-modal-body {
    display: flex;
    width: 100%;
}

.esb-modal-left {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    max-height: 90vh;
}

.esb-modal-right {
    width: 280px;
    background: var(--esb-bg-light);
    border-left: 1px solid var(--esb-border);
    display: none;
}

@media (min-width: 768px) {
    .esb-modal-right {
        display: block;
    }
}

.esb-modal-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--esb-text);
    margin: 0 0 24px 0;
}

/* Event Preview */
.esb-event-preview {
    padding: 24px;
    text-align: center;
}

.esb-preview-image {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: var(--esb-radius);
    overflow: hidden;
    margin-bottom: 16px;
    background: var(--esb-border);
}

.esb-preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.esb-preview-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--esb-text);
    margin: 0 0 24px 0;
}

.esb-preview-cart {
    display: flex;
    justify-content: center;
}

.esb-cart-icon {
    font-size: 48px;
    opacity: 0.3;
}

/* Booking Steps */
.esb-booking-steps {
    margin-bottom: 24px;
}

.esb-step {
    border: 1px solid var(--esb-border);
    border-radius: var(--esb-radius);
    margin-bottom: 12px;
    overflow: hidden;
}

.esb-step-header {
    display: flex;
    align-items: center;
    padding: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.esb-step-header:hover {
    background: var(--esb-bg-light);
}

.esb-step-icon {
    font-size: 18px;
    margin-right: 12px;
}

.esb-step-label {
    font-weight: 600;
    color: var(--esb-text);
}

.esb-step-value {
    margin-left: auto;
    color: var(--esb-primary);
    font-weight: 500;
}

.esb-step-content {
    padding: 0 16px 16px;
    border-top: 1px solid var(--esb-border);
}

.esb-step.esb-step-active .esb-step-header {
    background: var(--esb-bg-light);
}

.esb-step.esb-step-completed .esb-step-label {
    color: var(--esb-text-secondary);
}

/* Calendar */
.esb-calendar {
    margin-bottom: 16px;
}

.esb-calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.esb-calendar-nav button {
    width: 32px;
    height: 32px;
    border: 1px solid var(--esb-border);
    background: var(--esb-bg);
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.esb-calendar-nav button:hover:not(:disabled) {
    background: var(--esb-bg-light);
    border-color: var(--esb-primary);
}

.esb-calendar-nav button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.esb-cal-month {
    font-weight: 600;
    color: var(--esb-text);
}

.esb-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 8px;
}

.esb-weekday {
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    color: var(--esb-text-secondary);
    padding: 8px 0;
}

.esb-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.esb-calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border-radius: 4px;
    cursor: default;
    transition: all 0.2s;
}

.esb-calendar-day.esb-empty {
    background: transparent;
}

.esb-calendar-day.esb-past,
.esb-calendar-day.esb-unavailable {
    color: var(--esb-border);
}

.esb-calendar-day.esb-available {
    cursor: pointer;
    border: 1px solid var(--esb-border);
}

.esb-calendar-day.esb-available:hover {
    border-color: var(--esb-primary);
    background: rgba(90, 85, 210, 0.1);
}

.esb-calendar-day.esb-selected {
    background: var(--esb-primary) !important;
    color: white !important;
    border-color: var(--esb-primary) !important;
}

.esb-calendar-day.esb-high-demand {
    background: rgba(245, 166, 35, 0.2);
}

.esb-calendar-day.esb-sold-out {
    text-decoration: line-through;
    color: var(--esb-text-secondary);
    background: repeating-linear-gradient(45deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.05) 2px,
            rgba(0, 0, 0, 0.05) 4px);
}

/* Calendar Legend */
.esb-calendar-legend {
    display: flex;
    gap: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--esb-border);
}

.esb-legend-item {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: var(--esb-text-secondary);
}

.esb-legend-color {
    width: 16px;
    height: 16px;
    border-radius: 2px;
    margin-right: 6px;
}

.esb-legend-high .esb-legend-color {
    background: rgba(245, 166, 35, 0.4);
}

.esb-legend-sold .esb-legend-color {
    background: repeating-linear-gradient(45deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.1) 2px,
            rgba(0, 0, 0, 0.1) 4px);
    border: 1px solid var(--esb-border);
}

/* Time Slots */
.esb-timeslots {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.esb-timeslot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border: 1px solid var(--esb-border);
    border-radius: var(--esb-radius);
    cursor: pointer;
    transition: all 0.2s;
}

.esb-timeslot:hover:not(.esb-sold-out) {
    border-color: var(--esb-primary);
    background: rgba(90, 85, 210, 0.05);
}

.esb-timeslot.esb-selected {
    border-color: var(--esb-primary);
    border-width: 2px;
    background: rgba(90, 85, 210, 0.1);
}

.esb-timeslot.esb-sold-out {
    opacity: 0.5;
    cursor: not-allowed;
}

.esb-slot-time {
    font-weight: 500;
    color: var(--esb-text);
}

.esb-slot-status {
    font-size: 12px;
    color: var(--esb-danger);
    text-transform: uppercase;
}

/* Tickets */
.esb-tickets-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.esb-ticket-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border: 1px solid var(--esb-border);
    border-radius: var(--esb-radius);
    transition: all 0.2s;
}

.esb-ticket-item:hover:not(.esb-ticket-unavailable) {
    border-color: var(--esb-primary);
}

.esb-ticket-unavailable {
    opacity: 0.5;
}

.esb-ticket-info {
    flex: 1;
}

.esb-ticket-name {
    font-weight: 600;
    color: var(--esb-text);
    margin-bottom: 4px;
}

.esb-ticket-price {
    font-size: 14px;
    color: var(--esb-text-secondary);
    margin-bottom: 4px;
}

.esb-ticket-sales-end {
    font-size: 12px;
    color: var(--esb-warning);
}

.esb-ticket-sold-out,
.esb-ticket-ended {
    font-size: 12px;
    color: var(--esb-danger);
    text-transform: uppercase;
}

.esb-ticket-qty {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--esb-bg-light);
    border-radius: 20px;
    padding: 4px;
}

.esb-ticket-minus,
.esb-ticket-plus {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--esb-primary);
    color: white;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.esb-ticket-minus:hover:not(:disabled),
.esb-ticket-plus:hover:not(:disabled) {
    background: var(--esb-primary-hover);
    transform: scale(1.1);
}

.esb-ticket-minus:disabled,
.esb-ticket-plus:disabled {
    background: var(--esb-border);
    cursor: not-allowed;
}

.esb-ticket-count {
    min-width: 24px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
}

/* Buttons */
.esb-btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--esb-radius);
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.esb-btn-primary,
.esb-btn-secondary {
    background: var(--esb-primary);
    color: white;
}

.esb-btn-primary:hover:not(:disabled),
.esb-btn-secondary:hover:not(:disabled) {
    background: var(--esb-primary-hover);
}

.esb-btn-primary:disabled,
.esb-btn-secondary:disabled {
    background: var(--esb-border);
    cursor: not-allowed;
}

.esb-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 24px;
    border-top: 1px solid var(--esb-border);
}

/* Success Message */
.esb-success-message {
    text-align: center;
    padding: 48px 24px;
}

.esb-success-icon {
    width: 64px;
    height: 64px;
    background: var(--esb-success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 24px;
}

.esb-success-message h3 {
    font-size: 24px;
    color: var(--esb-text);
    margin: 0 0 24px 0;
}

.esb-success-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.esb-success-actions .esb-btn {
    flex: 1;
    max-width: 200px;
}

/* Loading Indicator */
.esb-loading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    color: var(--esb-text-secondary);
    font-size: 14px;
}

.esb-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--esb-border);
    border-top-color: var(--esb-primary);
    border-radius: 50%;
    margin-right: 10px;
    animation: esb-spin 0.8s linear infinite;
}

@keyframes esb-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 767px) {
    .esb-modal-container {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .esb-modal-left {
        padding: 20px;
    }

    .esb-modal-title {
        font-size: 20px;
    }

    .esb-success-actions {
        flex-direction: column;
    }

    .esb-success-actions .esb-btn {
        max-width: none;
    }
}