/* ── LAN Party Manager: Frontend ─────────────────────────────────────────── */

:root {
    --lan-primary:    #2563eb;
    --lan-frei:       #22c55e;
    --lan-vorgemerkt: #f97316;
    --lan-hold:       #eab308;
    --lan-reserviert: #ef4444;
    --lan-mine:       #3b82f6;
    --lan-dark-bg:    #1e293b;
    --lan-dark-text:  #e2e8f0;
    --lan-radius:     8px;
}

/* ── Wrapper ─────────────────────────────────────────────────────────────── */
.lan-seatmap-wrap {
    position: relative;
    width: 100%;
    background: #0f172a; /* Dark Mode Standard */
    /*border-radius: var(--lan-radius);*/
    overflow: hidden;
    font-family: "Roboto", -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--lan-dark-text);
    /*box-shadow: 0 4px 24px rgba(0,0,0,0.3);*/
    user-select: none;
}

/* Light Mode: weisser Sitzplan-Hintergrund */
html:not(.dark) .lan-seatmap-wrap {
    background: #ffffff;
    color: #fefefe;
    /*box-shadow: 0 2px 12px rgba(0,0,0,0.08);*/
}

/* ── Status Bar ──────────────────────────────────────────────────────────── */
.lan-status-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    /* Nur horizontaler Abstand hier - der vertikale Abstand zu evtl.
       darunterliegenden Hinweiszeilen kommt bewusst vom margin-top der
       Hinweise selbst (.lan-notice/.lan-addon-bar), nicht von "gap": manche
       Hinweise sind direkte Geschwister-Elemente hier, andere stecken
       verschachtelt in .lan-ticket-status (kein Flex-Kontext) - "gap" würde
       nur im ersten Fall wirken und zu uneinheitlichem Abstand führen. */
    column-gap: 10px;
    padding: 10px 14px;
    background: #1e293b;
    border-bottom: 1px solid #1e293b;
    font-size: 12px;
}

html:not(.dark) .lan-status-bar {
    background: #1e293b;
    border-bottom: 1px solid #1e293b;
    color: #1e293b;
}

.lan-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.lan-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: #94a3b8;
}

html:not(.dark) .lan-legend-item {
    color: #fefefe;
}

.lan-legend-item::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.lan-status-frei::before       { background: var(--lan-frei); }
.lan-status-vorgemerkt::before { background: var(--lan-vorgemerkt); }
.lan-status-hold::before       { background: var(--lan-hold); }
.lan-status-reserviert::before { background: var(--lan-reserviert); }
.lan-status-mine::before       { background: var(--lan-mine); }

.lan-ticket-status {
    margin-left: auto;
    font-size: 12px;
    color: #e2e8f0 !important; /* Fallback: immer lesbar auf dunkler Status-Bar */
}

/* Dark Mode – hellgrün */
html.dark .lan-ticket-ok,
.lan-ticket-ok {
    color: #86efac !important;
}

/* Light Mode – dunkles Grün für Kontrast auf heller Status-Bar */
html:not(.dark) .lan-ticket-ok {
    color: #15803d !important;
}

.lan-ticket-missing {
    color: #fca5a5 !important;
}
html:not(.dark) .lan-ticket-missing {
    color: #b91c1c !important;
}

.lan-ticket-missing a {
    color: #fbbf24;
    text-decoration: underline;
}

.lan-ticket-status .lan-info-box a {
    color: #60a5fa;
}

/* Einheitliche "Info-Karte" statt vollflächig eingefärbter Warnboxen -
   dezenter, dunkler Hintergrund + farbiger Akzentrand/Icon je nach
   Wichtigkeit, damit mehrere gestapelte Hinweise nicht wie eine Wand aus
   Warnfarbe wirken. .lan-notice-warning ist echten Blockern vorbehalten
   (z.B. "Reservierung abgelaufen"), .lan-notice-info für reine Hinweise
   ohne Handlungszwang (z.B. "weitere Tickets übertragen") - siehe
   frontend-seatmap.js/class-shortcode.php für die jeweilige Verwendung.
   width:100% sorgt im umgebenden flex-wrap-Status-Bar dafür, dass jeder
   Hinweis automatisch eine eigene Zeile bekommt, ohne einzeln Abstand
   setzen zu müssen - der gemeinsame "gap" des Elternelements übernimmt das. */
