/**
 * HOPE Theater Seat Map Styles
 * Styles for the interactive seating chart
 */

/* Theater Container - Uses flexbox for consistent height */
.theater-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
    position: relative;
    height: 100%; /* Use full available height */
    display: flex;
    flex-direction: column;
}

/* Header Section */
.header {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    color: white;
    padding: 15px 20px;
    text-align: center;
    border-radius: 12px 12px 0 0;
    position: relative;
}

.header-content {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.header h1 {
    font-size: 1.5em;
    margin: 0;
    flex-shrink: 0;
}

/* Floor Selector with Border Trace Animation */
.floor-selector {
    display: inline-flex;
    background: rgba(255,255,255,0.2);
    border-radius: 25px;
    padding: 4px;
    margin: 0;
    position: relative;
}

.floor-selector::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 27px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
    background-size: 200% 100%;
    opacity: 0;
    animation: border-trace 10s ease-in-out infinite;
    z-index: 1;
    pointer-events: none;
}

@keyframes border-trace {
    0%, 95% {
        opacity: 0;
        background-position: -200% 0;
    }
    96% {
        opacity: 1;
        background-position: -200% 0;
    }
    100% {
        opacity: 0;
        background-position: 200% 0;
    }
}

.floor-btn {
    padding: 8px 24px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.8);
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.floor-btn.active {
    background: white;
    color: #7c3aed;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.floor-btn:hover:not(.active) {
    color: white;
}

/* Legend Toggle Button */
.legend-toggle {
    position: absolute;
    left: 20px;
    width: 32px;
    height: 32px;
    border: 2px solid rgba(255,255,255,0.5);
    background: transparent;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.legend-toggle:hover {
    background: rgba(255,255,255,0.2);
    border-color: white;
}

.legend-toggle.active {
    background: white;
    color: #7c3aed;
}

/* Zoom Controls */
.zoom-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    display: flex;
    gap: 5px;
    background: white;
    padding: 5px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.zoom-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(124,58,237,0.1);
    color: #7c3aed;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-btn:hover {
    background: rgba(124,58,237,0.2);
}

.zoom-label {
    padding: 0 10px;
    display: flex;
    align-items: center;
    font-weight: 500;
    min-width: 50px;
    justify-content: center;
}

/* Seating container - Uses flexbox to fill remaining space */
.seating-container {
    flex: 1; /* Take remaining space after header */
    padding: 20px;
    background: #fafafa;
    min-height: 450px; /* Minimum usable height */
    position: relative;
    overflow: hidden;
}

.seating-wrapper {
    width: 100%;
    height: 100%; /* Use full container height */
    position: relative;
    transform-origin: center center;
    transition: transform 0.3s ease;
    cursor: grab;
}

/* Height is now managed dynamically by JavaScript */

.seating-wrapper.dragging {
    cursor: grabbing;
    transition: none;
}

/* SVG Container */
#seat-map {
    width: 100%;
    height: 100%;
}

/* Stage Text */
.stage-text {
    fill: #2d3748;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 6px;
}

/* Individual Seats with Orange Border Animation */
.seat {
    cursor: pointer;
    transition: all 0.3s ease;
    stroke: white;
    stroke-width: 1.5;
    pointer-events: all;
    stroke-dasharray: 88; /* Perimeter of 22x22 rect with rounded corners */
    stroke-dashoffset: 0;
    position: relative;
}

.seat:hover:not(.unavailable) {
    stroke: #ff8c00; /* Orange border */
    stroke-width: 3;
    z-index: 100;
    filter: brightness(1.2);
    animation: draw-border 1s ease-in-out;
}

@keyframes draw-border {
    0% {
        stroke-dashoffset: 88;
        stroke: #ff8c00;
        filter: brightness(1.2) drop-shadow(0 0 4px rgba(255, 140, 0, 0.3));
    }
    50% {
        stroke-dashoffset: 0;
        stroke: #ff8c00;
        filter: brightness(1.3) drop-shadow(0 0 6px rgba(255, 140, 0, 0.5));
    }
    100% {
        stroke-dashoffset: 0;
        stroke: #ff8c00;
        filter: brightness(1.2) drop-shadow(0 0 4px rgba(255, 140, 0, 0.3));
    }
}

/* Pricing Tiers */
.seat.p1 {
    fill: #9b59b6;
}

.seat.p2 {
    fill: #3498db;
}

.seat.p3 {
    fill: #17a2b8;
}

.seat.aa {
    fill: #e67e22;
}

