/**
 * Venuera Venue Designer Frontend Styles
 * Interactive seat selection for customers
 */

/* ========================================
   Container
   ======================================== */
.venuera-venue-chart-container {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 24px;
    margin: 24px 0;
}

/* ========================================
   Occurrence Selector
   ======================================== */
.venuera-venue-occurrence-selector {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.venuera-venue-occurrence-selector label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 14px;
}

.venuera-venue-occurrence-select {
    width: 100%;
    max-width: 400px;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.venuera-venue-occurrence-select:hover {
    border-color: #3659E3;
}

.venuera-venue-occurrence-select:focus {
    border-color: #3659E3;
    box-shadow: 0 0 0 3px rgba(54, 89, 227, 0.1);
    outline: none;
}

/* ========================================
   Zone Navigation (Frontend)
   ======================================== */
/* The zone bar lives ABOVE the chart wrapper (not inside it), so the floating
   legend / zoom controls that overlay the map can never cover the tabs. */
.venuera-venue-zone-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 0 0 12px;
    background: transparent;
    /* Many zones scroll sideways instead of wrapping into a tall block that
       eats the map's vertical space. */
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

.venuera-venue-zone-nav::-webkit-scrollbar {
    display: none;
}

.venuera-venue-zone-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.venuera-venue-zone-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #f5f5f5;
    border: 2px solid transparent;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    transition: all 0.2s ease;
}

.venuera-venue-zone-tab:hover {
    background: #e8e8e8;
    color: #333;
}

.venuera-venue-zone-tab.active {
    background: #3659E3;
    border-color: #3659E3;
    color: #fff;
}

.venuera-venue-zone-tab-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.venuera-venue-zone-tab.active .venuera-venue-zone-tab-color {
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.venuera-venue-zone-tab-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   Chart Wrapper
   ======================================== */
.venuera-venue-chart-wrapper {
    position: relative;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    overflow: hidden;
    min-height: 400px;
}

.venuera-venue-chart-controls {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.venuera-zoom-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: #ffffff;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.venuera-zoom-btn:hover {
    background: #3659E3;
    color: #fff;
    transform: translateY(-2px);
}

.venuera-zoom-btn svg {
    width: 20px;
    height: 20px;
}

.venuera-venue-canvas-container {
    width: 100%;
    height: 500px;
    position: relative;
    cursor: grab;
    /* Let the picker own touch gestures (pan/pinch handled in JS) instead of
       the browser scrolling/zooming the page over the canvas. */
    touch-action: none;
    -ms-touch-action: none;
}

.venuera-venue-canvas-container:active {
    cursor: grabbing;
}

#venuera-venue-display-canvas {
    position: absolute;
    top: 0;
    left: 0;
}

/* High-performance renderer canvas (large charts) — fills the same container
   the Fabric canvas uses; only one of the two is visible at a time. */
.venuera-venue-bigmap-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* ========================================
   Legend (floating inside canvas, top left)
   ======================================== */
.venuera-venue-legend {
    position: absolute;
    top: 16px;
    left: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.venuera-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #555;
    font-weight: 500;
}

