/* ====================================
   STYLES GÉNÉRAUX
   ==================================== */
body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    overflow: hidden;
}

h1 {
    color: white;
    text-align: center;
    margin: 10px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

/* ====================================
   CONTENEUR DE JEU
   ==================================== */
#gameContainer {
    position: relative;
    border: 3px solid #fff;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: calc(100vh - 150px);
    display: flex;
    align-items: center;
    justify-content: center;
}

#gameContainer:fullscreen {
    max-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#gameContainer:fullscreen #gameCanvas {
    max-width: 100vw;
    max-height: 100vh;
    width: 100% !important;
    height: 100% !important;
}

#fullscreenBtn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    transition: all 0.3s;
    z-index: 1000;
}

#fullscreenBtn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

#gameCanvas {
    background: linear-gradient(to bottom, #87CEEB 0%, #98FB98 100%);
    display: block;
    border-radius: 7px;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ====================================
   INTERFACE UTILISATEUR (UI)
   ==================================== */
#ui {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 800px;
    margin-top: 10px;
    color: white;
    font-size: 18px;
    font-weight: bold;
}

#score, #lives, #level {
    background: rgba(255,255,255,0.2);
    padding: 10px 15px;
    border-radius: 5px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
}

#score:hover, #lives:hover, #level:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255,255,255,0.3);
}

/* ====================================
   ÉCRAN GAME OVER
   ==================================== */
#gameOver {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    display: none;
    z-index: 100;
}

#gameOver button {
    background: #4CAF50;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 15px;
}

#gameOver button:hover {
    background: #45a049;
}

/* ====================================
   INSTRUCTIONS
   ==================================== */
#instructions {
    color: white;
    text-align: center;
    margin-top: 8px;
    font-size: 14px;
    opacity: 0.8;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* ====================================
   ANIMATIONS
   ==================================== */
.level-up {
    animation: levelUpPulse 1s ease-out;
}

@keyframes levelUpPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); color: #FFD700; }
    100% { transform: scale(1); }
}

/* ====================================
   CONTRÔLES MOBILES
   ==================================== */
#mobileControls {
    position: fixed;
    bottom: 20px;
    left: 0;
    right: 0;
    display: none;
    justify-content: space-between;
    padding: 0 20px;
    pointer-events: none;
    z-index: 1000;
}

#joystickArea {
    position: relative;
    width: 150px;
    height: 150px;
    pointer-events: all;
}

#joystickBase {
    position: absolute;
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.3);
    border: 3px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    backdrop-filter: blur(10px);
}

#joystickStick {
    position: absolute;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.7);
    border: 3px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.1s;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

#shootButton {
    width: 80px;
    height: 80px;
    background: rgba(255, 100, 100, 0.7);
    border: 4px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all;
    user-select: none;
    -webkit-user-select: none;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 15px rgba(255,0,0,0.5);
    cursor: pointer;
}

#shootButton:active {
    background: rgba(255, 50, 50, 0.9);
    transform: scale(0.95);
}

/* ====================================
   RESPONSIVE - MOBILE
   ==================================== */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    h1 {
        font-size: 24px;
        margin-bottom: 10px;
    }
    
    #ui {
        font-size: 14px;
    }
    
    #score, #lives, #level {
        padding: 8px 10px;
    }
    
    #instructions {
        font-size: 12px;
    }
    
    #mobileControls {
        display: flex;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 20px;
    }
    
    #ui {
        font-size: 12px;
    }
    
    #joystickArea, #joystickBase {
        width: 120px;
        height: 120px;
    }
    
    #shootButton {
        width: 70px;
        height: 70px;
        font-size: 20px;
    }
}

/* ====================================
   LEADERBOARD
   ==================================== */
#leaderboard {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 30px;
    border-radius: 15px;
    border: 2px solid #FFD700;
    min-width: 400px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    display: none;
    z-index: 2000;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

#leaderboard.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

#leaderboard h2 {
    text-align: center;
    color: #FFD700;
    margin-top: 0;
    font-size: 28px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

