/* === RESET & BASE === */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body, html {
    width: 100%;
    height: 100%;
    font-family: 'Nunito', sans-serif;
    background-color: #0f172a;
    overflow: hidden;
}

/* === MAP & EFFETS === */
#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
}
#snow-container {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 500;
}
.snowflake {
    position: absolute;
    top: -10px;
    background: white;
    border-radius: 50%;
    opacity: 0.8;
    animation: fall linear infinite;
}
@keyframes fall {
    to { transform: translateY(105vh); }
}

/* === BARRE DE PROGRESSION GLOBALE (NÉON) === */
#global-progress-container {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 5px; 
    background: rgba(255, 255, 255, 0.1);
    z-index: 9999;
}
#global-progress {
    height: 100%;
    width: 0%;
    background: #34d399;
    box-shadow: 0 0 10px #34d399;
    transition: width 1s linear;
}

/* === BOUTON BOUSSOLE DE NOËL (NOUVEAU) === */
#center-santa-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    background: linear-gradient(135deg, #991b1b, #dc2626); /* Rouge festif */
    color: #fff;
    width: 55px; /* Bouton rond */
    height: 55px;
    border-radius: 50%; /* Cercle parfait */
    font-size: 1.8rem; /* Grosse icône */
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    border: 3px solid #fde047; /* Bordure or */
    z-index: 2000;
    display: none; /* Remplacé par flex en JS quand visible */
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s;
}
#center-santa-btn:hover {
    transform: scale(1.15) rotate(20deg); /* Effet de boussole qui tourne au survol */
    box-shadow: 0 6px 20px rgba(0,0,0,0.7);
}

/* === TABLEAU DE BORD (ÉQUILIBRÉ POUR PC) === */
#dashboard {
    position: fixed;
    bottom: 20px; 
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(153, 27, 27, 0.95), rgba(20, 83, 45, 0.95));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 215, 0, 0.4);
    border-radius: 12px; 
    display: flex;
    color: white;
    z-index: 1000;
    box-shadow: 0 8px 25px rgba(0,0,0,0.6);
    overflow: hidden;
    width: 90%;
    max-width: 950px;
    height: auto; 
    min-height: 90px;
    transition: background 0.4s, border-color 0.4s;
}

/* 🔵 MODE HISTORIQUE */
#dashboard.history-mode {
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.95), rgba(15, 23, 42, 0.95)); 
    border-color: rgba(147, 197, 253, 0.6);
}
#dashboard.history-mode .label {
    color: #93c5fd; 
}
#dashboard.history-mode #countdown-text {
    color: #bfdbfe;
}
#dashboard.history-mode #gift-counter {
    color: #a7f3d0;
}

/* Section Image */
.photo-container {
    position: relative;
    width: 180px;
    flex-shrink: 0;
    background: #000;
}
#city-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.photo-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.95), transparent);
    padding: 8px 10px;
}
#photo-city {
    display: block;
    font-size: 1rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.9);
}

/* Section Données */
.data-container {
    padding: 10px 20px;
    display: grid;
    grid-template-columns: repeat(4, 1fr); 
    gap: 6px 15px; 
    flex-grow: 1;
    align-items: center;
}

.data-box {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.data-box:nth-child(1) { order: 1; }
.data-box:nth-child(2) { order: 2; }
.data-box:nth-child(3) { order: 3; }
.data-box:nth-child(4) { order: 4; }

.label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #fde047;
    margin-bottom: 2px;
    font-weight: 800;
    transition: color 0.4s;
}
.value {
    font-size: 1.3rem; 
    font-weight: 900;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    transition: color 0.4s;
}

#countdown-text { color: #fca5a5; font-variant-numeric: tabular-nums; }
#gift-counter { color: #86efac; font-variant-numeric: tabular-nums; }

/* Distance de l'utilisateur */
#user-distance {
    grid-column: 1 / span 2;
    order: 5;
    background: rgba(52, 211, 153, 0.15);
    border: 1px solid rgba(52, 211, 153, 0.4);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.8rem;
    font-weight: bold;
    color: #6ee7b7;
    text-align: center;
    margin-top: 4px;
    display: none; 
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.4); }
    70% { box-shadow: 0 0 0 5px rgba(52, 211, 153, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* Météo */
#weather-info {
    grid-column: 3 / span 2; 
    order: 6; 
    background: rgba(0, 0, 0, 0.35);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: bold;
    color: #fef08a;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.15);
    margin-top: 4px;
}

/* Bandeau Anecdotes Wikipédia */
#wiki-fact-container {
    grid-column: 1 / -1;
    order: 7;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 6px;
    padding-top: 6px;
    position: relative;
}
#wiki-fact {
    display: inline-block;
    padding-left: 100%;
    animation: marquee 25s linear infinite;
    color: #e2e8f0;
    font-size: 0.85rem;
    font-style: italic;
    font-weight: 600;
}
@keyframes marquee {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(-100%, 0); }
}

/* === CHAT / MINI-IA PÈRE NOËL === */
#santa-chat-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
}
#santa-chat-toggle {
    background: #991b1b;
    color: #fde047;
    padding: 10px 16px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    border: 2px solid #fde047;
    transition: transform 0.2s;
}
#santa-chat-toggle:hover {
    transform: scale(1.05);
}
#santa-chat-box {
    width: 320px;
    background: rgba(20, 83, 45, 0.95);
    backdrop-filter: blur(10px);
    border: 2px solid #fde047;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0,0,0,0.6);
    margin-top: 8px;
    display: flex;
    flex-direction: column;
}
.chat-header {
    background: #991b1b;
    color: white;
    padding: 8px 12px;
    font-size: 0.95rem;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-header button {
    background: none;
    border: none;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
}
.chat-select-container {
    padding: 8px;
    background: rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid rgba(253, 224, 71, 0.2);
}
.chat-select {
    width: 100%;
    padding: 6px 8px;
    border-radius: 6px;
    background: #0f172a;
    color: #fde047;
    border: 1px solid #fde047;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-weight: bold;
}
#chat-messages {
    height: 180px;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
}
.chat-msg {
    padding: 6px 10px;
    border-radius: 8px;
    max-width: 85%;
    line-height: 1.3;
    color: white;
}
.chat-msg.santa {
    background: #991b1b;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}
.chat-msg.user {
    background: #fde047;
    color: #1e293b;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
    font-weight: bold;
}

/* === RESPONSIVE MOBILE (< 768px) === */
@media (max-width: 768px) {
    #dashboard {
        flex-direction: column; 
        bottom: 10px;
        width: 95%;
        max-width: none;
        border-radius: 12px;
        height: auto;
    }
    .photo-container {
        width: 100%;
        height: 90px; 
    }
    .photo-overlay { padding: 4px 8px; }
    #photo-city { font-size: 1.1rem; }
    .data-container {
        padding: 10px;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .value { font-size: 1.2rem; }
    .label { font-size: 0.65rem; }
    
    #user-distance { grid-column: 1 / -1; order: 5; font-size: 0.8rem; margin-top: 2px; }
    #weather-info { grid-column: 1 / -1; order: 6; font-size: 0.8rem; margin-top: 2px; }
    #wiki-fact-container { order: 7; margin-top: 4px; padding-top: 4px;}
    #wiki-fact { font-size: 0.8rem; animation-duration: 20s; }

    #santa-chat-container { top: 15px; right: 15px; }
    #santa-chat-toggle { padding: 8px 14px; font-size: 0.8rem; }
    #santa-chat-box { width: 280px; }
    #chat-messages { height: 150px; }
    
    /* Boussole plus petite sur mobile */
    #center-santa-btn { 
        top: 15px; left: 15px; 
        width: 45px; height: 45px; 
        font-size: 1.4rem; 
    }
}
/* === AJOUTS V2 === */
.sleigh-trail { filter: drop-shadow(0 0 5px #ffd54a); }
.photo-credit { display: block; font-size: 0.6rem; color: rgba(255,255,255,0.65); }
#user-distance:hover { background: rgba(52, 211, 153, 0.3); }
#user-distance:focus-visible, #santa-chat-toggle:focus-visible { outline: 3px solid #fde047; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
    .snowflake, #wiki-fact, #user-distance { animation: none; }
}

/* === GLOBE 3D === */
#globe { position: absolute; inset: 0; z-index: 2; display: none; background: #020617; }
#globe.on { display: block; }
#globe-btn { position: fixed; top: 20px; left: 85px; z-index: 2000; background: #991b1b; color: #fde047; padding: 10px 16px; border-radius: 25px; font-size: 0.9rem; font-weight: 900; cursor: pointer; border: 2px solid #fde047; box-shadow: 0 4px 15px rgba(0,0,0,0.4); transition: transform 0.2s; }
#globe-btn:hover { transform: scale(1.05); }
#globe-btn:focus-visible { outline: 3px solid #fde047; outline-offset: 2px; }
@media (max-width: 768px) { #globe-btn { top: 15px; left: 70px; padding: 8px 12px; font-size: 0.8rem; } }
