/* Public Seatmap - Ticket Purchase Page */
/* Uses Kulturnomie CSS variables for dark/light mode compatibility */

/* Stage is rendered dynamically from variant data via inline styles */

/* Seatmap canvas (scrollable container) */
.ps-canvas {
    position: relative;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
    touch-action: pan-x pan-y;
}

.ps-inner {
    position: relative;
    margin: 0 auto;
    transform-origin: 0 0;
    transition: transform 0.15s ease-out;
}

/* Zoom controls (mobile) */
.ps-zoom-controls {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 16px;
    z-index: 150;
    flex-direction: column;
    gap: 6px;
}

.ps-zoom-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-dark);
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.ps-zoom-btn:active {
    background: var(--secondary-color);
}

.ps-zoom-level {
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
}

.ps-zoom-reset {
    margin-top: 4px;
    font-size: 14px;
}

/* Section labels */
.ps-section-label {
    position: absolute;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
    pointer-events: none;
}

/* Row labels */
.ps-row-label {
    position: absolute;
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    width: 20px;
    text-align: center;
    pointer-events: none;
    line-height: 26px;
}

/* Seats */
.ps-seat {
    position: absolute;
    width: 26px;
    height: 26px;
    border-radius: 5px 5px 8px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    user-select: none;
    box-sizing: border-box;
    border: 1px solid rgba(0,0,0,0.1);
}

.ps-seat:hover:not(.ps-seat-sold):not(.ps-seat-reserved):not(.ps-seat-disabled) {
    transform: scale(1.3);
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.ps-seat.ps-seat-selected {
    transform: scale(1.25);
    z-index: 10;
    border: 2px solid var(--text-dark, #1a1a2e);
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}

.ps-seat.ps-seat-sold,
.ps-seat.ps-seat-reserved {
    background: var(--border-color, #e5e7eb) !important;
    color: var(--text-muted, #d1d5db);
    cursor: not-allowed;
    border-color: var(--border-color, #e5e7eb);
    opacity: 0.6;
}

.ps-seat.ps-seat-sold::after {
    content: "\00d7";
    font-size: 14px;
    color: var(--text-muted);
}

.ps-seat.ps-seat-disabled {
    background: repeating-linear-gradient(
        45deg,
        #d1d5db,
        #d1d5db 2px,
        #e5e7eb 2px,
        #e5e7eb 6px
    ) !important;
    color: #9ca3af;
    cursor: not-allowed;
    border-color: #d1d5db;
    opacity: 0.5;
}

/* Category legend */
.ps-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 0;
}

.ps-legend-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    background: var(--secondary-color);
    cursor: pointer;
    transition: opacity 0.15s, background 0.12s;
    white-space: nowrap;
    border: 1px solid var(--border-color);
}

.ps-legend-chip:hover {
    opacity: 0.8;
}

.ps-legend-chip.ps-dimmed {
    opacity: 0.2;
}

.ps-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
    display: inline-block;
}

.ps-legend-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dark);
}

.ps-legend-price {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

.ps-legend-chip-sold {
    cursor: default;
}

.ps-legend-chip-sold .ps-legend-name {
    color: var(--text-muted);
    font-weight: 600;
}

/* Mobile legend (dropdown) */
.ps-legend-mobile {
    display: none;
}

.ps-legend-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    user-select: none;
}

.ps-dot-mini {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.ps-toggle-text {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dark);
}

.ps-toggle-arrow {
    font-size: 8px;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.ps-legend-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-md, 0 4px 16px rgba(0,0,0,0.12));
    min-width: 220px;
    z-index: 300;
    overflow: hidden;
    margin-top: 4px;
}

.ps-legend-dropdown.ps-dropdown-open {
    display: block;
}

.ps-legend-dd-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background 0.12s, opacity 0.15s;
    border-bottom: 1px solid var(--border-color);
}

.ps-legend-dd-row:last-child {
    border-bottom: none;
}

.ps-legend-dd-row:hover {
    background: var(--secondary-color);
}

.ps-legend-dd-row.ps-dimmed {
    opacity: 0.2;
}

.ps-dd-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dark);
}

.ps-dd-price {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Tooltip */
.ps-tooltip {
    display: none;
    position: fixed;
    z-index: 10000;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 12px;
    color: var(--text-dark);
    box-shadow: var(--shadow-md, 0 4px 16px rgba(0,0,0,0.3));
    pointer-events: none;
    white-space: nowrap;
}

/* Sticky bottom selection bar */
.ps-selected-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    padding: 14px 20px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
}

.ps-selected-bar.active {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ps-selected-info {
    font-size: 14px;
    color: var(--text-muted);
}

.ps-selected-info strong {
    color: var(--text-dark);
    font-size: 18px;
}

.ps-selected-list {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    max-width: 500px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ps-btn-buy {
    background: var(--primary, #e91e63);
    color: #fff;
    border: none;
    padding: 12px 32px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.ps-btn-buy:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.ps-btn-buy:active {
    transform: translateY(0);
}

.ps-btn-buy:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Loading spinner */
.ps-loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 15px;
}

.ps-loading::after {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary, #e91e63);
    border-radius: 50%;
    animation: psSpin 0.6s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes psSpin {
    to { transform: rotate(360deg); }
}

/* Event header on buy page */
.ps-event-header {
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.ps-event-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 4px;
}

.ps-event-meta {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Bottom padding for fixed bar */
.ps-seatmap-area {
    padding-bottom: 100px;
}

/* Step indicator */
.ps-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 20px;
    padding: 0 20px;
}

.ps-step {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    transition: color 0.2s;
}

.ps-step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    background: var(--border-color);
    color: var(--text-muted);
    transition: background 0.2s, color 0.2s;
}

.ps-step.ps-step-active {
    color: var(--primary, #e91e63);
}

.ps-step.ps-step-active .ps-step-num {
    background: var(--primary, #e91e63);
    color: #fff;
}

.ps-step.ps-step-done .ps-step-num {
    background: #4caf50;
    color: #fff;
}

.ps-step-line {
    flex: 1;
    height: 2px;
    background: var(--border-color);
    margin: 0 12px;
    max-width: 60px;
}

/* Payment summary in step 2 */
.ps-payment-summary {
    padding: 12px 16px;
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

/* Stripe Payment Element container */
#psPaymentElement {
    min-height: 120px;
    padding: 4px 0;
}

/* Checkout modal overrides */
.ps-modal .modal-dialog {
    max-height: 100vh;
}

.ps-modal .modal-body {
    overflow-y: auto;
    max-height: calc(100vh - 160px);
    -webkit-overflow-scrolling: touch;
}

.ps-modal .modal-content {
    background: var(--bg-card);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.ps-modal .modal-header {
    border-bottom-color: var(--border-color);
}

.ps-modal .modal-footer {
    border-top-color: var(--border-color);
}

.ps-modal .form-control {
    background: var(--bg-body, #fff);
    color: var(--text-dark);
    border-color: var(--border-color);
}

.ps-modal .form-control:focus {
    border-color: var(--primary, #e91e63);
    box-shadow: 0 0 0 0.2rem rgba(233, 30, 99, 0.15);
}

/* Success ticket list */
.ps-ticket-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    background: var(--secondary-color);
}

.ps-ticket-code {
    font-family: monospace;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-dark);
}

.ps-ticket-seat {
    font-size: 13px;
    color: var(--text-muted);
}

.ps-ticket-link {
    font-size: 13px;
}

/* Desktop: show legend chips, hide mobile toggle */
@media (min-width: 769px) {
    .ps-legend-desktop { display: flex; }
    .ps-legend-mobile { display: none; }
    .ps-legend-dropdown { display: none !important; }
}

/* Mobile */
@media (max-width: 768px) {
    .ps-legend-desktop { display: none !important; }
    .ps-legend-mobile { display: block; position: relative; }

    .ps-seat {
        width: 22px;
        height: 22px;
        font-size: 7px;
        border-radius: 4px 4px 6px 6px;
    }

    .ps-row-label {
        font-size: 8px;
        line-height: 22px;
    }

    .ps-section-label {
        font-size: 9px;
    }

    .ps-zoom-controls {
        display: flex;
    }

    .ps-zoom-controls.ps-zoom-shifted {
        bottom: 130px;
    }

    .ps-canvas {
        overflow: auto;
        touch-action: none;
    }

    .ps-modal .modal-dialog {
        margin: 0;
        max-width: 100%;
        min-height: 100vh;
    }

    .ps-modal .modal-content {
        min-height: 100vh;
        border: none;
        border-radius: 0;
    }

    .ps-modal .modal-body {
        max-height: calc(100vh - 120px);
    }

    .ps-selected-bar.active {
        flex-direction: column;
        text-align: center;
        gap: 8px;
        padding: 12px 14px;
    }

    .ps-selected-list {
        white-space: normal;
        max-width: 100%;
    }

    .ps-btn-buy {
        width: 100%;
        padding: 14px 20px;
        font-size: 16px;
    }

    .ps-event-title {
        font-size: 17px;
    }
}