.seat.unavailable {
    fill: #6c757d;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Selected Seats with Enhanced Pulse Animation */
.seat.selected {
    fill: #28a745 !important;
    stroke: #00ff00 !important;
    stroke-width: 3;
    animation: selected-pulse 2s ease-in-out infinite;
}

@keyframes selected-pulse {
    0% {
        stroke: #00ff00;
        stroke-width: 3;
        filter: brightness(1.1) drop-shadow(0 0 2px rgba(0, 255, 0, 0.3));
    }
    50% {
        stroke: #00ff00;
        stroke-width: 3.5;
        filter: brightness(1.2) drop-shadow(0 0 4px rgba(0, 255, 0, 0.4));
    }
    100% {
        stroke: #00ff00;
        stroke-width: 3;
        filter: brightness(1.1) drop-shadow(0 0 2px rgba(0, 255, 0, 0.3));
    }
}

/* Legend */
.legend {
    position: absolute;
    top: 80px;
    left: 0;
    right: 0;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform: translateY(-200%); /* Hidden well above header to avoid blocking clicks */
    opacity: 0;
    z-index: 5; /* Lower z-index when hidden */
    pointer-events: none; /* Prevent blocking clicks when hidden */
}

.legend.visible {
    transform: translateY(0); /* Slide down into view */
    opacity: 1;
    z-index: 15; /* Higher z-index when visible */
    pointer-events: auto; /* Allow clicks when visible */
}

.legend-content {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 15px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

/* Selected Seats Panel */
.selected-seats-panel {
    padding: 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.selected-seats-title {
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 15px;
    color: #2d3748;
}

.seats-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
    margin-bottom: 15px;
}

.seat-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #7c3aed;
    color: white;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
}

.seat-tag .remove {
    cursor: pointer;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
}

.seat-tag .remove:hover {
    background: rgba(255,255,255,0.5);
}

.total-price {
    font-size: 1.5em;
    font-weight: bold;
    color: #7c3aed;
    text-align: right;
}

.empty-message {
    color: #718096;
    font-style: italic;
}

/* Selected Seats Panel Toggle Animation */
.selected-seats-panel {
    position: absolute;
    bottom: var(--footer-height, 80px); /* Position above footer */
    left: 0;
    right: 0;
    background: #f1f5f9;
    border-top: 1px solid #e2e8f0;
    z-index: 5;
    padding: 12px 20px 20px 20px; /* Minimal bottom padding */
    transform: translateY(0); /* Show by default on desktop */
    transition: transform 0.3s ease;
    max-height: 120px;
    overflow-y: auto;
}

.selected-seats-panel.visible {
    transform: translateY(100%); /* Hide when visible class is added on desktop */
}

/* Navigation Hint */
.navigation-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 15px 25px;
    border-radius: 25px;
    z-index: 20;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.navigation-hint.fade-out {
    opacity: 0;
}

.hint-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.hint-icon {
    font-size: 18px;
}

/* Seats Toggle Button in Footer */
.seats-toggle {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px;
    transition: color 0.3s ease;
}

.seats-toggle:hover {
    color: #374151;
}

.seats-toggle.active {
    color: #7c3aed;
}

.toggle-icon {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.seats-toggle.active .toggle-icon {
    transform: rotate(180deg);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    /* Header spacing adjustments */
    .header {
        padding: 12px 10px; /* Reduced padding on mobile */
    }
    
    .header-content {
        gap: 8px; /* Add gap between elements */
    }
    
    /* Legend toggle button - move closer to edge */
    .legend-toggle {
        left: 10px; /* Closer to edge on mobile */
        width: 28px; /* Slightly smaller */
        height: 28px;
        font-size: 14px;
    }
    
    /* Floor selector - smaller on mobile */
    .floor-selector {
        padding: 3px; /* Smaller padding */
        border-radius: 20px;
    }
    
    .floor-btn {
        padding: 6px 16px; /* Smaller buttons on mobile */
        font-size: 14px; /* Smaller text */
        border-radius: 16px;
    }
    
    /* Selected seats panel adjustments */
    /* Ensure modal content allows panel positioning */
    .hope-modal-content {
        overflow: visible; /* Allow panel to show outside modal bounds */
    }
    
    .hope-modal-body {
        overflow: visible; /* Allow panel to show outside body bounds */
    }
    
    .selected-seats-panel {
        /* On mobile, use simpler positioning approach */
        position: fixed;
        bottom: 0; /* Start at very bottom of viewport */
        left: 0;
        right: 0;
        max-height: 150px;
        padding: 15px 20px 0px 20px; /* 0px bottom padding on mobile */
        transform: translateY(calc(100% - 60px)); /* Show just a peek (60px visible) */
        z-index: 5; /* Below footer (footer has z-index: 10) */
        transition: transform 0.3s ease;
    }
    
    .selected-seats-panel.visible {
        /* Show most of panel, leaving space for footer interaction */
        transform: translateY(calc(-100% + 120px)); /* Show panel but leave 120px for footer */
    }
    
    /* Alternative approach - if footer height is calculated correctly, use it */
    .selected-seats-panel[style*="--footer-height"] {
        bottom: var(--footer-height, 100px); /* Use calculated footer height if available */
        transform: translateY(100%); /* Hidden below */
    }
    
    .selected-seats-panel.visible[style*="--footer-height"] {
        transform: translateY(0); /* Show above footer */
    }
}

/* Tooltip */
.tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.tooltip.show {
    opacity: 1;
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid rgba(0, 0, 0, 0.9);
}

/* Product Page Integration */
.hope-seat-selection-wrapper {
    margin: 20px 0;
}

.hope-seat-selection-interface {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    width: 100% !important;
}

.hope-select-seats-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
}

.hope-select-seats-btn .btn-icon {
    display: none !important;
}

.hope-selected-seats-summary {
    margin-top: 15px;
    padding: 15px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.hope-selected-seats-summary h4 {
    margin: 0 0 10px 0;
    color: #2d3748;
    font-size: 16px;
}

.selected-seats-list {
    color: #4a5568;
    font-size: 14px;
    line-height: 1.6;
}