#leaderboard .close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s;
}

#leaderboard .close-btn:hover {
    opacity: 1;
}

#leaderboard table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

#leaderboard th {
    background: rgba(255, 215, 0, 0.2);
    padding: 12px;
    text-align: left;
    border-bottom: 2px solid #FFD700;
    font-size: 14px;
}

#leaderboard td {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 14px;
}

#leaderboard tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

#leaderboard .rank {
    text-align: center;
    font-weight: bold;
    color: #FFD700;
    font-size: 16px;
    width: 50px;
}

#leaderboard .score {
    text-align: right;
    color: #4CAF50;
    font-weight: bold;
    font-size: 16px;
}

.leaderboard-btn {
    background: rgba(255, 215, 0, 0.2);
    border: 2px solid #FFD700;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    margin: 0 5px;
}

.leaderboard-btn:hover {
    background: rgba(255, 215, 0, 0.4);
    transform: scale(1.05);
}

.leaderboard-btn.active {
    background: rgba(255, 215, 0, 0.5);
    border-color: #FFF;
}

#leaderboard-filters {
    text-align: center;
    margin-bottom: 20px;
}

@media (max-width: 480px) {
    #leaderboard {
        min-width: 320px;
        padding: 20px;
    }
    
    #leaderboard h2 {
        font-size: 22px;
    }
    
    #leaderboard th, #leaderboard td {
        padding: 8px 5px;
        font-size: 12px;
    }
    
    .leaderboard-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* ====================================
   INTERFACE D'AUTHENTIFICATION
   ==================================== */
#authModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

#authModal.active {
    display: flex;
    animation: fadeIn 0.3s ease-in;
}

#authContainer {
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #FFD700;
    border-radius: 15px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

#authContainer h2 {
    color: #FFD700;
    text-align: center;
    margin-top: 0;
    font-size: 24px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.auth-input {
    padding: 12px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.auth-input:focus {
    outline: none;
    border-color: #FFD700;
}

.auth-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.auth-btn {
    padding: 12px 20px;
    border: 2px solid #FFD700;
    background: rgba(255, 215, 0, 0.2);
    color: white;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.auth-btn:hover {
    background: rgba(255, 215, 0, 0.4);
    transform: scale(1.02);
}

.auth-btn.google {
    background: #4285f4;
    border-color: #4285f4;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.auth-btn.google:hover {
    background: #357ae8;
    border-color: #357ae8;
}

.auth-divider {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    margin: 15px 0;
    position: relative;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
}

.auth-divider::before {
    left: 0;
}

.auth-divider::after {
    right: 0;
}

.auth-toggle {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 15px;
    font-size: 14px;
}

.auth-toggle a {
    color: #FFD700;
    cursor: pointer;
    text-decoration: none;
}

.auth-toggle a:hover {
    text-decoration: underline;
}

.auth-error {
    background: rgba(244, 67, 54, 0.2);
    border: 1px solid #f44336;
    color: #ff6b6b;
    padding: 10px;
    border-radius: 5px;
    font-size: 14px;
    display: none;
}

.auth-error.active {
    display: block;
}

#userInfo {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #FFD700;
    border-radius: 10px;
    padding: 10px 15px;
    color: white;
    display: none;
    align-items: center;
    gap: 10px;
    z-index: 1000;
}

#userInfo.active {
    display: flex;
}

#userInfo img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #FFD700;
    background: rgba(255, 255, 255, 0.1);
}

#userInfo .username {
    font-weight: bold;
    color: #FFD700;
}

#userInfo .logout-btn {
    background: rgba(244, 67, 54, 0.3);
    border: 1px solid #f44336;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

#userInfo .logout-btn:hover {
    background: rgba(244, 67, 54, 0.5);
}

@media (max-width: 480px) {
    #authContainer {
        padding: 20px;
    }
    
    #userInfo {
        top: 5px;
        right: 5px;
        font-size: 12px;
        padding: 8px 12px;
    }
    
    #userInfo img {
        width: 24px;
        height: 24px;
    }
}

