/* MU Seats - Frontend Styles */

/* CSS Variables for default colors - Seat Status */
:root {
    /* Element Colors */
    --mu-seats-stage-fill: #dccdbe;
    --mu-seats-stage-stroke: #dccdbe;
    --mu-seats-stage-text: #000000;

    --mu-seats-door-fill: #dccdbe;
    --mu-seats-door-stroke: #dccdbe;
    --mu-seats-door-text: #000000;

    --mu-seats-balcony-fill: #f8f8f3;
    --mu-seats-balcony-stroke: #f8f8f3;
    --mu-seats-balcony-text: #000000;
}
/* Seat Status Colors */
.legend-color.available,
.seat-available {
    --mu-seats-fill-color: blue;
    --mu-seats-stroke-color: blue;
    --mu-seats-text-color: white;
}

.legend-color.selected,
.seat-selected {
    --mu-seats-fill-color: green;
    --mu-seats-stroke-color: green;
    --mu-seats-text-color: white;
}

.legend-color.pending,
.seat-pending,
.legend-color.sold,
.seat-sold,
.legend-color.na,
.seat-na {
    --mu-seats-fill-color: #bbbbbb;
    --mu-seats-stroke-color: #bbbbbb;
    --mu-seats-text-color: #ffffff;
}

.mu-seats-picker {
    margin: 0 auto;
    background: #fff;
}

/* Legend */
.mu-seats-legend {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    padding: 15px;
    /* border-radius: 4px; */
    font-weight: bold;

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

    .legend-color {
        width: 24px;
        height: 24px;
        border-radius: 50%;
        border: 2px solid #333;
        background: var(--mu-seats-fill-color);
        border-color: var(--mu-seats-stroke-color);
    }
}

/* Canvas */
.mu-seats-picker-canvas-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.mu-seats-picker-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    z-index: 10;
    /* Allow touch events on controls */
    touch-action: auto;
    pointer-events: auto;
    .button {
        min-width: 40px;
        height: 40px;
        padding: 0;
        background: #000 !important;
        color: #fff !important;
        /* border-radius: 4px; */
        font-size: 18px;
        font-weight: bold;
        cursor: pointer;
        transition: all 0.2s ease;
        /* Ensure buttons are clickable/tappable */
        touch-action: auto;
        pointer-events: auto;
        &:focus, &:hover{
            background: #a8815c !important;
        }        
    }
}

.mu-seats-picker-canvas-container {
    position: relative;
    overflow: hidden;
    /* cursor: grab; */
    user-select: none;

    /* Prevent browser handling of touch gestures - we handle them in JS */
    touch-action: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;

    &.is-panning {
        cursor: grabbing;
    }
}

.mu-seats-svg {
    display: block;
    margin: 0 auto;
    /* border-radius: 4px; */
    transform-origin: 0 0;
    width: 100%;
    height: auto;
    &.is-zooming {
        transition: transform 0.25s ease-out;
    }
}

/* Venue Elements */
.venue-elements {
    pointer-events: none;
    font-family: var(--serif);
    text {
        user-select: none;
        pointer-events: none;
        text-anchor: middle;
        dominant-baseline: central;        
    }
    .element-stage {
        rect {
            fill: var(--mu-seats-stage-fill);
            stroke: var(--mu-seats-stage-stroke);
            stroke-width: 2;
        }

        text {
            fill: var(--mu-seats-stage-text);
            font-size: 1.5em;
            font-weight: bold;
        }
    }

    .element-door {
        rect {
            fill: var(--mu-seats-door-fill);
            stroke: var(--mu-seats-door-stroke);
            stroke-width: 1;
        }

        text {
            fill: var(--mu-seats-door-text);
            font-size: 1.25em;
        }
    }
    .element-balcony {
        rect {
            fill: var(--mu-seats-balcony-fill);
            stroke: var(--mu-seats-balcony-stroke);
            stroke-width: 2;
            /* stroke-dasharray: 5, 5; */
        }

        text {
            fill: var(--mu-seats-balcony-text);
            font-size: 1.5em;
            font-weight: bold;
        }
    }

    .element-polygon {
        polygon {
            fill: var(--mu-seats-balcony-fill);
            stroke: var(--mu-seats-balcony-stroke);
            stroke-width: 2;
        }

        text {
            fill: var(--mu-seats-balcony-text);
        }
    }
}

/* Seats */
.seat-group {
    cursor: pointer;
    transition: all 0.2s ease;

    &:focus {
        outline: none;
        .seat-shape {
            stroke: #000;
            stroke-width: 3;
        }
    }
    .seat-shape {
        fill: var(--mu-seats-fill-color);
        stroke: var(--mu-seats-stroke-color);
        stroke-width: 2;
    }
    text {
        user-select: none;
        fill: var(--mu-seats-text-color);
        text-anchor: middle;
        dominant-baseline: central;
        font-size: 0.875em;
    }

    &.seat-available:hover {
        .seat-shape {
            filter: brightness(1.2);
        }
    }

    &.seat-pending,
    &.seat-sold,
    &.seat-na {
        .seat-shape {
            cursor: not-allowed;
        }
    }
}

/* Seat Tooltip */
.mu-seats-tooltip {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1000;
    background: #333;
    color: #fff;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.6;
    white-space: nowrap;
    pointer-events: none;
    transform: translateX(-50%) translateY(-100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.15s ease;
    &.visible {
        visibility: visible;
        opacity: 1;
    }
    .mu-seats-tooltip-arrow {
        position: absolute;
        bottom: -6px;
        left: 50%;
        transform: translateX(-50%);
        width: 0;
        height: 0;
        border-left: 6px solid transparent;
        border-right: 6px solid transparent;
        border-top: 6px solid #333;
    }
}