.lan-notice {
    box-sizing: border-box;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    /* Eigener margin-top statt uns auf den "gap" des Elternelements zu
       verlassen: .lan-notice landet je nach Fall entweder als direktes
       Geschwister-Element in .lan-status-bar (row-gap greift) ODER
       verschachtelt INNERHALB von .lan-ticket-status (kein Flex-Kontext,
       row-gap wirkt dort nicht) - siehe frontend-seatmap.js, wo der
       "mehrere Tickets"-Hinweis per innerHTML in .lan-ticket-status
       angehängt wird. Ein eigener margin-top funktioniert in beiden Fällen
       zuverlässig.  */
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12.5px;
    line-height: 1.45;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 3px solid var(--lan-notice-accent, #64748b);
}

.lan-notice-icon {
    flex-shrink: 0;
    font-size: 14px;
    line-height: 1;
}

.lan-notice-warning {
    --lan-notice-accent: #ef4444;
    color: #fecaca;
}

.lan-notice-info {
    --lan-notice-accent: #38bdf8;
    color: #bae6fd;
}

.lan-loading {
    color: #64748b;
    font-style: italic;
}

/* ── Map Controls ────────────────────────────────────────────────────────── */
.lan-map-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #181818;
}

.lan-ctrl-btn {
    width: 30px;
    height: 30px;
    background: #334155;
    color: #e2e8f0;
    border: 1px solid #475569;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    line-height: 1;
}

.lan-ctrl-btn:hover {
    background: #475569;
}

.lan-zoom-label {
    font-size: 11px;
    color: #64748b;
    min-width: 40px;
}

/* ── Canvas Area ─────────────────────────────────────────────────────────── */
.lan-canvas-outer {
    position: relative;
    width: 100%;
    height: 70vh;
    min-height: 400px;
    overflow: hidden;
    background: #181818;
    cursor: grab;
    touch-action: none;
}

.lan-canvas-outer:active {
    cursor: grabbing;
}

.lan-canvas-inner {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    will-change: transform;
}

.lan-frontend-svg {
    display: block;
}

/* ── "Noch nicht freigegeben"-Sperre ─────────────────────────────────────── */
/* Sitzplan ausgrauen + nicht mehr klickbar, solange die Reservierung laut
   "Reservierung ab" (_lan_reservation_start) noch nicht begonnen hat. */
.lan-seatmap-wrap--locked .lan-canvas-inner {
    /* Nur entsättigen, NICHT zusätzlich abdunkeln (brightness()) - das liess
       die Karte deutlich dunkler als ihre Umgebung (.lan-canvas-outer:
       #181818) erscheinen und dadurch wie ein sichtbar abgesetzter,
       fast schwarzer Kasten wirken statt sich einzufügen. */
    filter: grayscale(1);
    pointer-events: none;
}

.lan-seatmap-lock-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    pointer-events: none; /* Klicks sollen ins Leere gehen, nicht die Karte blockieren */
}

.lan-seatmap-lock-banner {
    transform: rotate(-8deg);
    background: linear-gradient(135deg, #b91c1c 0%, #7f1d1d 100%);
    color: #fff;
    text-align: center;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: .5px;
    padding: 18px 46px;
    border: 3px solid rgba(255, 255, 255, 0.85);
    border-radius: 6px;
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.6);
    font-size: clamp(15px, 2.3vw, 26px);
    max-width: 92%;
    line-height: 1.5;
}

.lan-seatmap-lock-date {
    display: block;
    margin-top: 6px;
    font-size: .65em;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    opacity: .92;
}

/* ── Seat States ─────────────────────────────────────────────────────────── */
.lan-seat {
    cursor: pointer;
    transition: opacity 0.15s;
}

.lan-seat:hover {
    opacity: 0.85;
}

.lan-seat:hover .lan-seat-rect {
    filter: brightness(1.2) drop-shadow(0 0 4px rgba(255,255,255,0.4));
}

.lan-seat-label {
    fill: #fff;
    font-weight: bold;
    pointer-events: none;
}

/* Seat color overrides via rect fill (applied by JS) */
.lan-seat-frei       { fill: var(--lan-frei)       !important; }
.lan-seat-vorgemerkt { fill: var(--lan-vorgemerkt)  !important; }
.lan-seat-hold       { fill: var(--lan-hold)        !important; }
.lan-seat-reserviert { fill: var(--lan-reserviert)  !important; }
.lan-seat-mine       { fill: var(--lan-mine)        !important; }

/* ── Popup ───────────────────────────────────────────────────────────────── */
/*
 * BUG FIX: position:fixed statt position:absolute.
 * .lan-seatmap-wrap hat overflow:hidden – ein absolute-Kind wird dadurch
 * abgeschnitten sobald es über den Rand ragt. Mit fixed wird das Popup
 * relativ zum Viewport positioniert und ist immer sichtbar.
 * Die JS-Methode _openPopup() berechnet bereits Viewport-Koordinaten.
 */
.lan-popup {
    position: fixed;
    z-index: 99999;
    width: 260px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: var(--lan-radius);
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    font-size: 14px;
    color: var(--lan-dark-text);
    animation: lan-popup-in 0.18s ease;
}

