/**
 * TicketSeller — Seat Map Styles.
 *
 * Designed to work with Tailwind CSS utility classes
 * while providing seat-map-specific component styles.
 *
 * @package TicketSellerCore
 */

/* ----------------------------------------------------------------
   Container
   ---------------------------------------------------------------- */
.tsc-seatmap-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    font-family: system-ui, -apple-system, sans-serif;
    user-select: none;
    -webkit-user-select: none;
}

/* ----------------------------------------------------------------
   Toolbar
   ---------------------------------------------------------------- */
.tsc-seatmap-toolbar {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    padding: 8px 0;
}

.tsc-seatmap-toolbar button {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #fff;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #334155;
    transition: all 0.15s ease;
}

.tsc-seatmap-toolbar button:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

/* ----------------------------------------------------------------
   Viewport & Canvas (Pan & Zoom)
   ---------------------------------------------------------------- */
.tsc-seatmap-viewport {
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    min-height: 300px;
    max-height: 70vh;
    cursor: grab;
    touch-action: none;
    position: relative;
}

.tsc-seatmap-canvas {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 32px;
    min-width: 100%;
    transform-origin: center center;
    transition: transform 0.1s ease-out;
}

/* ----------------------------------------------------------------
   Stage
   ---------------------------------------------------------------- */
.tsc-stage {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    color: #e0e7ff;
    text-align: center;
    padding: 12px 48px;
    border-radius: 0 0 50% 50% / 0 0 30px 30px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 24px;
    min-width: 200px;
    box-shadow: 0 4px 16px rgba(30, 27, 75, 0.3);
}

.tsc-stage-bottom {
    border-radius: 50% 50% 0 0 / 30px 30px 0 0;
    margin-bottom: 0;
    margin-top: 24px;
    order: 999;
}

/* ----------------------------------------------------------------
   Sections
   ---------------------------------------------------------------- */
.tsc-sections-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.tsc-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.tsc-section-label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
    padding: 3px 12px;
    background: #e2e8f0;
    border-radius: 4px;
}

.tsc-aisle {
    height: 16px;
}

/* ----------------------------------------------------------------
   Rows
   ---------------------------------------------------------------- */
.tsc-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tsc-row-label {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.tsc-seats-wrap {
    display: flex;
    gap: 4px;
    align-items: center;
}

/* ----------------------------------------------------------------
   Seats
   ---------------------------------------------------------------- */
.tsc-seat {
    width: 28px;
    height: 28px;
    border-radius: 6px 6px 8px 8px;
    border: 2px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    position: relative;
    transition: all 0.15s ease;
    padding: 0;
    outline: none;
}

.tsc-seat:focus-visible {
    outline: 2px solid #6d28d9;
    outline-offset: 2px;
}

.tsc-seat-label {
    font-size: 9px;
    font-weight: 600;
    line-height: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
}

.tsc-seatmap-canvas[style*="scale(1.5)"] .tsc-seat-label,
.tsc-seatmap-canvas[style*="scale(2)"] .tsc-seat-label,
.tsc-seatmap-canvas[style*="scale(2.5)"] .tsc-seat-label,
.tsc-seatmap-canvas[style*="scale(3)"] .tsc-seat-label {
    opacity: 1;
}

/* Available */
.tsc-seat-available {
    background: #ddd6fe;
    border-color: #c4b5fd;
    color: #5b21b6;
}

.tsc-seat-available:hover {
    background: #c4b5fd;
    border-color: #a78bfa;
    transform: scale(1.15);
    z-index: 1;
}

.tsc-seat-available:hover .tsc-seat-label {
    opacity: 1;
}

/* Selected */
.tsc-seat-selected {
    background: #6d28d9;
    border-color: #5b21b6;
    color: #fff;
    transform: scale(1.1);
    box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.3);
    z-index: 2;
}

.tsc-seat-selected .tsc-seat-label {
    opacity: 1;
}

/* Locked (by another user) */
.tsc-seat-locked {
    background: #fde68a;
    border-color: #fbbf24;
    color: #92400e;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Booked / Sold */
.tsc-seat-booked {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
    opacity: 0.5;
}

/* Disabled */
.tsc-seat-disabled {
    background: #f1f5f9;
    border-color: #e2e8f0;
    cursor: not-allowed;
    opacity: 0.3;
}

/* Type-specific seat colors (applied alongside status) */
.tsc-seat-vip.tsc-seat-available {
    background: #fef3c7;
    border-color: #fbbf24;
    color: #92400e;
}

.tsc-seat-vip.tsc-seat-available:hover {
    background: #fde68a;
    border-color: #f59e0b;
}

.tsc-seat-premium.tsc-seat-available {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1e40af;
}

.tsc-seat-wheelchair.tsc-seat-available {
    background: #d1fae5;
    border-color: #6ee7b7;
    color: #065f46;
}

.tsc-seat-business.tsc-seat-available {
    background: #fef3c7;
    border-color: #fbbf24;
}

.tsc-seat-economy.tsc-seat-available {
    background: #ddd6fe;
    border-color: #c4b5fd;
}

/* Gap & Aisle */
.tsc-seat-gap {
    display: inline-block;
    height: 28px;
}

.tsc-seat-aisle {
    display: inline-block;
    width: 20px;
    height: 28px;
}

/* ----------------------------------------------------------------
   Legend
   ---------------------------------------------------------------- */
.tsc-seatmap-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    padding: 12px 0;
    font-size: 13px;
}

.tsc-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #475569;
}

.tsc-legend-dot {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 2px solid transparent;
    flex-shrink: 0;
}

.tsc-legend-dot.tsc-seat-available {
    background: #ddd6fe;
    border-color: #c4b5fd;
}

.tsc-legend-dot.tsc-seat-selected {
    background: #6d28d9;
    border-color: #5b21b6;
}

.tsc-legend-dot.tsc-seat-locked {
    background: #fde68a;
    border-color: #fbbf24;
}

.tsc-legend-dot.tsc-seat-booked {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

/* ----------------------------------------------------------------
   Selection Summary
   ---------------------------------------------------------------- */
.tsc-seatmap-summary {
    margin-top: 16px;
    padding: 16px 20px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.tsc-seatmap-summary h4 {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 12px;
}

.tsc-seatmap-summary table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.tsc-seatmap-summary th,
.tsc-seatmap-summary td {
    padding: 6px 10px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
}

.tsc-seatmap-summary th {
    font-weight: 600;
    color: #64748b;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tsc-seatmap-summary tfoot td {
    border-top: 2px solid #e2e8f0;
    border-bottom: none;
    padding-top: 10px;
}

/* ----------------------------------------------------------------
   Loader
   ---------------------------------------------------------------- */
.tsc-seatmap-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(248, 250, 252, 0.9);
    font-size: 14px;
    color: #64748b;
    z-index: 10;
    border-radius: 12px;
}

.tsc-seatmap-loader[style*="display: none"] {
    pointer-events: none;
}

/* Empty state */
.tsc-seatmap-empty {
    padding: 40px 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 15px;
}

/* ----------------------------------------------------------------
   Responsive — Mobile First
   ---------------------------------------------------------------- */
@media (max-width: 640px) {
    .tsc-seatmap-canvas {
        padding: 16px 12px;
    }

    .tsc-seat {
        width: 22px;
        height: 22px;
        border-radius: 4px 4px 6px 6px;
    }

    .tsc-seats-wrap {
        gap: 2px;
    }

    .tsc-row {
        gap: 4px;
    }

    .tsc-row-label {
        font-size: 9px;
        width: 14px;
    }

    .tsc-stage {
        padding: 8px 24px;
        font-size: 11px;
        letter-spacing: 2px;
        margin-bottom: 16px;
    }

    .tsc-seatmap-summary table {
        font-size: 12px;
    }

    .tsc-seatmap-legend {
        gap: 10px;
        font-size: 11px;
    }
}

@media (max-width: 400px) {
    .tsc-seat {
        width: 18px;
        height: 18px;
    }

    .tsc-seats-wrap {
        gap: 1px;
    }
}
