/* Style général inspiré Question pour un Champion */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    min-height: 100vh;
}

/* Page d'accueil */
.home-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px;
}

.home-container h1 {
    font-size: 3em;
    color: #FFD700;
    margin-bottom: 50px;
    text-align: center;
}

.role-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    max-width: 900px;
}

.role-card {
    background: rgba(255,255,255,0.1);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    border: 2px solid #FFD700;
    transition: transform 0.3s;
}

.role-card:hover {
    transform: translateY(-5px);
}

.role-card h2 {
    color: #FFD700;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.role-card p {
    margin-bottom: 20px;
    opacity: 0.9;
}

.btn {
    display: inline-block;
    padding: 12px 25px;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-admin { background: #FFD700; color: #1e3c72; }
.btn-player { background: #4CAF50; color: white; }
.btn-display { background: #2196F3; color: white; }

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* Page principale */
.container {
    display: grid;
    grid-template-areas: 
        "header header"
        "main sidebar";
    grid-template-columns: 1fr 300px;
    grid-template-rows: auto 1fr;
    height: 100vh;
    gap: 20px;
    padding: 20px;
}

header {
    grid-area: header;
    text-align: center;
    background: rgba(255, 215, 0, 0.1);
    padding: 20px;
    border-radius: 15px;
    border: 2px solid #FFD700;
}

header h1 {
    font-size: 2.5em;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    margin-bottom: 15px;
}

.timer-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

#timer {
    font-size: 3em;
    font-weight: bold;
    color: #FFD700;
    background: rgba(0,0,0,0.3);
    padding: 10px 20px;
    border-radius: 10px;
    min-width: 100px;
}

.timer-bar {
    width: 300px;
    height: 20px;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    overflow: hidden;
}

#timer-progress {
    height: 100%;
    background: linear-gradient(90deg, #FFD700, #FFA500);
    width: 100%;
    transition: width 1s linear;
}

/* Section principale */
main {
    grid-area: main;
    background: rgba(255,255,255,0.1);
    padding: 30px;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.question-section {
    text-align: center;
    margin-bottom: 30px;
}

#question-number {
    font-size: 1.2em;
    color: #FFD700;
    margin-bottom: 20px;
}

#question-text {
    font-size: 1.8em;
    line-height: 1.4;
    margin-bottom: 20px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#buzzer-alert {
    font-size: 1.5em;
    color: #FF6B6B;
    font-weight: bold;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
}

button {
    padding: 15px 30px;
    font-size: 1.1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

#start-btn {
    background: #FFD700;
    color: #1e3c72;
}

#correct-btn {
    background: #4CAF50;
    color: white;
}

#wrong-btn {
    background: #f44336;
    color: white;
}

#skip-btn {
    background: #FF9800;
    color: white;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* Tableau des scores */
.scoreboard {
    grid-area: sidebar;
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 15px;
}

.scoreboard h2 {
    color: #FFD700;
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.player-score {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin-bottom: 10px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    border-left: 4px solid #FFD700;
}

.player-name {
    font-weight: bold;
}

.score {
    background: #FFD700;
    color: #1e3c72;
    padding: 5px 10px;
    border-radius: 15px;
    font-weight: bold;
}

/* Interface Animateur */
.admin-page {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.admin-header {
    background: rgba(255,215,0,0.1);
    padding: 20px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border: 2px solid #FFD700;
}

.game-status {
    display: flex;
    gap: 20px;
    font-size: 1.2em;
    color: #FFD700;
}

.admin-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.question-panel, .buzzer-panel, .players-panel {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 10px;
}

.game-controls {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
}

.answer-display {
    background: rgba(76,175,80,0.2);
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
    color: #4CAF50;
    font-weight: bold;
}

.buzzer-controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.admin-player {
    display: flex;
    justify-content: space-between;
    padding: 8px;
    background: rgba(0,0,0,0.2);
    border-radius: 5px;
    margin-bottom: 5px;
}

.pre-game-section {
    text-align: center;
    padding: 20px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}

.pre-game-section h3 {
    color: #FFD700;
    margin-bottom: 15px;
}

.pre-game-section p {
    margin-bottom: 20px;
    font-size: 1.1em;
}

#game-url {
    color: #4CAF50;
    background: rgba(0,0,0,0.2);
    padding: 5px 10px;
    border-radius: 5px;
}

#connected-players {
    margin: 20px 0;
}

#connected-players h4 {
    color: #FFD700;
    margin-bottom: 10px;
}

.waiting-player {
    background: rgba(76,175,80,0.2);
    color: #4CAF50;
    padding: 8px;
    margin: 5px 0;
    border-radius: 5px;
    border-left: 3px solid #4CAF50;
}

#start-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.question-manager {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #2c3e50;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #FFD700;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 1000;
}

.add-question {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.add-question input {
    flex: 1;
    padding: 8px;
    border: 1px solid #FFD700;
    border-radius: 5px;
    background: rgba(255,255,255,0.1);
    color: white;
}

.import-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

.import-questions input[type="file"] {
    flex: 1;
    min-width: 220px;
    color: white;
}

.import-feedback {
    font-size: 0.9em;
    margin-top: 4px;
    width: 100%;
}

.import-feedback.success {
    color: #4CAF50;
}

.import-feedback.error {
    color: #ff6b6b;
}

.question-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.1);
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
}

.question-content {
    flex: 1;
    font-size: 0.9em;
}

.delete-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
}

.room-selector {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px;
}

.room-selector h1 {
    font-size: 3em;
    color: #FFD700;
    margin-bottom: 50px;
}

.room-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    max-width: 800px;
    margin-bottom: 30px;
}

.create-room, .join-room {
    background: rgba(255,255,255,0.1);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    border: 2px solid #FFD700;
}

.create-room h2, .join-room h2 {
    color: #FFD700;
    margin-bottom: 20px;
}

.create-room input, .join-room input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #FFD700;
    border-radius: 5px;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 1em;
}

.create-room button, .join-room button {
    width: 100%;
    padding: 12px;
    background: #FFD700;
    color: #1e3c72;
    border: none;
    border-radius: 5px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
}

.room-info {
    text-align: center;
    max-width: 600px;
    opacity: 0.8;
}

@media (max-width: 768px) {
    .room-options {
        grid-template-columns: 1fr;
    }
}

/* Interface Joueur */
.player-page {
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-container {
    text-align: center;
    padding: 40px;
    max-width: 400px;
    width: 100%;
}

#login-screen h1 {
    color: #FFD700;
    margin-bottom: 30px;
}

#player-name {
    width: 100%;
    padding: 15px;
    font-size: 1.2em;
    border: 2px solid #FFD700;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    color: white;
    margin-bottom: 20px;
}

.player-header {
    margin-bottom: 30px;
}

.player-score {
    font-size: 1.5em;
    color: #FFD700;
    margin-top: 10px;
}

#buzzer-btn {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ff4444, #cc0000);
    color: white;
    font-size: 1.5em;
    font-weight: bold;
    border: 5px solid #FFD700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    margin-bottom: 20px;
}

#buzzer-btn:active, #buzzer-btn.pressed {
    transform: scale(0.95);
    background: linear-gradient(145deg, #cc0000, #990000);
}

#buzzer-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.game-info {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    font-size: 1.1em;
    color: #FFD700;
}

/* Écran de projection */
.display-page {
    font-size: 1.2em;
}

.display-container {
    display: grid;
    grid-template-areas: 
        "header header"
        "main sidebar";
    grid-template-columns: 1fr 350px;
    grid-template-rows: auto 1fr;
    height: 100vh;
    gap: 20px;
    padding: 20px;
}

.display-header {
    grid-area: header;
    text-align: center;
    background: rgba(255, 215, 0, 0.1);
    padding: 20px;
    border-radius: 15px;
    border: 2px solid #FFD700;
    position: relative;
}

#fullscreen-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #FFD700;
    color: #1e3c72;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
}

.display-main {
    grid-area: main;
    background: rgba(255,255,255,0.1);
    padding: 40px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.question-display {
    text-align: center;
    width: 100%;
}

#question-text {
    font-size: 2.2em;
    line-height: 1.4;
    margin: 30px 0;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#buzzer-alert {
    font-size: 1.8em;
    color: #FF6B6B;
    font-weight: bold;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.display-scoreboard {
    grid-area: sidebar;
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 15px;
}

.player-rank {
    display: grid;
    grid-template-columns: 40px 1fr 60px;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    border-left: 4px solid #FFD700;
}

.rank-1 {
    border-left-color: #FFD700;
    background: rgba(255,215,0,0.1);
}

.rank-2 {
    border-left-color: #C0C0C0;
    background: rgba(192,192,192,0.12);
}

.rank-3 {
    border-left-color: #CD7F32;
    background: rgba(205,127,50,0.12);
}

.rank-number {
    font-weight: bold;
    font-size: 1.2em;
    text-align: center;
}

.player-name {
    font-weight: bold;
}

.player-score {
    background: #FFD700;
    color: #1e3c72;
    padding: 5px 8px;
    border-radius: 12px;
    font-weight: bold;
    text-align: center;
    transition: transform 0.3s ease;
}

.player-rank.empty-state {
    display: flex;
    justify-content: center;
    border-left-color: rgba(255, 255, 255, 0.2);
    background: rgba(0,0,0,0.15);
    font-style: italic;
    color: rgba(255,255,255,0.8);
}

#my-score {
    transition: transform 0.3s ease;
}

.buzzer-btn {
    transition: all 0.2s ease;
}

.connection-status {
    position: fixed;
    top: 10px;
    right: 10px;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8em;
    z-index: 1000;
}

.connected {
    background: #4CAF50;
    color: white;
}

.disconnected {
    background: #f44336;
    color: white;
}

.stats-panel {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    grid-column: 1 / -1;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.stat-item {
    text-align: center;
    background: rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #FFD700;
}

.stat-value {
    display: block;
    font-size: 2em;
    font-weight: bold;
    color: #FFD700;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.8;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
    margin-top: 15px;
    overflow: hidden;
}

#question-progress {
    height: 100%;
    background: linear-gradient(90deg, #FFD700, #FFA500);
    width: 0%;
    transition: width 0.5s ease;
}

.final-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.final-screen.visible {
    display: flex;
}

.final-screen h1 {
    font-size: 4em;
    color: #FFD700;
    margin-bottom: 50px;
}

#podium {
    display: flex;
    gap: 30px;
    align-items: flex-end;
    justify-content: center;
    flex-wrap: wrap;
}

.podium-place {
    background: rgba(255,255,255,0.12);
    padding: 30px 24px;
    border-radius: 18px;
    text-align: center;
    min-width: 220px;
    opacity: 0;
    transform: translateY(40px) scale(0.95);
    transition: transform 0.6s ease, opacity 0.6s ease;
    border: 3px solid rgba(255,255,255,0.2);
}

.place-1 {
    border-color: #FFD700;
    order: 2;
}

.place-2 {
    border-color: #C0C0C0;
    order: 1;
}

.place-3 {
    border-color: #CD7F32;
    order: 3;
}

.trophy {
    font-size: 4.5em;
    margin-bottom: 18px;
}

.winner-name {
    font-size: 1.6em;
    font-weight: bold;
    margin-bottom: 12px;
}

.winner-score {
    font-size: 1.3em;
    color: #FFD700;
    margin-bottom: 12px;
}

.position {
    font-size: 1.2em;
    font-weight: bold;
    letter-spacing: 1px;
}

.podium-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.podium-place.animate-in {
    animation: podiumReveal 0.7s var(--delay, 0s) ease forwards;
}

.no-results,
.loading-results {
    background: rgba(0,0,0,0.35);
    padding: 20px 40px;
    border-radius: 12px;
    font-size: 1.2em;
    font-style: italic;
}

.loading-results {
    animation: pulseGlow 1.4s ease-in-out infinite alternate;
}

@keyframes podiumReveal {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 0 rgba(255,215,0,0.2);
        opacity: 0.75;
    }
    100% {
        box-shadow: 0 0 25px rgba(255,215,0,0.35);
        opacity: 1;
    }
}

/* Page des résultats */
.winner-container {
    text-align: center;
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
}

.winner-container h1 {
    color: #FFD700;
    font-size: 3em;
    margin-bottom: 40px;
}

.podium {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
}

.podium-place {
    background: rgba(255,255,255,0.1);
    padding: 30px 20px;
    border-radius: 15px;
    min-width: 200px;
}

.place-1 {
    border: 3px solid #FFD700;
    transform: scale(1.1);
}

.place-2 {
    border: 3px solid #C0C0C0;
}

.place-3 {
    border: 3px solid #CD7F32;
}

.trophy {
    font-size: 4em;
    margin-bottom: 15px;
}

.podium-place .player-name {
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 10px;
}

.podium-place .score {
    font-size: 1.1em;
    color: #FFD700;
    margin-bottom: 5px;
}

.position {
    font-size: 1.2em;
    font-weight: bold;
}

.other-players {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.player-result {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.restart-btn {
    background: #FFD700;
    color: #1e3c72;
    padding: 15px 30px;
    font-size: 1.2em;
}

/* Responsive */
@media (max-width: 768px) {
    .role-selection {
        grid-template-columns: 1fr;
    }
    
    .admin-content {
        grid-template-columns: 1fr;
    }
    
    .display-container {
        grid-template-areas: 
            "header"
            "main"
            "sidebar";
        grid-template-columns: 1fr;
    }
    
    #podium {
        flex-direction: column;
        align-items: center;
    }
    
    .place-1 {
        transform: none;
    }
    
    #question-text {
        font-size: 1.5em;
    }
    
    .final-screen h1 {
        font-size: 2.5em;
    }
}
