/* ===================================
   Styles Communs pour les Jeux GLE-AI
   =================================== */

/* Variables héritées du site principal */
:root {
    --game-bg: #1a1a1a;
    --game-text: #ffffff;
    --game-border: #333333;
    --game-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* ===================================
   Layout Principal du Jeu
   =================================== */
.game-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    padding-top: 80px;
}

.game-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.game-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    max-width: var(--max-width);
    margin: 0 auto;
}

.game-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 700;
    transition: var(--transition);
}

.game-brand:hover {
    opacity: 0.8;
}

.game-title-header {
    font-size: 1.25rem;
    color: var(--text-primary);
    font-weight: 600;
}

.game-controls-header {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-radius: 20px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.player-name {
    font-weight: 600;
    color: var(--primary-color);
}

.btn-change-player {
    background: transparent;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 0.875rem;
    text-decoration: underline;
}

.btn-change-player:hover {
    opacity: 0.7;
}

/* ===================================
   Zone de Jeu Principale
   =================================== */
.game-main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.game-wrapper {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    max-width: 1400px;
    width: 100%;
}

.game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.game-canvas-container {
    position: relative;
    background: #000;
    border-radius: var(--border-radius);
    box-shadow: var(--game-shadow);
    overflow: hidden;
}

.game-canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ===================================
   Panneau Latéral (Scores & Stats)
   =================================== */
.game-sidebar {
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.game-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.panel-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-icon {
    font-size: 1.5rem;
}

.score-display {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.score-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.score-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.score-value.highlight {
    color: var(--accent-color);
    animation: pulse 1s ease-in-out infinite;
}

/* ===================================
   Leaderboard
   =================================== */
.leaderboard-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.leaderboard-item:hover {
    background: var(--bg-secondary);
}

.leaderboard-rank {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 30px;
}

.leaderboard-rank.top-1 {
    color: #FFD700;
}

.leaderboard-rank.top-2 {
    color: #C0C0C0;
}

.leaderboard-rank.top-3 {
    color: #CD7F32;
}

.leaderboard-player {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-score {
    font-weight: 700;
    color: var(--primary-color);
}

.leaderboard-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* ===================================
   Contrôles du Jeu
   =================================== */
.game-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.game-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.game-btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.game-btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.game-btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.game-btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.game-btn-danger {
    background: var(--accent-color);
    color: white;
}

.game-btn-danger:hover {
    background: #e55a2b;
    transform: translateY(-2px);
}

.game-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ===================================
   Instructions
   =================================== */
.game-instructions {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.instructions-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.instructions-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.instructions-list li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.key-badge {
    background: var(--bg-secondary);
    color: var(--primary-color);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    font-weight: 700;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    min-width: 60px;
    text-align: center;
}

/* ===================================
   Modals
   =================================== */
.game-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.game-modal.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.game-modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--accent-color);
    transform: rotate(90deg);
}

.modal-body {
    color: var(--text-secondary);
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* ===================================
   Game Over Screen
   =================================== */
.game-over-content {
    text-align: center;
}

.game-over-title {
    font-size: 2.5rem;
    color: var(--accent-color);
    margin-bottom: 1rem;
}

.final-score {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 1rem 0;
}

.game-over-message {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* ===================================
   Animations
   =================================== */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 1024px) {
    .game-wrapper {
        grid-template-columns: 1fr;
    }

    .game-sidebar {
        min-width: auto;
        width: 100%;
        max-width: 600px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .game-nav {
        padding: 1rem;
    }

    .game-title-header {
        display: none;
    }

    .game-main {
        padding: 1rem;
    }

    .game-wrapper {
        gap: 1rem;
    }

    .game-panel {
        padding: 1rem;
    }

    .panel-title {
        font-size: 1.125rem;
    }

    .score-value {
        font-size: 1.25rem;
    }

    .game-controls {
        gap: 0.5rem;
    }

    .game-btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }

    .modal-content {
        padding: 1.5rem;
    }

    .modal-title {
        font-size: 1.5rem;
    }

    .player-info {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding-top: 60px;
    }

    .game-brand {
        font-size: 1.25rem;
    }

    .logo {
        width: 32px;
        height: 32px;
    }

    .game-controls-header {
        gap: 0.5rem;
    }

    .instructions-list li {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .key-badge {
        min-width: auto;
    }
}

/* ===================================
   Utilitaires
   =================================== */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }