/**
 * STRANGER THINGS MODE - CSS
 * Habitat-360 Easter Egg
 *
 * Activation: Konami Code, ou taper "011", "hawkins", "upsidedown"
 */

:root {
    --st-black: #0a0a0f;
    --st-dark: #1a0a0a;
    --st-red: #ff3333;
    --st-red-dark: #cc0000;
    --st-red-glow: #ff5555;
    --st-red-dim: #660000;
    --st-yellow: #ffcc00;
    --st-yellow-dim: #997700;
    --st-white: #f0e6e6;
    --st-gray: #3a3a3a;
}

/* ============================================
   BASE STRANGER MODE
   ============================================ */

body.stranger-mode {
    background: linear-gradient(180deg, var(--st-black) 0%, #1a0505 50%, var(--st-black) 100%) !important;
    color: var(--st-white) !important;
    font-family: 'Courier New', 'Consolas', monospace !important;
}

/* Scanlines effect */
body.stranger-mode::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 99999;
}

/* Floating particles */
body.stranger-mode::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 200%;
    background-image:
        radial-gradient(2px 2px at 10% 20%, var(--st-red-glow) 50%, transparent 100%),
        radial-gradient(2px 2px at 30% 60%, var(--st-red) 50%, transparent 100%),
        radial-gradient(1px 1px at 50% 10%, var(--st-red-glow) 50%, transparent 100%),
        radial-gradient(2px 2px at 70% 40%, var(--st-red) 50%, transparent 100%),
        radial-gradient(1px 1px at 90% 80%, var(--st-red-glow) 50%, transparent 100%);
    animation: st-particles 25s linear infinite;
    pointer-events: none;
    z-index: 99998;
    opacity: 0.5;
}

@keyframes st-particles {
    0% { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

body.stranger-mode h1,
body.stranger-mode h2,
body.stranger-mode h3,
body.stranger-mode .logo,
body.stranger-mode .header-title {
    font-family: 'Cinzel', 'Times New Roman', serif !important;
    color: var(--st-red) !important;
    text-shadow: 0 0 10px var(--st-red), 0 0 20px var(--st-red), 0 0 40px var(--st-red-dark) !important;
    letter-spacing: 0.1em !important;
    text-transform: uppercase !important;
}

body.stranger-mode h1 {
    animation: st-flicker 3s infinite alternate;
}

@keyframes st-flicker {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
        text-shadow: 0 0 10px var(--st-red), 0 0 20px var(--st-red), 0 0 40px var(--st-red-dark);
        opacity: 1;
    }
    20%, 24%, 55% {
        text-shadow: 0 0 5px var(--st-red);
        opacity: 0.85;
    }
}

body.stranger-mode p,
body.stranger-mode span,
body.stranger-mode div,
body.stranger-mode li,
body.stranger-mode label {
    color: var(--st-white) !important;
}

/* ============================================
   LINKS
   ============================================ */

body.stranger-mode a {
    color: var(--st-red-glow) !important;
    text-decoration: none !important;
    border-bottom: 1px solid var(--st-red-dim) !important;
    transition: all 0.3s ease !important;
}

body.stranger-mode a:hover {
    color: var(--st-red) !important;
    text-shadow: 0 0 5px var(--st-red), 0 0 10px var(--st-red-dark) !important;
}

/* ============================================
   BUTTONS
   ============================================ */

body.stranger-mode button,
body.stranger-mode .btn,
body.stranger-mode input[type="submit"],
body.stranger-mode input[type="button"] {
    background: var(--st-dark) !important;
    color: var(--st-red) !important;
    border: 2px solid var(--st-red) !important;
    box-shadow: 0 0 5px var(--st-red), 0 0 10px var(--st-red-dark) !important;
    font-family: 'Courier New', monospace !important;
    text-transform: uppercase !important;
    letter-spacing: 0.1em !important;
}

body.stranger-mode button:hover,
body.stranger-mode .btn:hover {
    background: var(--st-red-dim) !important;
    box-shadow: 0 0 10px var(--st-red), 0 0 20px var(--st-red-dark), 0 0 30px rgba(255, 51, 51, 0.3) !important;
    transform: scale(1.02) !important;
}

/* ============================================
   FORMS
   ============================================ */

body.stranger-mode input,
body.stranger-mode textarea,
body.stranger-mode select {
    background: var(--st-dark) !important;
    color: var(--st-white) !important;
    border: 1px solid var(--st-red-dim) !important;
    font-family: 'Courier New', monospace !important;
}

body.stranger-mode input:focus,
body.stranger-mode textarea:focus,
body.stranger-mode select:focus {
    border-color: var(--st-red) !important;
    box-shadow: 0 0 5px var(--st-red), 0 0 10px var(--st-red-dark) !important;
    outline: none !important;
}

body.stranger-mode input::placeholder,
body.stranger-mode textarea::placeholder {
    color: var(--st-red-dim) !important;
}

/* ============================================
   CARDS & PANELS
   ============================================ */

body.stranger-mode .card,
body.stranger-mode .panel,
body.stranger-mode .sidebar,
body.stranger-mode .detail-panel,
body.stranger-mode .layer-control {
    background: var(--st-dark) !important;
    border: 1px solid var(--st-red-dim) !important;
    box-shadow: 0 0 5px var(--st-red), 0 0 10px var(--st-red-dark) !important;
}

body.stranger-mode .card:hover,
body.stranger-mode .panel:hover {
    border-color: var(--st-red) !important;
    box-shadow: 0 0 10px var(--st-red), 0 0 20px var(--st-red-dark), 0 0 30px rgba(255, 51, 51, 0.3) !important;
}

/* ============================================
   TABLES
   ============================================ */

body.stranger-mode table {
    border: 1px solid var(--st-red-dim) !important;
}

body.stranger-mode th {
    background: var(--st-red-dim) !important;
    color: var(--st-white) !important;
    border: 1px solid var(--st-red) !important;
}

body.stranger-mode td {
    background: var(--st-dark) !important;
    border: 1px solid var(--st-red-dim) !important;
    color: var(--st-white) !important;
}

body.stranger-mode tr:hover td {
    background: rgba(255, 51, 51, 0.15) !important;
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */

body.stranger-mode header,
body.stranger-mode .header,
body.stranger-mode nav,
body.stranger-mode .navbar {
    background: linear-gradient(180deg, var(--st-dark) 0%, var(--st-black) 100%) !important;
    border-bottom: 2px solid var(--st-red) !important;
    box-shadow: 0 2px 20px var(--st-red-dark) !important;
}

body.stranger-mode nav a {
    color: var(--st-red-glow) !important;
    border-bottom: none !important;
}

body.stranger-mode nav a:hover {
    background: var(--st-red-dim) !important;
}

body.stranger-mode nav a.active {
    background: var(--st-red) !important;
    color: var(--st-black) !important;
}

/* ============================================
   PROGRESS BARS
   ============================================ */

body.stranger-mode .progress,
body.stranger-mode .progress-bar-container {
    background: var(--st-dark) !important;
    border: 1px solid var(--st-red-dim) !important;
}

body.stranger-mode .progress-bar,
body.stranger-mode .progress-fill {
    background: linear-gradient(90deg, var(--st-red-dim) 0%, var(--st-red) 100%) !important;
    box-shadow: 0 0 10px var(--st-red) !important;
}

/* ============================================
   ALERTS
   ============================================ */

body.stranger-mode .alert {
    background: var(--st-dark) !important;
    border: 2px solid var(--st-red) !important;
    color: var(--st-white) !important;
    box-shadow: 0 0 10px var(--st-red), 0 0 20px var(--st-red-dark) !important;
}

/* ============================================
   SCROLLBAR
   ============================================ */

body.stranger-mode ::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

body.stranger-mode ::-webkit-scrollbar-track {
    background: var(--st-black);
}

body.stranger-mode ::-webkit-scrollbar-thumb {
    background: var(--st-red-dim);
    border-radius: 6px;
    border: 2px solid var(--st-black);
}

body.stranger-mode ::-webkit-scrollbar-thumb:hover {
    background: var(--st-red);
}

/* ============================================
   SELECTION
   ============================================ */

body.stranger-mode ::selection {
    background: var(--st-red) !important;
    color: var(--st-black) !important;
}

/* ============================================
   LEAFLET MAP OVERLAY
   ============================================ */

body.stranger-mode .leaflet-container {
    filter: sepia(0.3) hue-rotate(-15deg) saturate(1.2) brightness(0.85) !important;
}

body.stranger-mode .leaflet-tile {
    filter: brightness(0.7) contrast(1.1) sepia(0.2) hue-rotate(-10deg) !important;
}

body.stranger-mode .leaflet-control-zoom a {
    background: var(--st-dark) !important;
    color: var(--st-red) !important;
    border: 1px solid var(--st-red) !important;
}

body.stranger-mode .leaflet-control-zoom a:hover {
    background: var(--st-red-dim) !important;
}

body.stranger-mode .leaflet-popup-content-wrapper {
    background: var(--st-dark) !important;
    color: var(--st-white) !important;
    border: 1px solid var(--st-red) !important;
    box-shadow: 0 0 10px var(--st-red) !important;
}

body.stranger-mode .leaflet-popup-tip {
    background: var(--st-dark) !important;
}

/* ============================================
   CHRISTMAS LIGHTS - STRANGER THINGS STYLE
   Style mural avec guirlande et lettres peintes
   Positionnées juste sous le logo HABITAT-360
   ============================================ */

.st-lights {
    position: fixed;
    top: 56px; /* Juste sous le header (header-height) */
    left: 0;
    width: 100vw;
    height: 30px;
    pointer-events: none;
    z-index: 99999;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: flex-start;
    gap: 0;
    padding-top: 8px;
    background: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.3) 50%, transparent 100%);
    box-sizing: border-box;
}