.venuera-legend-color {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.venuera-legend-item.available .venuera-legend-color {
    background: #2DC26D;
}

.venuera-legend-item.selected .venuera-legend-color {
    background: #3659E3;
}

.venuera-legend-item.sold .venuera-legend-color {
    background: #9E9E9E;
}

.venuera-legend-item.reserved .venuera-legend-color {
    background: #F6AD55;
}


/* ========================================
   Cart Summary (floating inside canvas)
   ======================================== */
.venuera-venue-cart-summary {
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.venuera-cart-total {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.venuera-total-amount {
    color: #3659E3;
    font-size: 20px;
}

.venuera-proceed-to-cart {
    padding: 12px 28px !important;
    font-size: 15px !important;
    text-align: center;
    background: #3659E3 !important;
    border-color: #3659E3 !important;
    border-radius: 8px !important;
    white-space: nowrap;
    flex-shrink: 0;
}

.venuera-proceed-to-cart:hover {
    background: #2A4BC7 !important;
    border-color: #2A4BC7 !important;
}

/* ========================================
   Seat Tooltip
   ======================================== */
.venuera-seat-tooltip {
    position: absolute;
    background: #1E1E2D;
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    transform: translateX(-50%);
}

.venuera-seat-tooltip::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #1E1E2D;
}

.venuera-seat-tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.venuera-seat-tooltip-label {
    color: #9E9E9E;
}

.venuera-seat-tooltip-value {
    font-weight: 600;
}

.venuera-seat-tooltip-price {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 15px;
    font-weight: 700;
    color: #2DC26D;
}

.venuera-seat-tooltip-hint {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 11px;
    color: #9E9E9E;
    font-style: italic;
}

/* ========================================
   Modal
   ======================================== */
.venuera-venue-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    padding: 20px;
}

.venuera-venue-modal-content {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    overflow: auto;
    position: relative;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.venuera-venue-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    z-index: 10;
    transition: all 0.2s ease;
}

.venuera-venue-modal-close:hover {
    background: #E53E3E;
    color: #fff;
}

.venuera-venue-modal-body {
    padding: 20px;
}

/* Full-screen overlay: use most of the viewport so the seat map is large.
   Scoped to the modal so the inline (content-width) chart is unaffected. */
.venuera-venue-modal {
    padding: 2.5vh 2.5vw;
}

.venuera-venue-modal .venuera-venue-modal-content {
    width: 95vw;
    max-width: none;
    height: 95vh;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
}

.venuera-venue-modal .venuera-venue-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.venuera-venue-modal .venuera-venue-chart-container {
    margin: 0;
    box-shadow: none;
    padding: 8px;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.venuera-venue-modal .venuera-venue-chart-wrapper {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.venuera-venue-modal .venuera-venue-canvas-container {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
}

/* The zone bar shares its row with the overlay close button; keep the tabs
   clear of it on both sides so centering stays symmetric. */
.venuera-venue-modal .venuera-venue-zone-nav {
    margin-left: 48px;
    margin-right: 48px;
}

/* ========================================
   Button Trigger
   ======================================== */
.venuera-venue-chart-trigger {
    text-align: center;
    margin: 24px 0;
}

.venuera-open-venue-chart,
.venuera-toggle-venue-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 30px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    color: #fff !important;
    background: #3659E3 !important;
    border: none !important;
    border-radius: 10px !important;
    box-shadow: 0 2px 6px rgba(54, 89, 227, 0.25);
    cursor: pointer;
    text-decoration: none !important;
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.venuera-open-venue-chart:hover,
.venuera-toggle-venue-inline:hover,
.venuera-open-venue-chart:focus,
.venuera-toggle-venue-inline:focus {
    background: #2A4BC7 !important;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(54, 89, 227, 0.35);
}

.venuera-open-venue-chart:active,
.venuera-toggle-venue-inline:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(54, 89, 227, 0.25);
}

.venuera-open-venue-chart svg,
.venuera-toggle-venue-inline svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

/* ========================================
   Seat States
   ======================================== */
.seat-available {
    cursor: pointer;
    transition: all 0.15s ease;
}

.seat-available:hover {
    transform: scale(1.2);
    filter: brightness(1.1);
}

.seat-selected {
    animation: seatPulse 0.3s ease;
}

@keyframes seatPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1.1); }
}

.seat-sold,
.seat-reserved {
    cursor: not-allowed;
    opacity: 0.6;
}

/* ========================================
   Responsive
   ======================================== */