@keyframes lan-popup-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.lan-popup-inner {
    padding: 14px;
    position: relative;
}

.lan-popup-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: #64748b;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.15s;
}

.lan-popup-close:hover {
    color: #e2e8f0;
}

.lan-popup-seat-label {
    margin-top: 0 !important;
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 700;
    color: #f1f5f9;
}

.lan-popup-status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.lan-badge-frei       { background: var(--lan-frei);       color: #052e16; }
.lan-badge-vorgemerkt { background: var(--lan-vorgemerkt);  color: #431407; }
.lan-badge-hold       { background: var(--lan-hold);        color: #422006; }
.lan-badge-reserviert { background: var(--lan-reserviert);  color: #450a0a; }
.lan-badge-mine       { background: var(--lan-mine);        color: #172554; }

.lan-popup-user-info {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 8px;
    padding: 6px 8px;
    background: #0f172a;
    border-radius: 4px;
}

.lan-popup-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.lan-action-btn {
    width: 100%;
    padding: 8px 14px;
    border-radius: 6px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.lan-btn-primary {
    background: var(--lan-primary);
    color: #fff;
}

.lan-btn-primary:hover:not(:disabled) {
    background: #1d4ed8;
}

.lan-btn-secondary {
    background: #334155;
    color: #e2e8f0;
    border: 1px solid #475569;
}

.lan-btn-secondary:hover:not(:disabled) {
    background: #475569;
}

.lan-btn-danger {
    background: #7f1d1d;
    color: #fca5a5;
    border: 1px solid #991b1b;
}

.lan-btn-danger:hover:not(:disabled) {
    background: #991b1b;
    color: #fff;
}

.lan-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.lan-btn-link {
    color: #60a5fa;
    text-decoration: underline;
    font-size: 12px;
}

.lan-popup-hint {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
}

.lan-popup-messages {
    margin-top: 8px;
}

.lan-popup-msg {
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.lan-popup-msg-success {
    background: #052e16;
    color: #86efac;
    border: 1px solid #166534;
}

.lan-popup-msg-error {
    background: #450a0a;
    color: #fca5a5;
    border: 1px solid #991b1b;
}

.lan-hold-timer {
    font-size: 12px;
    color: var(--lan-hold);
    font-weight: 600;
    padding: 4px 0;
}

/* ── Overlay ─────────────────────────────────────────────────────────────── */
/*
 * BUG FIX: Auch das Overlay auf position:fixed setzen, damit es den
 * gesamten Viewport abdeckt (nicht nur den Wrap-Bereich).
 */
.lan-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99998;
}

/* ── Text / Obstacle elements ────────────────────────────────────────────── */
.lan-map-text {
    pointer-events: none;
    font-weight: normal;
    letter-spacing: 0.5px;
}

.lan-obstacle {
    pointer-events: none;
}

/* ── Error message ───────────────────────────────────────────────────────── */
.lan-error {
    padding: 12px 16px;
    background: #450a0a;
    color: #fca5a5;
    border: 1px solid #991b1b;
    border-radius: var(--lan-radius);
    font-size: 14px;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .lan-canvas-outer {
        height: 60vw;
        min-height: 280px;
    }

    .lan-legend {
        gap: 6px;
    }

    .lan-legend-item {
        font-size: 10px;
    }

    /* Mobile: Popup als Bottom-Sheet – bereits fixed, jetzt unten fixieren */
    .lan-popup {
        bottom: 0;
        left: 0 !important;
        right: 0;
        top: auto !important;
        width: 100%;
        border-radius: 16px 16px 0 0;
        border: none;
        box-shadow: 0 -8px 32px rgba(0,0,0,0.6);
        animation: lan-popup-slide-up 0.22s ease;
    }

    @keyframes lan-popup-slide-up {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }

    .lan-popup-inner {
        padding: 20px 16px 32px;
    }

    .lan-action-btn {
        padding: 12px;
        font-size: 15px;
    }

    .lan-status-bar {
        padding: 6px 10px;
    }

    .lan-ticket-status {
        margin-left: 0;
        width: 100%;
    }
}

/* ── Landscape mobile ────────────────────────────────────────────────────── */
@media (max-width: 600px) and (orientation: landscape) {
    .lan-canvas-outer {
        height: 50vw;
    }
}

/* ── Unavailable seats ────────────────────────────────────────────────────── */
.lan-seat-unavailable {
    cursor: not-allowed !important;
}

.lan-seat-rect-unavailable {
    fill: #111 !important;
    stroke: #333 !important;
}

/* Unavailable badge in legend */
.lan-legend-item.lan-status-unavailable::before {
    background: #1a1a1a;
    border: 2px solid #444;
}

/* Unavailable popup badge */
.lan-badge-unavailable {
    background: #1e293b;
    color: #64748b;
    border: 1px solid #334155;
}