/* styles.css - Design UI HEAJ "Parcours Étudiants" */

/* ========== FONT ========== */
@font-face {
    font-family: 'DINPro';
    src: url('../fonts/DINPro-Bold.otf') format('opentype');
    font-weight: bold;
    font-style: normal;
}

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

body {
    font-family: 'DINPro', Arial, sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    background-color: #1a1a2e;
}

/* ========== GAME CONTAINER ========== */
#game-container {
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

/* ========== MENUS - BASE ========== */
.menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    background-size: cover;
    background-repeat: round;
}

.menu.active {
    display: flex;
}

/* ========== BACKGROUNDS SPECIFIQUES ========== */
#main-menu,
#level-select-menu {
    background-image: url('../backgrounds/menu-principal_niveau.png');
}
#victory-menu,
#leaderboard-menu,
#game-over-menu {
    background-image: url('../backgrounds/parametre_classement_gameover.png');
}

#camera-setup {
    background-image: url('../backgrounds/callibrage-camera.png');
}

/* ========== CONTENU DES MENUS ========== */
.menu-content {
    position: absolute;
    right: 17%;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 380px;
}

/* ========== SOUS-TITRES ========== */
.menu-subtitle {
    color: #ffffff;
    font-size: 1.1rem;
    font-style: italic;
    text-align: center;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.5px;
}