@media screen and (max-width: 768px) {
    .venuera-venue-chart-container {
        padding: 16px;
        margin: 16px 0;
    }

    .venuera-venue-canvas-container {
        height: 60vh;
        min-height: 340px;
    }

    /* Zone tabs: one scrollable row, never wrapped into a tall stack. */
    .venuera-venue-zone-nav {
        justify-content: flex-start;
        padding-bottom: 10px;
    }

    /* Margin (not padding): the scroll box itself must end before the close
       button, otherwise scrolled tabs are painted underneath it. */
    .venuera-venue-modal .venuera-venue-zone-nav {
        margin-left: 0;
        margin-right: 44px;
    }

    .venuera-venue-modal-close {
        width: 36px;
        height: 36px;
        top: 10px;
        right: 10px;
        font-size: 20px;
    }

    .venuera-venue-zone-tabs {
        flex-wrap: nowrap;
        justify-content: flex-start;
    }

    .venuera-venue-zone-tab {
        flex: 0 0 auto;
        padding: 9px 16px;
        font-size: 13px;
    }

    .venuera-venue-zone-tab-name {
        max-width: 120px;
    }

    .venuera-venue-cart-summary {
        flex-direction: column;
        gap: 12px;
        left: 12px;
        right: 12px;
        bottom: 12px;
        padding: 14px 16px;
    }

    .venuera-cart-total {
        width: 100%;
        justify-content: space-between;
    }

    .venuera-proceed-to-cart {
        width: 100%;
    }

    .venuera-venue-legend {
        top: 12px;
        left: 12px;
        gap: 8px;
        padding: 8px 10px;
        /* Stay clear of the (now vertical) zoom controls on the right. */
        max-width: calc(100% - 80px);
    }

    .venuera-legend-item {
        font-size: 11px;
    }

    .venuera-legend-color {
        width: 12px;
        height: 12px;
    }

    .venuera-venue-modal-content {
        border-radius: 12px;
        max-height: 95vh;
    }

    /* Finger-friendly zoom controls: larger hit targets, stacked vertically so
       the legend keeps the whole top-left of the map. */
    .venuera-venue-chart-controls {
        flex-direction: column;
        gap: 8px;
        top: 12px;
        right: 12px;
    }

    .venuera-zoom-btn {
        width: 44px;
        height: 44px;
    }

    .venuera-zoom-btn svg {
        width: 22px;
        height: 22px;
    }
}

/* Phones */
@media screen and (max-width: 480px) {
    .venuera-venue-chart-container {
        padding: 12px;
    }

    .venuera-venue-zone-tab {
        padding: 8px 14px;
        font-size: 12px;
        gap: 6px;
    }

    .venuera-venue-zone-tab-name {
        max-width: 96px;
    }

    .venuera-venue-legend {
        gap: 6px;
        padding: 6px 8px;
        max-width: calc(100% - 72px);
    }

    .venuera-legend-item {
        font-size: 10px;
        gap: 4px;
    }

    .venuera-legend-color {
        width: 10px;
        height: 10px;
        border-width: 1px;
    }

    .venuera-venue-cart-summary {
        padding: 12px 14px;
    }

    .venuera-cart-total {
        font-size: 16px;
    }

    .venuera-total-amount {
        font-size: 18px;
    }
}

/* ========================================
   Loading State
   ======================================== */
.venuera-venue-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.venuera-venue-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e0e0e0;
    border-top-color: #3659E3;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   Error State
   ======================================== */
.venuera-venue-error {
    text-align: center;
    padding: 40px;
    color: #E53E3E;
}

.venuera-venue-error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* ========================================
   Notifications (Toast)
   ======================================== */
.venuera-venue-notification {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 24px 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 16px;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 90%;
}

.venuera-venue-notification.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.venuera-venue-notification .notification-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.venuera-venue-notification .notification-message {
    font-size: 16px;
    font-weight: 500;
    color: #1a1a1a;
    line-height: 1.4;
}

/* Warning type */
.venuera-notification-warning {
    background: linear-gradient(135deg, #FFF9E6 0%, #FFF3CD 100%);
    border: 2px solid #FFD43B;
}

.venuera-notification-warning .notification-message {
    color: #856404;
}

/* Success type */
.venuera-notification-success {
    background: linear-gradient(135deg, #E6F7ED 0%, #D4EDDA 100%);
    border: 2px solid #48C774;
}

.venuera-notification-success .notification-message {
    color: #155724;
}

/* Error type */
.venuera-notification-error {
    background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%);
    border: 2px solid #F87171;
}

.venuera-notification-error .notification-message {
    color: #991B1B;
}

/* Info type */
.venuera-notification-info {
    background: linear-gradient(135deg, #E0F2FE 0%, #BAE6FD 100%);
    border: 2px solid #38BDF8;
}

.venuera-notification-info .notification-message {
    color: #0369A1;
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .venuera-venue-chart-controls,
    .venuera-venue-cart-summary,
    .venuera-zoom-btn {
        display: none !important;
    }
}

