/* ============================================ */
/* HL2 RP INTERACTIVE MAP - MAIN STYLES */
/* ============================================ */

/* ============================================ */
/* CSS RESET & BASE STYLES */
/* ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Consolas', 'Courier New', monospace;
    background-color: #0a0a0a;
    color: #e0e0e0;
}

/* ============================================ */
/* CONTROLS BAR (Top Navigation) */
/* ============================================ */
#controls-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: rgba(20, 20, 20, 0.95);
    border-bottom: 2px solid var(--theme-primary, #ff3232);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

#left-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

#right-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* ============================================ */
/* BREADCRUMB NAVIGATION */
/* ============================================ */
#breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #999;
}

.breadcrumb-item {
    cursor: pointer;
    transition: color 0.15s linear;
    padding: 4px 8px;
    border-radius: 0;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.breadcrumb-item:hover {
    color: var(--theme-primary, #ff3232);
    background-color: rgba(255, 255, 255, 0.05);
}

.breadcrumb-item.active {
    color: var(--theme-primary, #ff3232);
    font-weight: bold;
}

.breadcrumb-item:not(:last-child)::after {
    content: '›';
    margin-left: 8px;
    color: #555;
}

/* ============================================ */
/* BUTTONS */
/* ============================================ */
.btn {
    background-color: rgba(40, 40, 40, 0.8);
    border: 1px solid var(--theme-primary, #ff3232);
    color: #e0e0e0;
    padding: 8px 16px;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    border-radius: 0;
    transition: all 0.1s linear;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
    /* Industrial inset effect */
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1),
                inset 0 2px 4px rgba(0, 0, 0, 0.5);
    position: relative;
    white-space: nowrap;
}

.btn:hover {
    background-color: var(--theme-primary, #ff3232);
    color: #000;
    transform: none;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2),
                0 0 8px var(--theme-primary, #ff3232);
}

.btn.active {
    background-color: var(--theme-primary, #ff3232);
    color: #000;
    font-weight: bold;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2),
                0 0 12px var(--theme-primary, #ff3232);
}

.btn-steam {
    background: linear-gradient(135deg, #1b2838 0%, #2a475e 100%);
    border-color: #66c0f4;
    padding: 8px 20px;
}

.btn-steam:hover {
    background: linear-gradient(135deg, #2a475e 0%, #66c0f4 100%);
    border-color: #66c0f4;
    color: #fff;
}

/* Steam User Display */
#steam-auth-container {
    display: flex;
    align-items: center;
}

#steam-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background-color: rgba(30, 30, 30, 0.8);
    border: 1px solid var(--theme-primary, #ff3232);
    border-radius: 0;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.steam-avatar {
    width: 32px;
    height: 32px;
    border-radius: 0;
    border: 1px solid var(--theme-primary, #ff3232);
    box-shadow: 0 0 4px var(--theme-primary, #ff3232);
}

#steam-username {
    font-size: 11px;
    color: #e0e0e0;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-logout {
    padding: 4px 8px;
    font-size: 10px;
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #888;
    cursor: pointer;
    transition: all 0.15s linear;
    margin-left: 5px;
}

.btn-logout:hover {
    background-color: rgba(255, 50, 50, 0.2);
    border-color: #ff5050;
    color: #ff5050;
}

.btn-admin {
    padding: 6px 12px;
    font-size: 11px;
    background-color: rgba(255, 152, 0, 0.2);
    border: 1px solid #FF9800;
    color: #FF9800;
    cursor: pointer;
    transition: all 0.15s linear;
    font-weight: bold;
}

.btn-admin:hover {
    background-color: rgba(255, 152, 0, 0.4);
    border-color: #FFB74D;
    color: #FFB74D;
}

.btn-editor {
    padding: 6px 12px;
    font-size: 11px;
    background-color: rgba(0, 188, 212, 0.2);
    border: 1px solid #00BCD4;
    color: #00BCD4;
    cursor: pointer;
    transition: all 0.15s linear;
    font-weight: bold;
}

.btn-editor:hover {
    background-color: rgba(0, 188, 212, 0.4);
    border-color: #4DD0E1;
    color: #4DD0E1;
}

.btn-large {
    padding: 12px 24px;
    font-size: 15px;
    font-weight: bold;
}

/* Ambiance mute button — dimmed when music is muted */
.btn-music {
    padding: 6px 12px;
    font-size: 11px;
    opacity: 0.9;
}

.btn-music.muted {
    opacity: 0.45;
    text-decoration: line-through;
}

/* ============================================ */
/* CONTROL GROUPS */
/* ============================================ */
.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-label {
    font-size: 13px;
    color: #999;
    margin-right: 4px;
}

/* ============================================ */
/* LANGUAGE BUTTONS */
/* ============================================ */
.btn-lang {
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ============================================ */
/* MAP CONTAINER */
/* ============================================ */
#map-container {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #000;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100%;
    background-color: #000;
}

/* Disable Leaflet default controls */
.leaflet-control-container {
    display: none;
}

/* Disable all map interactions (locked map) */
.leaflet-container {
    cursor: default !important;
}

.leaflet-dragging .leaflet-container,
.leaflet-touch-drag .leaflet-container {
    cursor: default !important;
}

/* Image fade-in animation */
.leaflet-tile,
.leaflet-image-layer {
    animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================ */
/* MARKERS */
/* ============================================ */
.custom-marker {
    width: 32px !important;
    height: 32px !important;
    /* Removed animation temporarily to test if it's causing positioning issues */
    /* animation: markerPulse 2s ease-in-out infinite; */
}

/* Custom marker overlay (HTML div positioned above polygons) */
.custom-marker-overlay {
    z-index: 650 !important;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.custom-marker-overlay:hover {
    transform: scale(1.05);
}

/* Ensure Leaflet marker icons are positioned correctly */
.leaflet-marker-icon.custom-marker {
    margin: 0 !important;
}

/* Remove browser focus outlines from Leaflet interactive elements */
.leaflet-interactive:focus {
    outline: none !important;
}

/* Ensure polygon SVG paths don't show rectangular focus outlines */
.leaflet-overlay-pane svg path:focus,
.leaflet-overlay-pane svg polygon:focus {
    outline: none !important;
}

/* Selected polygon highlight with glow effect */
.polygon-selected {
    filter: drop-shadow(0 0 10px currentColor) drop-shadow(0 0 20px currentColor) !important;
}

/* Theme-specific selected polygon glow */
body.theme-combine .polygon-selected {
    filter: drop-shadow(0 0 10px #4a9eff) drop-shadow(0 0 20px #4a9eff) !important;
}

body.theme-rebel .polygon-selected {
    filter: drop-shadow(0 0 10px #ff8c1a) drop-shadow(0 0 20px #ff8c1a) !important;
}

.leaflet-marker-icon.custom-marker img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@keyframes markerPulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 3px var(--theme-primary, #ff3232));
    }
    50% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 8px var(--theme-primary, #ff3232));
    }
}

/* Marker tooltip */
.leaflet-tooltip {
    background-color: rgba(20, 20, 20, 0.95);
    border: 1px solid var(--theme-primary, #ff3232);
    color: #e0e0e0;
    font-size: 11px;
    padding: 6px 10px;
    border-radius: 0;
    box-shadow: 0 0 8px var(--theme-primary, #ff3232),
                inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: bold;
}

.leaflet-tooltip::before {
    border-top-color: var(--theme-primary, #ff3232);
}

/* ============================================ */
/* POLYGONS */
/* ============================================ */
.leaflet-interactive {
    transition: stroke-width 0.15s ease, opacity 0.15s ease;
}

/* Polygon hover effects are handled by Leaflet + themes.css */

/* ============================================ */
/* INFO PANEL (Slides in from right) */
/* ============================================ */
#info-panel {
    position: fixed;
    top: 60px;
    right: 0;
    width: 400px;
    height: calc(100% - 60px);
    background-color: rgba(15, 15, 15, 0.98);
    border-left: 2px solid var(--theme-primary, #ff3232);
    transform: translateX(100%);
    transition: transform 0.2s linear;
    z-index: 900;
    overflow-y: auto;
    overflow-x: hidden;
    backdrop-filter: blur(10px);
}

#info-panel.open {
    transform: translateX(0);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
}

/* HL2-style corner brackets for info panel */
#info-panel.open::before,
#info-panel.open::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    border: 2px solid var(--theme-primary, #ff3232);
    z-index: 10;
}

#info-panel.open::before {
    top: 10px;
    left: 10px;
    border-right: none;
    border-bottom: none;
}

#info-panel.open::after {
    bottom: 10px;
    left: 10px;
    border-right: none;
    border-top: none;
}

#info-panel-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background-color: transparent;
    border: none;
    color: #999;
    font-size: 24px;
    cursor: pointer;
    transition: color 0.15s ease;
    line-height: 1;
}

#info-panel-close:hover {
    color: var(--theme-primary, #ff3232);
}

#info-panel-content {
    padding: 20px;
}

#location-name {
    font-size: 24px;
    color: var(--theme-primary, #ff3232);
    margin-bottom: 20px;
    padding-right: 40px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ============================================ */
/* INFO SECTIONS */
/* ============================================ */
.info-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

/* Panel line separators with notches (HL2 style) */
.info-section::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg,
        var(--theme-primary, #ff3232) 0%,
        var(--theme-primary, #ff3232) 5%,
        transparent 5%,
        transparent 95%,
        var(--theme-primary, #ff3232) 95%,
        var(--theme-primary, #ff3232) 100%
    );
}

.info-section:last-child {
    border-bottom: none;
}

.info-section h3 {
    font-size: 12px;
    color: var(--theme-secondary, #ff6666);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    font-weight: bold;
    padding-left: 12px;
    border-left: 2px solid var(--theme-primary, #ff3232);
}

.info-section p {
    font-size: 13px;
    line-height: 1.6;
    color: #ccc;
}

/* Info notes (RP notes shown below description) */
.info-notes {
    margin-top: 12px;
    padding: 10px 12px;
    background-color: rgba(var(--theme-primary-rgb, 255, 50, 50), 0.1);
    border-left: 2px solid var(--theme-primary, #ff3232);
    font-size: 12px;
    font-style: italic;
    color: #aaa;
}

.info-notes:empty {
    display: none;
}

/* ============================================ */
/* STAT GRID (IC/OOC Data) */
/* ============================================ */
.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 15px;
}

.stat-box {
    background-color: rgba(30, 30, 30, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    padding: 12px;
    text-align: center;
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    /* Octagonal clip for HL2 aesthetic */
    clip-path: polygon(
        8px 0%, calc(100% - 8px) 0%,
        100% 8px, 100% calc(100% - 8px),
        calc(100% - 8px) 100%, 8px 100%,
        0% calc(100% - 8px), 0% 8px
    );
}

.stat-label {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 20px;
    color: var(--theme-primary, #ff3232);
    font-weight: bold;
}

/* ============================================ */
/* FACTION DISPLAY */
/* ============================================ */
#faction-display {
    margin-top: 12px;
    padding: 8px 12px;
    background-color: rgba(40, 40, 40, 0.6);
    border-left: 3px solid var(--theme-primary, #ff3232);
    font-size: 12px;
    color: #ccc;
}

/* ============================================ */
/* CHARACTERS PRESENT */
/* ============================================ */
#characters-present {
    padding: 10px;
    background-color: rgba(30, 30, 30, 0.4);
    border-radius: 0;
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#characters-present:empty {
    display: none;
}

/* ============================================ */
/* VISIBILITY INFO (access restrictions) */
/* ============================================ */
.visibility-info {
    display: none;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    padding: 10px 12px;
    background-color: rgba(20, 20, 20, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    font-size: 11px;
    color: #888;
}

.visibility-icon {
    font-size: 14px;
}

#visibility-text {
    flex: 1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================ */
/* DEBUG CONSOLE */
/* ============================================ */
#debug-info {
    position: fixed;
    bottom: 10px;
    left: 10px;
    max-width: 400px;
    max-height: 200px;
    background-color: rgba(0, 0, 0, 0.9);
    border: 1px solid #333;
    border-radius: 0;
    padding: 10px;
    font-size: 10px;
    color: #0f0;
    font-family: 'Consolas', monospace;
    overflow-y: auto;
    z-index: 999;
    pointer-events: auto;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: inset 0 0 0 1px rgba(0, 255, 0, 0.2);
}

#debug-info:empty {
    display: none;
}

#debug-info .debug-line {
    margin-bottom: 4px;
    opacity: 0.8;
}

#debug-info .debug-line:last-child {
    margin-bottom: 0;
}

/* ============================================ */
/* SCROLLBAR STYLING */
/* ============================================ */
#info-panel::-webkit-scrollbar,
#characters-present::-webkit-scrollbar,
#debug-info::-webkit-scrollbar {
    width: 8px;
}

#info-panel::-webkit-scrollbar-track,
#characters-present::-webkit-scrollbar-track,
#debug-info::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

#info-panel::-webkit-scrollbar-thumb,
#characters-present::-webkit-scrollbar-thumb,
#debug-info::-webkit-scrollbar-thumb {
    background: var(--theme-primary, #ff3232);
    border-radius: 4px;
}

#info-panel::-webkit-scrollbar-thumb:hover,
#characters-present::-webkit-scrollbar-thumb:hover,
#debug-info::-webkit-scrollbar-thumb:hover {
    background: var(--theme-secondary, #ff6666);
}

/* ============================================ */
/* RESPONSIVE DESIGN */
/* ============================================ */

/* Tablet (768px - 1024px) */
@media screen and (max-width: 1024px) {
    #info-panel {
        width: 350px;
    }

    #controls-bar {
        padding: 0 15px;
    }

    #right-controls {
        gap: 10px;
    }

    .btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* Mobile (< 768px) */
@media screen and (max-width: 768px) {
    #controls-bar {
        height: auto;
        min-height: 60px;
        flex-direction: column;
        padding: 10px;
        gap: 10px;
    }

    #left-controls,
    #right-controls {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    #map-container {
        top: auto;
        bottom: 0;
    }

    #info-panel {
        width: 100%;
        max-width: 100%;
        height: 70%;
        top: auto;
        bottom: 0;
        transform: translateY(100%);
        border-left: none;
        border-top: 2px solid var(--theme-primary, #ff3232);
    }

    #info-panel.open {
        transform: translateY(0);
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }

    #breadcrumb {
        font-size: 12px;
    }

    .btn {
        font-size: 11px;
        padding: 6px 10px;
    }

    #debug-info {
        bottom: 5px;
        left: 5px;
        max-width: calc(100vw - 10px);
        font-size: 10px;
    }
}

/* Extra small mobile (< 480px) */
@media screen and (max-width: 480px) {
    #location-name {
        font-size: 20px;
    }

    .info-section h3 {
        font-size: 13px;
    }

    .stat-value {
        font-size: 18px;
    }

    #info-panel-content {
        padding: 15px;
    }
}

/* ============================================ */
/* UTILITY CLASSES */
/* ============================================ */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

.text-center {
    text-align: center;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}
