/* Variables pour les thèmes */
:root {
    /* Thème clair (par défaut) */
    --popup-bg-gradient-start: #ffffff;
    --popup-bg-gradient-end: #f7f7f7;
    --popup-header-gradient-start: #3498db;
    --popup-header-gradient-end: #2980b9;
    --popup-text-color: #555;
    --popup-text-highlight: #2980b9;
    --popup-shadow: rgba(0, 0, 0, 0.4);
    --popup-border: rgba(255, 255, 255, 0.1);
    --popup-backdrop: rgba(0, 0, 0, 0.75);
    --animation-bg-gradient-start: #f0f0f0;
    --animation-bg-gradient-end: #e4e4e4;
    --worker-head-color: #ffcc80;
    --worker-body-gradient-start: #ff9800;
    --worker-body-gradient-end: #f57c00;
    --worker-arm-color: #ffcc80;
    --worker-leg-gradient-start: #8d6e63;
    --worker-leg-gradient-end: #6d4c41;
    --shovel-gradient-start: #a1887f;
    --shovel-gradient-end: #8d6e63;
    --shovel-head-gradient-start: #5d4037;
    --shovel-head-gradient-end: #4e342e;
    --dirt-gradient-start: #8d6e63;
    --dirt-gradient-end: #6d4c41;
    --dirt-top-gradient-start: #6d4c41;
    --dirt-top-gradient-end: #5d4037;
    --truck-color: #ff6b6b;
    --truck-dark: #e74c3c;
    --building-color: #74b9ff;
    --building-dark: #0984e3;
    --sign-color: #ffd700;
    --sign-border: #ff6b6b;
    --sign-post-color: #95a5a6;
    --worker-icon-color: #2c3e50;
    --ground-color: #2d3436;
}

/* Thème sombre */
.dark-theme {
    --popup-bg-gradient-start: #2c3e50;
    --popup-bg-gradient-end: #1a2530;
    --popup-header-gradient-start: #2980b9;
    --popup-header-gradient-end: #1a5276;
    --popup-text-color: #e0e0e0;
    --popup-text-highlight: #3498db;
    --popup-shadow: rgba(0, 0, 0, 0.6);
    --popup-border: rgba(255, 255, 255, 0.05);
    --popup-backdrop: rgba(0, 0, 0, 0.85);
    --animation-bg-gradient-start: #34495e;
    --animation-bg-gradient-end: #2c3e50;
    --worker-head-color: #ffcc80;
    --worker-body-gradient-start: #ff9800;
    --worker-body-gradient-end: #f57c00;
    --worker-arm-color: #ffcc80;
    --worker-leg-gradient-start: #8d6e63;
    --worker-leg-gradient-end: #6d4c41;
    --shovel-gradient-start: #a1887f;
    --shovel-gradient-end: #8d6e63;
    --shovel-head-gradient-start: #5d4037;
    --shovel-head-gradient-end: #4e342e;
    --dirt-gradient-start: #795548;
    --dirt-gradient-end: #5d4037;
    --dirt-top-gradient-start: #5d4037;
    --dirt-top-gradient-end: #4e342e;
    --truck-color: #e74c3c;
    --truck-dark: #c0392b;
    --building-color: #0984e3;
    --building-dark: #0652DD;
    --sign-color: #f1c40f;
    --sign-border: #d35400;
    --ground-color: #1e272e;
}

/* Détection automatique du thème préféré */
@media (prefers-color-scheme: dark) {
    :root:not(.light-theme) {
        --popup-bg-gradient-start: #2c3e50;
        --popup-bg-gradient-end: #1a2530;
        --popup-header-gradient-start: #2980b9;
        --popup-header-gradient-end: #1a5276;
        --popup-text-color: #e0e0e0;
        --popup-text-highlight: #3498db;
        --popup-shadow: rgba(0, 0, 0, 0.6);
        --popup-border: rgba(255, 255, 255, 0.05);
        --popup-backdrop: rgba(0, 0, 0, 0.85);
        --animation-bg-gradient-start: #34495e;
        --animation-bg-gradient-end: #2c3e50;
        --worker-head-color: #ffcc80;
        --worker-body-gradient-start: #ff9800;
        --worker-body-gradient-end: #f57c00;
        --worker-arm-color: #ffcc80;
        --worker-leg-gradient-start: #8d6e63;
        --worker-leg-gradient-end: #6d4c41;
        --shovel-gradient-start: #a1887f;
        --shovel-gradient-end: #8d6e63;
        --shovel-head-gradient-start: #5d4037;
        --shovel-head-gradient-end: #4e342e;
        --dirt-gradient-start: #795548;
        --dirt-gradient-end: #5d4037;
        --dirt-top-gradient-start: #5d4037;
        --dirt-top-gradient-end: #4e342e;
        --truck-color: #e74c3c;
        --truck-dark: #c0392b;
        --building-color: #0984e3;
        --building-dark: #0652DD;
        --sign-color: #f1c40f;
        --sign-border: #d35400;
        --ground-color: #1e272e;
    }
}

/* Styles pour les éléments inactifs et la popup de construction */

/* Overlay avec sens interdit */
.inactive-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: inherit;
    z-index: 2;
}

.inactive-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.sens-interdit,
.en-travaux {
    width: 70%;
    height: auto;
    max-width: 130px;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
    animation: pulse 2s infinite;
    background-color: transparent;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 0.9; }
}

/* Styles pour les éléments inactifs */
.site-inactive, .inactive-game, .inactive-app {
    cursor: pointer;
    position: relative;
    transition: transform 0.3s ease;
}

.site-inactive:hover, .inactive-game:hover, .inactive-app:hover {
    transform: translateY(-5px);
}

.site-image, .game-image, .app-image {
    position: relative;
    overflow: hidden;
}

/* Popup de construction - Version améliorée avec adaptation au thème */
.construction-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--popup-backdrop);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
    transition: opacity 0.3s ease;
    opacity: 0;
}

.popup-content {
    background: linear-gradient(to bottom, var(--popup-bg-gradient-start), var(--popup-bg-gradient-end));
    border-radius: 16px;
    max-width: 90%;
    width: 450px;
    padding: 0;
    box-shadow: 0 10px 40px var(--popup-shadow), 0 0 0 1px var(--popup-border);
    animation: popIn 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
    overflow: hidden;
    border: 1px solid var(--popup-border);
}

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    80% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.popup-header {
    background: linear-gradient(to right, var(--popup-header-gradient-start), var(--popup-header-gradient-end));
    padding: 18px 20px;
    border-bottom: none;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.popup-header h3 {
    margin: 0;
    color: white;
    font-size: 1.3rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.close-popup {
    position: absolute;
    top: -40px;
    right: -40px;
    background: white;
    border: none;
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 0;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 1002;
}

.close-popup:hover {
    background: #f5f5f5;
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.popup-body {
    padding: 25px;
    text-align: center;
}

.popup-body p {
    color: var(--popup-text-color);
    font-size: 1.1rem;
    margin: 0 0 20px;
    line-height: 1.5;
}

.popup-body p:last-child {
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--popup-text-highlight);
}

/* Nouvelle animation de construction */
.construction-animation {
    height: 280px;
    margin: 20px auto 30px;
    position: relative;
    background: linear-gradient(180deg, #f5f5f5 0%, #f5f5f5 100%);
    border-radius: 12px;
    overflow: hidden;
}

.coffee-container {
    width: 300px;
    height: 280px;
    position: absolute;
    top: 0;
    left: calc(50% - 150px);
}

.coffee-header {
    width: 100%;
    height: 80px;
    position: absolute;
    top: 0;
    left: 0;
    background-color: #ddcfcc;
    border-radius: 10px;
}

.coffee-header__buttons {
    width: 25px;
    height: 25px;
    position: absolute;
    top: 25px;
    background-color: #282323;
    border-radius: 50%;
}

.coffee-header__buttons::after {
    content: "";
    width: 8px;
    height: 8px;
    position: absolute;
    bottom: -8px;
    left: calc(50% - 4px);
    background-color: #615e5e;
}

.coffee-header__button-one {
    left: 15px;
}

.coffee-header__button-two {
    left: 50px;
}

.coffee-header__display {
    width: 50px;
    height: 50px;
    position: absolute;
    top: calc(50% - 25px);
    left: calc(50% - 25px);
    border-radius: 50%;
    background-color: #9acfc5;
    border: 5px solid #43beae;
    box-sizing: border-box;
}

.coffee-header__details {
    width: 8px;
    height: 20px;
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #9b9091;
    box-shadow: -12px 0 0 #9b9091, -24px 0 0 #9b9091;
}

.coffee-medium {
    width: 90%;
    height: 160px;
    position: absolute;
    top: 80px;
    left: calc(50% - 45%);
    background-color: #bcb0af;
}

.coffee-medium:before {
    content: "";
    width: 90%;
    height: 100px;
    background-color: #776f6e;
    position: absolute;
    bottom: 0;
    left: calc(50% - 45%);
    border-radius: 20px 20px 0 0;
}

.coffe-medium__exit {
    width: 60px;
    height: 20px;
    position: absolute;
    top: 0;
    left: calc(50% - 30px);
    background-color: #231f20;
}

.coffe-medium__exit::before {
    content: "";
    width: 50px;
    height: 20px;
    border-radius: 0 0 50% 50%;
    position: absolute;
    bottom: -20px;
    left: calc(50% - 25px);
    background-color: #231f20;
}

.coffe-medium__exit::after {
    content: "";
    width: 10px;
    height: 10px;
    position: absolute;
    bottom: -30px;
    left: calc(50% - 5px);
    background-color: #231f20;
}

.coffee-medium__arm {
    width: 70px;
    height: 20px;
    position: absolute;
    top: 15px;
    right: 25px;
    background-color: #231f20;
}

.coffee-medium__arm::before {
    content: "";
    width: 15px;
    height: 5px;
    position: absolute;
    top: 7px;
    left: -15px;
    background-color: #9e9495;
}

.coffee-medium__cup {
    width: 80px;
    height: 47px;
    position: absolute;
    bottom: 0;
    left: calc(50% - 40px);
    background-color: #FFF;
    border-radius: 0 0 70px 70px / 0 0 110px 110px;
}

.coffee-medium__cup::after {
    content: "";
    width: 20px;
    height: 20px;
    position: absolute;
    top: 6px;
    right: -13px;
    border: 5px solid #FFF;
    border-radius: 50%;
}

@keyframes liquid {
    0% {
        height: 0px;  
        opacity: 1;
    }
    5% {
        height: 0px;  
        opacity: 1;
    }
    20% {
        height: 62px;  
        opacity: 1;
    }
    95% {
        height: 62px;
        opacity: 1;
    }
    100% {
        height: 62px;
        opacity: 0;
    }
}

.coffee-medium__liquid {
    width: 6px;
    height: 63px;
    opacity: 0;
    position: absolute;
    top: 50px;
    left: calc(50% - 3px);
    background-color: #74372b;
    animation: liquid 4s 0s linear infinite;
}

.coffee-medium__smoke {
    width: 8px;
    height: 20px;
    position: absolute;  
    border-radius: 5px;
    background-color: #b3aeae;
}

@keyframes smokeOne {
    0% {
        bottom: 20px;
        opacity: 0;
    }
    40% {
        bottom: 50px;
        opacity: .5;
    }
    80% {
        bottom: 80px;
        opacity: .3;
    }
    100% {
        bottom: 80px;
        opacity: 0;
    }
}

@keyframes smokeTwo {
    0% {
        bottom: 40px;
        opacity: 0;
    }
    40% {
        bottom: 70px;
        opacity: .5;
    }
    80% {
        bottom: 80px;
        opacity: .3;
    }
    100% {
        bottom: 80px;
        opacity: 0;
    }
}

.coffee-medium__smoke-one {
    opacity: 0;
    bottom: 50px;
    left: 102px;
    animation: smokeOne 3s 0s linear infinite;
}

.coffee-medium__smoke-two {
    opacity: 0;
    bottom: 70px;
    left: 118px;
    animation: smokeTwo 3s 1s linear infinite;
}

.coffee-medium__smoke-three {
    opacity: 0;
    bottom: 65px;
    right: 118px;
    animation: smokeTwo 3s 2s linear infinite;
}

.coffee-medium__smoke-for {
    opacity: 0;
    bottom: 50px;
    right: 102px;
    animation: smokeOne 3s 1s linear infinite;
}

.coffee-footer {
    width: 95%;
    height: 15px;
    position: absolute;
    bottom: 25px;
    left: calc(50% - 47.5%);
    background-color: #41bdad;
    border-radius: 10px;
}

.coffee-footer::after {
    content: "";
    width: 106%;
    height: 26px;
    position: absolute;
    bottom: -25px;
    left: -8px;
    background-color: #000;
}

/* Adaptation mobile */
@media (max-width: 768px) {
    .construction-animation {
        height: 240px;
    }
    
    .coffee-container {
        transform: scale(0.8);
    }
}

/* Bâtiments en arrière-plan */
.buildings-bg {
    position: absolute;
    top: 10%;
    left: 0;
    width: 100%;
    height: 50%;
    display: flex;
    justify-content: space-around;
    z-index: 1;
}

.bg-building {
    width: 60px;
    height: 100%;
    background: var(--building-color);
    position: relative;
    border-radius: 4px 4px 0 0;
}

.bg-building::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 10px,
        var(--building-dark) 10px,
        var(--building-dark) 20px
    );
    opacity: 0.3;
}

/* Camion de chantier */
.truck {
    position: absolute;
    bottom: 20%;
    left: 20%;
    width: 120px;
    height: 80px;
    animation: truckMove 4s ease-in-out infinite;
    z-index: 2;
}

.truck-body {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 40px;
    background: var(--truck-color);
    border-radius: 8px;
}

.truck-cabin {
    position: absolute;
    bottom: 40px;
    left: 10px;
    width: 40px;
    height: 30px;
    background: var(--truck-color);
    border-radius: 8px 8px 0 0;
}

.truck-window {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 20px;
    height: 15px;
    background: #333;
    border-radius: 4px;
}

.wheel {
    position: absolute;
    bottom: -10px;
    width: 20px;
    height: 20px;
    background: #333;
    border-radius: 50%;
    border: 3px solid #666;
}

.wheel-front {
    right: 15px;
}

.wheel-back {
    left: 15px;
}

/* Panneau de chantier amélioré */
.work-sign {
    position: absolute;
    bottom: 25%;
    right: 20%;
    width: 80px;
    height: 80px;
    z-index: 3;
    transform: rotate(-5deg);
}

.sign-post {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 10px;
    height: 50px;
    background: var(--sign-post-color);
    transform: translateX(-50%);
    border-radius: 2px;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.sign-triangle {
    position: absolute;
    top: 0;
    left: 0;
    width: 80px;
    height: 70px;
    background: var(--sign-color);
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    border: 4px solid var(--sign-border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.worker-icon {
    width: 40px;
    height: 40px;
    background: var(--worker-icon-color);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3C11.175 3 10.5 3.675 10.5 4.5C10.5 5.325 11.175 6 12 6C12.825 6 13.5 5.325 13.5 4.5C13.5 3.675 12.825 3 12 3ZM14 7H10C9.45 7 9 7.45 9 8V14H10.5V19H13.5V14H15V8C15 7.45 14.55 7 14 7Z'/%3E%3C/svg%3E") center/contain;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3C11.175 3 10.5 3.675 10.5 4.5C10.5 5.325 11.175 6 12 6C12.825 6 13.5 5.325 13.5 4.5C13.5 3.675 12.825 3 12 3ZM14 7H10C9.45 7 9 7.45 9 8V14H10.5V19H13.5V14H15V8C15 7.45 14.55 7 14 7Z'/%3E%3C/svg%3E") center/contain;
    transform: scale(1.2);
}

/* Cônes de signalisation */
.cone {
    position: absolute;
    bottom: 20%;
    width: 20px;
    height: 30px;
    background: #ff7043;
    clip-path: polygon(20% 0%, 80% 0%, 100% 100%, 0% 100%);
}

.cone::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 0;
    width: 100%;
    height: 8px;
    background: white;
}

.cone:nth-child(1) { left: 10%; }
.cone:nth-child(2) { left: 40%; }
.cone:nth-child(3) { right: 40%; }

@keyframes truckMove {
    0% {
        transform: translateX(-20px) rotate(-1deg);
    }
    50% {
        transform: translateX(20px) rotate(1deg);
    }
    100% {
        transform: translateX(-20px) rotate(-1deg);
    }
}

/* Styles pour la popup de connexion */
.connection-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.login-button,
.register-button {
    padding: 0.75rem 1.5rem;
    border: 2px solid;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-button {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.login-button:hover {
    background-color: var(--primary-color-dark);
    border-color: var(--primary-color-dark);
}

.register-button {
    background-color: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.register-button:hover {
    background-color: var(--primary-color);
    color: white;
}

.connection-info {
    color: var(--text-color);
    font-size: 0.9rem;
    margin-top: 1rem;
    opacity: 0.8;
}

/* Ajustements pour le mode sombre */
[data-theme="dark"] .login-button {
    background-color: var(--primary-color-dark);
    border-color: var(--primary-color-dark);
}

[data-theme="dark"] .login-button:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

[data-theme="dark"] .register-button {
    color: var(--primary-color-light);
    border-color: var(--primary-color-light);
}

[data-theme="dark"] .register-button:hover {
    background-color: var(--primary-color-light);
    color: var(--background-color);
}

[data-theme="dark"] .connection-info {
    color: var(--text-color-dark);
} 