/* Fil de guirlande - câble noir */
.st-lights::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 0;
    right: 0;
    height: 3px;
    background: #222;
}

/* Conteneur des ampoules - suspendues au fil */
.st-lights .bulb {
    width: 10px;
    height: 14px;
    border-radius: 50% 50% 50% 50% / 30% 30% 70% 70%;
    position: relative;
    margin: 0 10px;
    margin-top: 8px;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

/* Fil de suspension de l'ampoule */
.st-lights .bulb::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 8px;
    background: #222;
}

/* Pas de lettres visibles - juste les ampoules */
.st-lights .bulb::after {
    display: none;
}

/* Couleurs des ampoules - rouge dominant */
.st-lights .bulb:nth-child(4n+1) {
    background: radial-gradient(circle at 30% 30%, #ff6666, #cc0000);
    box-shadow:
        0 0 8px #ff3333,
        0 0 15px rgba(255, 51, 51, 0.5);
    animation: st-bulb-red 3s ease-in-out infinite;
}

/* Jaune/orange */
.st-lights .bulb:nth-child(4n+2) {
    background: radial-gradient(circle at 30% 30%, #ffee66, #cc9900);
    box-shadow:
        0 0 8px #ffcc00,
        0 0 15px rgba(255, 204, 0, 0.5);
    animation: st-bulb-yellow 3s ease-in-out infinite;
    animation-delay: 0.5s;
}

/* Vert */
.st-lights .bulb:nth-child(4n+3) {
    background: radial-gradient(circle at 30% 30%, #66ff66, #009900);
    box-shadow:
        0 0 8px #33ff33,
        0 0 15px rgba(51, 255, 51, 0.5);
    animation: st-bulb-green 3s ease-in-out infinite;
    animation-delay: 1s;
}

/* Bleu */
.st-lights .bulb:nth-child(4n+4) {
    background: radial-gradient(circle at 30% 30%, #6699ff, #0033cc);
    box-shadow:
        0 0 8px #3366ff,
        0 0 15px rgba(51, 102, 255, 0.5);
    animation: st-bulb-blue 3s ease-in-out infinite;
    animation-delay: 1.5s;
}

/* Animations de scintillement par couleur */
@keyframes st-bulb-red {
    0%, 100% {
        opacity: 1;
        filter: brightness(1);
    }
    25% {
        opacity: 0.6;
        filter: brightness(0.7);
    }
    50% {
        opacity: 1;
        filter: brightness(1.3);
    }
    75% {
        opacity: 0.8;
        filter: brightness(0.9);
    }
}

@keyframes st-bulb-yellow {
    0%, 100% {
        opacity: 1;
        filter: brightness(1);
    }
    30% {
        opacity: 0.5;
        filter: brightness(0.6);
    }
    60% {
        opacity: 1;
        filter: brightness(1.4);
    }
}

@keyframes st-bulb-green {
    0%, 100% {
        opacity: 0.9;
        filter: brightness(1);
    }
    40% {
        opacity: 1;
        filter: brightness(1.3);
    }
    70% {
        opacity: 0.4;
        filter: brightness(0.5);
    }
}

@keyframes st-bulb-blue {
    0%, 100% {
        opacity: 1;
        filter: brightness(1);
    }
    20% {
        opacity: 0.7;
        filter: brightness(0.8);
    }
    50% {
        opacity: 0.5;
        filter: brightness(0.6);
    }
    80% {
        opacity: 1;
        filter: brightness(1.2);
    }
}

/* État illuminé pour épeler un mot */
.st-lights .bulb.lit {
    transform: scale(1.5) !important;
    filter: brightness(2) !important;
    z-index: 10;
    box-shadow:
        0 0 12px currentColor,
        0 0 25px currentColor !important;
}

/* Ampoule éteinte */
.st-lights .bulb.dim {
    opacity: 0.15 !important;
    filter: brightness(0.2) grayscale(0.9) !important;
    box-shadow: none !important;
}

/* ============================================
   MESSAGE OVERLAY
   ============================================ */

.st-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Cinzel', 'Times New Roman', serif;
    font-size: clamp(28px, 6vw, 56px);
    font-weight: 700;
    color: #ff3333;
    text-shadow: 0 0 10px #ff3333, 0 0 20px #ff3333, 0 0 40px #cc0000, 0 0 80px #990000;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    text-align: center;
    z-index: 100002;
    pointer-events: none;
    white-space: nowrap;
}

/* ============================================
   TOGGLE BUTTON (masqué - activation par Konami code uniquement)
   ============================================ */

.st-toggle-btn {
    display: none !important; /* Masqué - utiliser Konami code ou mots secrets */
}

/* ============================================
   GLITCH EFFECT (optional)
   ============================================ */

.st-glitch {
    animation: st-glitch-anim 0.5s infinite;
}

@keyframes st-glitch-anim {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

/* ============================================
   HABITAT-360 SPECIFIC OVERRIDES
   ============================================ */

body.stranger-mode .layer-group-title {
    color: var(--st-red) !important;
    text-shadow: 0 0 5px var(--st-red) !important;
}

body.stranger-mode .layer-item {
    border-color: var(--st-red-dim) !important;
}

body.stranger-mode .layer-item:hover {
    border-color: var(--st-red) !important;
    box-shadow: 0 0 5px var(--st-red) !important;
}

body.stranger-mode .commune-selector {
    background: var(--st-dark) !important;
    border-color: var(--st-red) !important;
}

body.stranger-mode .basemap-btn {
    background: var(--st-dark) !important;
    border-color: var(--st-red-dim) !important;
}

body.stranger-mode .basemap-btn.active {
    background: var(--st-red-dim) !important;
    border-color: var(--st-red) !important;
}

body.stranger-mode .score-bar {
    background: var(--st-dark) !important;
}

body.stranger-mode .score-bar-fill {
    background: linear-gradient(90deg, var(--st-red-dim), var(--st-red)) !important;
}

body.stranger-mode .stat-value {
    color: var(--st-red) !important;
    text-shadow: 0 0 5px var(--st-red) !important;
}
