* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0;
}

/* Navbar */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: white;
    transition: opacity 0.3s ease;
}

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

.navbar-logo {
    font-size: 1.8em;
}

.navbar-title {
    font-size: 1.5em;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-menu {
    display: flex;
    gap: 20px;
    align-items: center;
}

.navbar-item {
    color: #333;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.navbar-item:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.navbar-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.navbar-admin {
    background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
    color: #333 !important;
    font-weight: 600;
}

/* Ajuster le container pour la navbar */
body > .container {
    margin: 20px auto;
    max-width: 800px;
    width: calc(100% - 40px);
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    width: 100%;
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 15px;
}

.score-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: 1.2em;
    font-weight: bold;
}

main {
    padding: 40px;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: fadeIn 0.5s ease-in;
}

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

#start-screen {
    text-align: center;
}

#start-screen h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 2em;
}

#start-screen p {
    color: #666;
    font-size: 1.2em;
    margin-bottom: 30px;
    line-height: 1.6;
}

.config-section {
    margin-top: 40px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.config-section h3 {
    color: #667eea;
    margin-bottom: 10px;
}

.info-text {
    font-size: 1em !important;
    color: #555 !important;
}

code {
    background: #e9ecef;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #d63384;
}

.btn-primary, .btn-secondary {
    padding: 15px 40px;
    font-size: 1.1em;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    padding: 10px 20px;
    font-size: 0.9em;
}

.btn-secondary:hover {
    background: #5a6268;
}

.audio-player {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

#audio-player {
    display: none;
}

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

.btn-audio {
    padding: 12px 25px;
    font-size: 1em;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-audio:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-audio:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

#question-container h2 {
    color: #667eea;
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.8em;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.option-btn {
    padding: 20px;
    font-size: 1.1em;
    border: 3px solid #e9ecef;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    text-align: left;
}

.option-btn:hover:not(.correct):not(.incorrect):not(:disabled) {
    border-color: #667eea;
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

.option-btn.correct {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.option-btn.incorrect {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.option-btn:disabled {
    cursor: not-allowed;
}

.feedback {
    text-align: center;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.feedback.hidden {
    display: none;
}

.feedback.correct {
    background: #d4edda;
    color: #155724;
}

.feedback.incorrect {
    background: #f8d7da;
    color: #721c24;
}

#feedback-text {
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 20px;
}

#end-screen {
    text-align: center;
}

#end-screen h2 {
    color: #667eea;
    margin-bottom: 30px;
    font-size: 2em;
}

.final-score {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.final-score p {
    font-size: 1.3em;
    color: #666;
    margin-bottom: 10px;
}

.big-score {
    font-size: 3em !important;
    font-weight: bold;
    color: #667eea !important;
    margin: 20px 0 !important;
}

.percentage {
    font-size: 1.5em !important;
    color: #764ba2 !important;
    font-weight: bold;
}

/* Nouveaux styles pour le système de lobby */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
}

/* Améliorer la lisibilité du menu */
.screen h2 {
    color: #333;
}

.screen p {
    color: #666;
}

.screen a {
    color: #667eea;
}

.screen a:hover {
    color: #764ba2;
}

.form-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
}

.form-container input {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    margin-bottom: 15px;
    transition: border-color 0.3s ease;
}

.form-container input:focus {
    outline: none;
    border-color: #667eea;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.button-group button {
    flex: 1;
}

/* Lobby screen */
.lobby-header {
    text-align: center;
    margin-bottom: 20px;
}

.lobby-info {
    text-align: center;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.lobby-info p {
    margin: 0;
    font-size: 1.1em;
    color: #666;
}

.lobby-info strong {
    color: #667eea;
    font-size: 1.2em;
}

.lobby-code-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
    font-size: 1.3em;
}

.lobby-code-display strong {
    color: #667eea;
    font-size: 1.5em;
    letter-spacing: 2px;
    background: #f8f9fa;
    padding: 10px 20px;
    border-radius: 10px;
}

.btn-small {
    padding: 8px 15px;
    font-size: 0.9em;
    border: none;
    border-radius: 8px;
    background: #667eea;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-small:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.players-section {
    margin: 30px 0;
}

.players-section h3 {
    color: #667eea;
    margin-bottom: 15px;
    text-align: center;
}

.players-list {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    min-height: 100px;
    max-height: 300px;
    overflow-y: auto;
}

.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    gap: 10px;
}

.player-item:last-child {
    margin-bottom: 0;
}

.player-item .player-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-name {
    font-weight: 500;
    font-size: 1.1em;
}

.player-badge {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: bold;
}

.player-actions {
    display: flex;
    gap: 5px;
    align-items: center;
}

.btn-kick {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-kick:hover {
    background: #c82333;
    transform: scale(1.05);
}

.lobby-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

/* Game info */
.game-info {
    text-align: center;
    margin-bottom: 20px;
}

.players-answered {
    background: #f8f9fa;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 500;
    color: #667eea;
}

/* Leaderboard */
.leaderboard-container {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.leaderboard-container h3 {
    color: #667eea;
    text-align: center;
    font-size: 1.8em;
    margin-bottom: 20px;
}

.leaderboard {
    max-width: 500px;
    margin: 0 auto;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: white;
    border-radius: 10px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.leaderboard-item:hover {
    transform: translateY(-2px);
}

.leaderboard-item.first {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border: 3px solid #ffa500;
}

.leaderboard-item.second {
    background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
}

.leaderboard-item.third {
    background: linear-gradient(135deg, #cd7f32 0%, #e09856 100%);
}

.leaderboard-rank {
    font-size: 1.8em;
    font-weight: bold;
    color: #667eea;
    min-width: 50px;
}

.leaderboard-item.first .leaderboard-rank {
    color: #b8860b;
}

.leaderboard-name {
    flex: 1;
    font-size: 1.2em;
    font-weight: 500;
    padding: 0 15px;
}

.leaderboard-score {
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
}

.leaderboard-item.first .leaderboard-score {
    color: #b8860b;
}

.end-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.player-item {
    animation: slideIn 0.3s ease-out;
}

.leaderboard-item {
    animation: slideIn 0.5s ease-out;
}

.leaderboard-item:nth-child(1) { animation-delay: 0.1s; }
.leaderboard-item:nth-child(2) { animation-delay: 0.2s; }
.leaderboard-item:nth-child(3) { animation-delay: 0.3s; }
.leaderboard-item:nth-child(4) { animation-delay: 0.4s; }
.leaderboard-item:nth-child(5) { animation-delay: 0.5s; }

@media (max-width: 600px) {
    header h1 {
        font-size: 1.8em;
    }

    .score-container {
        flex-direction: column;
        gap: 10px;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    main {
        padding: 20px;
    }

    .lobby-code-display {
        flex-direction: column;
    }

    .button-group {
        flex-direction: column;
    }

    .leaderboard-item {
        padding: 12px 15px;
    }

    .leaderboard-rank {
        font-size: 1.4em;
        min-width: 40px;
    }

    .leaderboard-name {
        font-size: 1em;
    }

    .leaderboard-score {
        font-size: 1.2em;
    }
}

/* Lobby options */
#lobby-options {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.form-group-inline {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-group-inline label {
    font-weight: 600;
    color: #333;
    font-size: 1.05em;
}

.form-group-inline select {
    width: 100%;
    padding: 12px 15px;
    font-size: 1.05em;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.form-group-inline select:focus {
    outline: none;
    border-color: #667eea;
}

/* Admin link */
.admin-link {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.admin-link a {
    color: #999;
    text-decoration: none;
    font-size: 0.9em;
    transition: color 0.3s ease;
}

.admin-link a:hover {
    color: #667eea;
}

/* Footer */
footer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 20px;
    border-radius: 0 0 20px 20px;
}

footer p {
    margin: 0;
    font-size: 0.95em;
    font-weight: 500;
}

footer a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: white;
    text-decoration: underline;
}

/* Admin Popup Styles */
.admin-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.admin-popup-overlay.show {
    opacity: 1;
}

.admin-popup {
    background: white;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: popupSlide 0.4s ease-out;
}

@keyframes popupSlide {
    from {
        transform: translateY(-50px) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.admin-popup-header {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 20px 20px 0 0;
}

.admin-popup-header h3 {
    margin: 0;
    font-size: 1.4em;
}

.admin-popup-body {
    padding: 30px;
}

.admin-popup-body p {
    font-size: 1.2em;
    line-height: 1.6;
    color: #333;
    margin: 0;
    word-wrap: break-word;
}

.admin-popup-footer {
    padding: 20px 30px;
    text-align: center;
    border-top: 1px solid #e9ecef;
}

.admin-popup-footer .btn-primary {
    padding: 12px 40px;
    font-size: 1.1em;
}

/* Chat Styles */
.chat-container {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 320px;
    max-height: 500px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: all 0.3s ease;
}

.chat-container.collapsed {
    max-height: 50px;
}

.chat-container.collapsed .chat-messages,
.chat-container.collapsed .chat-input-container {
    display: none;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 15px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.1em;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    min-height: 300px;
    max-height: 350px;
    background: #f8f9fa;
}

.chat-message {
    margin-bottom: 12px;
    padding: 8px 12px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    animation: slideInChat 0.3s ease-out;
}

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

.chat-message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.chat-message-author {
    font-weight: bold;
    color: #667eea;
    font-size: 0.9em;
}

.chat-message-time {
    color: #999;
    font-size: 0.75em;
}

.chat-message-text {
    color: #333;
    font-size: 0.95em;
    word-wrap: break-word;
}

.chat-input-container {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: white;
    border-radius: 0 0 15px 15px;
    border-top: 1px solid #e9ecef;
}

.chat-input-container input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.95em;
    transition: border-color 0.3s ease;
}

.chat-input-container input:focus {
    outline: none;
    border-color: #667eea;
}

.chat-input-container button {
    padding: 10px 15px;
    font-size: 0.9em;
    white-space: nowrap;
}

/* Ajustements responsive pour le chat */
@media (max-width: 1024px) {
    .chat-container {
        right: 10px;
        width: 280px;
        max-height: 400px;
    }
    
    .chat-messages {
        min-height: 200px;
        max-height: 250px;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 10px 15px;
    }
    
    .navbar-logo {
        font-size: 1.5em;
    }
    
    .navbar-title {
        font-size: 1.2em;
    }
    
    .navbar-menu {
        gap: 8px;
    }
    
    .navbar-item {
        padding: 6px 10px;
        font-size: 0.85em;
    }
    
    .chat-container {
        position: fixed;
        right: 0;
        left: 0;
        bottom: 0;
        top: auto;
        transform: none;
        width: 100%;
        max-height: 300px;
        border-radius: 15px 15px 0 0;
    }
    
    .chat-messages {
        min-height: 150px;
        max-height: 200px;
    }
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: slideInModal 0.3s ease-out;
}

@keyframes slideInModal {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.btn-close {
    background: none;
    border: none;
    color: white;
    font-size: 2em;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 30px;
    text-align: center;
}

.qr-description {
    color: #666;
    font-size: 1.1em;
    margin-bottom: 20px;
    line-height: 1.5;
}

.qr-code-display {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
}

.qr-code-display canvas,
.qr-code-display img {
    border: 5px solid white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.qr-link {
    color: #666;
    font-size: 0.95em;
    margin: 20px 0;
    word-break: break-all;
}

.qr-link strong {
    color: #667eea;
    font-size: 1.05em;
}

#copy-qr-link-btn {
    margin-top: 15px;
}

/* Responsive modal */
@media (max-width: 600px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-header h2 {
        font-size: 1.2em;
    }
    
    .modal-body {
        padding: 20px;
    }
}

/* Modal Kick Confirmation */
.modal-small {
    max-width: 400px;
}

.modal-header-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.kick-message {
    font-size: 1.1em;
    color: #333;
    margin-bottom: 25px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-danger {
    background: #dc3545;
    color: white;
    padding: 12px 30px;
    font-size: 1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.4);
}

.modal-actions .btn-secondary {
    padding: 12px 30px;
    font-size: 1em;
}