/* ========== BOUTONS STYLE HEAJ ========== */
.btn-heaj {
    display: flex;
    align-items: center;
    width: 100%;
    height: 55px;
    background: #ffffff;
    border: 3px solid #e63946;
    border-radius: 50px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-heaj:hover {
    transform: scale(1.03);
    box-shadow: 0 5px 20px rgba(230, 57, 70, 0.4);
}

.btn-heaj:active {
    transform: scale(0.98);
}

.btn-heaj-indicator {
    width: 70px;
    height: 100%;
    background: linear-gradient(135deg, #e63946 0%, #c1121f 100%);
    border-radius: 50px 0 0 50px;
    flex-shrink: 0;
}

.btn-heaj-text {
    flex: 1;
    text-align: center;
    font-family: 'DINPro', Arial, sans-serif;
    font-size: 1.1rem;
    font-weight: bold;
    font-style: italic;
    color: #1a1a2e;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding-right: 70px; /* Compense l'indicateur pour centrer */
}

/* Bouton titre (rouge plein) */
.btn-heaj-title {
    background: linear-gradient(135deg, #e63946 0%, #c1121f 100%);
    border: none;
    justify-content: center;
}

.btn-heaj-title .btn-heaj-text {
    color: #ffffff;
    padding-right: 0;
}

.btn-heaj-title .btn-heaj-indicator {
    display: none;
}

/* Bouton niveau (rouge avec dégradé) */
.btn-heaj-level {
    background: linear-gradient(135deg, #e63946 0%, #c1121f 100%);
    border: 3px solid #e63946;
}

.btn-heaj-level .btn-heaj-indicator {
    background: rgba(0, 0, 0, 0.2);
}

.btn-heaj-level .btn-heaj-text {
    color: #ffffff;
}

/* ========== MENU PRINCIPAL ========== */
#main-menu .menu-content {
    top: 66%;
}

/* ========== SELECTION NIVEAU ========== */
#level-select-menu .menu-content {
    top: 70%;
}

/* ========== CLASSEMENT ========== */
#leaderboard-menu .menu-content {
    top: 45%;
    right: 10%;
    width: 450px;
}

.leaderboard-title {
    color: #ffffff;
    font-size: 1.8rem;
    font-style: italic;
    text-align: center;
    margin-bottom: 25px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    text-transform: uppercase;
    line-height: 1.2;
}

.leaderboard-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    max-height: 350px;
    overflow-y: auto;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.leaderboard-medal {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.leaderboard-medal img {
    width: 35px;
    height: 35px;
    object-fit: contain;
}

.leaderboard-rank {
    font-size: 1.5rem;
    font-weight: bold;
    font-style: italic;
    color: #ffffff;
    min-width: 70px;
}

.leaderboard-name {
    flex: 1;
    font-size: 1.5rem;
    font-weight: bold;
    font-style: italic;
    color: #ffffff;
}

.leaderboard-score {
    font-size: 1.2rem;
    color: #e63946;
    font-weight: bold;
}

/* ========== GAME OVER ========== */
#game-over-menu .menu-content {
    top: 50%;
    right: 10%;
    width: 420px;
}

.game-over-title {
    font-family: 'DINPro', Arial, sans-serif;
    font-size: 4rem;
    font-weight: bold;
    font-style: italic;
    color: #ffffff;
    text-transform: uppercase;
    text-shadow: 
        3px 3px 0 #e63946,
        6px 6px 0 rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
    letter-spacing: 2px;
}

.game-over-score {
    color: #ffffff;
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.game-over-score span {
    color: #e63946;
    font-weight: bold;
}

.game-over-input-container {
    width: 100%;
    background: #ffffff;
    border-radius: 15px;
    padding: 15px 20px;
    margin-bottom: 20px;
}

.game-over-input-label {
    font-size: 0.85rem;
    color: #666;
    text-align: center;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.game-over-input {
    width: 100%;
    border: none;
    border-bottom: 2px solid #e63946;
    padding: 10px;
    font-family: 'DINPro', Arial, sans-serif;
    font-size: 1.2rem;
    text-align: center;
    outline: none;
    background: transparent;
}

.game-over-input::placeholder {
    color: #aaa;
}

/* ========== CALIBRAGE CAMERA ========== */
#camera-setup {
    justify-content: center;
    align-items: center;
}

#camera-setup .menu-content {
    position: relative;
    right: auto;
    top: auto;
    transform: none;
    width: auto;
    max-width: 700px;
}

.camera-setup-container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.camera-main-panel {
    background: linear-gradient(135deg, #e63946 0%, #c1121f 100%);
    border-radius: 20px;
    padding: 20px;
    width: 550px;
}

.camera-title {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: bold;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 15px;
}

.camera-video-container {
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
    position: relative;
    aspect-ratio: 4/3;
}

.camera-video-container video,
.camera-video-container canvas {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-status {
    color: #ffffff;
    font-size: 1.3rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 5px;
}

.camera-instruction {
    color: #ffffff;
    font-size: 0.95rem;
    text-align: center;
    margin-bottom: 20px;
    opacity: 0.9;
}

.camera-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.camera-buttons .btn-camera {
    flex: 1;
    padding: 12px 20px;
    background: #1a1a2e;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-family: 'DINPro', Arial, sans-serif;
    font-size: 0.9rem;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
}

.camera-buttons .btn-camera:hover {
    background: #2a2a4e;
    transform: translateY(-2px);
}

.camera-buttons .btn-camera.primary {
    background: #ffffff;
    color: #1a1a2e;
}

.camera-buttons .btn-camera.primary:hover {
    background: #f0f0f0;
}

/* Panneau outils nécessaires (à droite) */
.camera-tools-panel {
    background: linear-gradient(135deg, #e63946 0%, #c1121f 100%);
    border-radius: 20px;
    padding: 15px;
    width: 220px;
    text-align: center;
}

.camera-tools-title {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: bold;
    font-style: italic;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.camera-tools-image {
    background: #ffffff;
    border-radius: 15px 15px 0 0;
    padding: 20px;
    margin-bottom: 10px;
}

.camera-tools-image img {
    width: 120px;
    height: auto;
}

.camera-tools-label {
    color: #1a1a2e;
    font-size: 1rem;
    font-weight: bold;
    text-transform: uppercase;
    background: #ffffff;
    padding: 5px 0;
    border-radius: 0 0 15px 15px;
    margin-top: -10px;
}

/* ========== VICTOIRE ========== */
#victory-menu .menu-content {
    top: 50%;
}

.victory-title {
    font-family: 'DINPro', Arial, sans-serif;
    font-size: 3rem;
    font-weight: bold;
    font-style: italic;
    color: #4ade80;
    text-transform: uppercase;
    text-shadow: 
        3px 3px 0 #166534,
        6px 6px 0 rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
}

/* ========== ZONE DE JEU ========== */
#game-area {
    width: 100%;
    height: 100vh;
    position: relative;
    display: none;
}

#game-area.active {
    display: block;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Webcam pendant le jeu */
#game-video,
#motion-canvas {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 200px;
    height: 150px;
    border: 3px solid #e63946;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

#motion-canvas {
    display: block;
}

/* UI du jeu */
#game-ui {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game-ui-panel {
    background: rgba(26, 26, 46, 0.9);
    border: 2px solid #e63946;
    border-radius: 10px;
    padding: 10px 20px;
    color: #ffffff;
    font-size: 1rem;
}

.game-ui-panel .label {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-bottom: 2px;
}

.game-ui-panel .value {
    font-size: 1.3rem;
    font-weight: bold;
}

#health-bar {
    width: 150px;
    height: 20px;
    background: #333;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 5px;
}

#health-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ade80 0%, #22c55e 100%);
    transition: width 0.3s ease;
    border-radius: 10px;
}

#health-bar-fill.warning {
    background: linear-gradient(90deg, #fbbf24 0%, #f59e0b 100%);
}

#health-bar-fill.danger {
    background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

/* Timer Boss */
#boss-timer {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 26, 46, 0.9);
    border: 2px solid #e63946;
    border-radius: 25px;
    padding: 8px 25px;
    color: #ffffff;
    font-size: 1.1rem;
    z-index: 10;
}

#boss-timer span {
    color: #e63946;
    font-weight: bold;
}

/* Bouclier actif */
#shield-display {
    display: none;
    background: rgba(0, 255, 255, 0.2);
    border: 2px solid #00ffff;
    color: #00ffff;
    animation: pulse-shield 1s infinite;
}

#shield-display.active {
    display: block;
}

@keyframes pulse-shield {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.02); }
}

/* ========== NOTIFICATION ========== */
.notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(26, 26, 46, 0.95);
    border: 3px solid #e63946;
    border-radius: 20px;
    padding: 30px 60px;
    color: #ffffff;
    font-size: 2rem;
    font-weight: bold;
    text-transform: uppercase;
    z-index: 1000;
    animation: notification-pop 0.3s ease;
}

@keyframes notification-pop {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ========== TRANSITION NIVEAU ========== */
#level-transition {
    background: linear-gradient(135deg, #1a1a2e 0%, #2a2a4e 100%);
    justify-content: center;
    align-items: center;
}

#level-transition .menu-content {
    position: relative;
    right: auto;
    top: auto;
    transform: none;
    width: 600px;
    text-align: center;
}

.transition-title {
    font-size: 3rem;
    color: #ffffff;
    margin-bottom: 10px;
}

.transition-subtitle {
    font-size: 1.5rem;
    color: #e63946;
    margin-bottom: 30px;
}

.transition-progress {
    width: 100%;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 20px;
}

.transition-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #e63946 0%, #c1121f 100%);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 15px;
}

.transition-message {
    color: #ffffff;
    font-size: 1.2rem;
    opacity: 0.8;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1200px) {
    .menu-content {
        right: 5%;
        width: 340px;
    }
    
    .btn-heaj {
        height: 50px;
    }
    
    .btn-heaj-text {
        font-size: 1rem;
    }
    
    .camera-main-panel {
        width: 450px;
    }
}

@media (max-width: 768px) {
    .menu-content {
        right: 50%;
        transform: translate(50%, -50%);
        width: 90%;
        max-width: 350px;
    }
    
    .camera-setup-container {
        flex-direction: column;
        align-items: center;
    }
    
    .camera-main-panel {
        width: 100%;
    }
    
    .camera-tools-panel {
        width: 100%;
    }
    
    .game-over-title {
        font-size: 2.5rem;
    }
    
    .leaderboard-title {
        font-size: 1.4rem;
    }
    
    #game-video,
    #motion-canvas {
        width: 120px;
        height: 90px;
    }
}

/* ========== SCROLLBAR CUSTOM ========== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #e63946;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #c1121f;
}

/* ========== BOUTON MUTE GLOBAL ========== */
.mute-button {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2a2a3a 0%, #1a1a2a 100%);
    border: 3px solid #e63946;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(230, 57, 70, 0.3);
}

.mute-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(230, 57, 70, 0.5);
    border-color: #ff4d5a;
}

.mute-button:active {
    transform: scale(0.95);
}

.mute-button.muted {
    background: linear-gradient(135deg, #3a2a2a 0%, #2a1a1a 100%);
    border-color: #666;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.mute-button.muted:hover {
    border-color: #888;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.mute-icon-on,
.mute-icon-off {
    line-height: 1;
}

/* Cacher le bouton mute pendant le jeu actif (optionnel) */
#game-area.active ~ .mute-button {
    /* On garde le bouton visible même en jeu */
}

/* Animation de pulsation quand son actif */
@keyframes sound-pulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(230, 57, 70, 0.3); }
    50% { box-shadow: 0 4px 20px rgba(230, 57, 70, 0.6); }
}

.mute-button:not(.muted) {
    animation: sound-pulse 2s ease-in-out infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .mute-button {
        width: 40px;
        height: 40px;
        font-size: 20px;
        top: 10px;
        right: 10px;
    }
}
