/* Modern Quiz App Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #1e1e1e;
    color: #ffffff;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    padding-bottom: 60px; /* Added padding to account for fixed footer */
}

#app {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

/* Screen Styles */
.screen {
    background-color: #1e5631; /* Dark green background */
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    padding: 40px;
    width: 100%;
    max-width: 1000px;
    transition: all 0.4s ease;
    color: #ffffff;
}

.hidden {
    display: none;
}

/* Typography */
h1 {
    color: #ffffff;
    text-align: center;
    margin-bottom: 40px;
    font-size: 2.8rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

h2 {
    color: #ffffff;
    margin-bottom: 20px;
    font-size: 1.8rem;
    font-weight: 600;
}

/* Form Elements */
.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: #ffffff;
    font-size: 1.1rem;
}

input[type="text"], input[type="file"] {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    background-color: rgba(255, 255, 255, 0.9);
    color: #333;
    transition: all 0.3s ease;
}

input[type="text"]:focus, input[type="file"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

/* Buttons */
.button-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 350px;
    margin: 0 auto;
}

.btn {
    padding: 15px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.primary-btn {
    background-color: #ffffff;
    color: #1e5631;
}

.primary-btn:hover {
    background-color: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.secondary-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.4);
}

.secondary-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.back-btn {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    margin-top: 15px;
}

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

/* Host Screen */
#room-info {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    border-left: 4px solid #ffffff;
}

#room-info p {
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 1.1rem;
}

#room-info span {
    font-weight: 700;
    color: #ffffff;
}

#players-list, #current-question-display, #player-responses, .mini-leaderboard {
    margin-top: 25px;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#connected-players, #response-list {
    list-style-type: disc;
    padding-left: 35px;
}

#connected-players li, #response-list li {
    padding: 8px 15px 8px 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background-color 0.2s ease;
    border-radius: 4px;
    margin-bottom: 5px;
}

#connected-players li:hover, #response-list li:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.correct-answer {
    color: #4cd137;
    font-weight: bold;
    border-left: 3px solid #4cd137;
    padding-left: 15px !important;
}

.wrong-answer {
    color: #e84118;
    font-weight: bold;
    border-left: 3px solid #e84118;
    padding-left: 15px !important;
}

.waiting {
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
}

#question-controls {
    display: flex;
    gap: 15px;
    margin: 25px 0;
}

/* Player Screen */
#player-room-info {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

#player-room-info p {
    font-size: 1.2rem;
    font-weight: 500;
}

#player-room-info span {
    font-weight: 700;
    color: #ffffff;
}

#waiting-message {
    text-align: center;
    padding: 30px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin: 30px 0;
    animation: pulse 2s infinite ease-in-out;
}

#waiting-message p {
    font-size: 1.3rem;
    font-weight: 500;
    color: #ffffff;
}

#question-container {
    padding: 25px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin: 20px 0;
    animation: fadeIn 0.5s ease-in-out;
}

#question-text {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 25px;
    text-align: center;
    color: #ffffff;
}

#answers-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 25px;
    animation: fadeIn 0.5s ease-in-out;
}

.answer-btn {
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    color: #ffffff;
    text-align: left;
    min-height: 80px;
    display: flex;
    align-items: center;
}

.answer-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.answer-btn.selected {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: #ffffff;
}

.answer-btn.correct {
    background-color: rgba(76, 209, 55, 0.3);
    border-color: #4cd137;
}

.answer-btn.incorrect {
    background-color: rgba(232, 65, 24, 0.3);
    border-color: #e84118;
}

/* Leaderboard */
#leaderboard-table, #mini-leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.05);
}

#leaderboard-table th, #leaderboard-table td,
#mini-leaderboard-table th, #mini-leaderboard-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#leaderboard-table th, #mini-leaderboard-table th {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#leaderboard-table tr:hover, #mini-leaderboard-table tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

#leaderboard-table tr:first-child td, #mini-leaderboard-table tr:first-child td {
    background-color: rgba(255, 215, 0, 0.2); /* Gold */
    color: #ffffff;
    font-weight: 700;
}

#leaderboard-table tr:nth-child(2) td, #mini-leaderboard-table tr:nth-child(2) td {
    background-color: rgba(192, 192, 192, 0.2); /* Silver */
    color: #ffffff;
}

#leaderboard-table tr:nth-child(3) td, #mini-leaderboard-table tr:nth-child(3) td {
    background-color: rgba(205, 127, 50, 0.2); /* Bronze */
    color: #ffffff;
}

/* Mini Leaderboard */
.mini-leaderboard {
    border-left: 4px solid #ffffff;
    animation: fadeIn 0.5s ease-in-out;
}

.mini-leaderboard h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mini-leaderboard h2:before {
    content: '🏆';
    font-size: 1.5rem;
}

#mini-leaderboard-table {
    margin: 15px 0;
}

.current-player {
    font-weight: bold;
    background-color: rgba(255, 255, 255, 0.1) !important;
}

/* Player result styles */
#player-result {
    text-align: center;
    padding: 30px;
    margin: 25px 0;
    border-radius: 8px;
    animation: fadeIn 0.5s ease-in-out;
    background-color: rgba(255, 255, 255, 0.1);
}

#result-message {
    font-size: 1.6rem;
    font-weight: bold;
    padding: 20px;
    border-radius: 8px;
    margin-top: 15px;
    display: inline-block;
}

#result-message.correct {
    background-color: rgba(76, 209, 55, 0.2);
    color: #4cd137;
    border: 2px solid #4cd137;
}

#result-message.incorrect {
    background-color: rgba(232, 65, 24, 0.2);
    color: #e84118;
    border: 2px solid #e84118;
}

#result-message.info {
    background-color: rgba(52, 152, 219, 0.2);
    color: #3498db;
    border: 2px solid #3498db;
}

/* Show correct answer in host view */
#correct-answer-display {
    margin-top: 15px;
    padding: 15px;
    background-color: rgba(76, 209, 55, 0.1);
    border-left: 4px solid #4cd137;
    border-radius: 4px;
    font-weight: bold;
}

/* Player leaderboard button */
#player-show-leaderboard-btn {
    margin: 25px auto;
    display: block;
    max-width: 300px;
    width: 100%;
}

/* Points legend */
.points-legend {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 4px solid #ffffff;
}

.points-legend h3 {
    margin-bottom: 10px;
    font-size: 1.2rem;
    color: #ffffff;
}

.points-legend ul {
    list-style-type: none;
}

.points-legend li {
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
}

.points-legend li:before {
    content: '•';
    color: #4cd137;
    font-size: 1.5rem;
}

/* Response summary */
.response-summary {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 12px 15px;
    border-radius: 8px;
    font-weight: 600;
    margin-bottom: 15px !important;
    text-align: center;
}

/* Mobile-friendly elements */
.mobile-friendly {
    width: 100%;
    margin-top: 20px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .screen {
        padding: 25px;
        max-width: 100%;
    }
    
    h1 {
        font-size: 2rem;
        margin-bottom: 30px;
    }
    
    h2 {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 1rem;
    }
    
    #answers-container {
        grid-template-columns: 1fr;
    }
    
    #question-controls {
        flex-direction: column;
    }
    
    /* Improve form elements on mobile */
    input[type="text"], input[type="file"] {
        padding: 12px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
    
    /* Make leaderboard more mobile-friendly */
    #leaderboard-table, #mini-leaderboard-table {
        font-size: 0.9rem;
    }
    
    #leaderboard-table th, #leaderboard-table td,
    #mini-leaderboard-table th, #mini-leaderboard-table td {
        padding: 10px 8px;
    }
}

/* Even smaller screens */
@media (max-width: 480px) {
    .screen {
        padding: 20px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    #leaderboard-table, #mini-leaderboard-table {
        font-size: 0.8rem;
    }
    
    #leaderboard-table th, #leaderboard-table td,
    #mini-leaderboard-table th, #mini-leaderboard-table td {
        padding: 8px 5px;
    }
    
    /* Improve table layout on very small screens */
    #leaderboard-table, #mini-leaderboard-table {
        table-layout: fixed;
    }
    
    /* Make buttons more touch-friendly */
    .btn {
        min-height: 44px;
    }
    
    .answer-btn {
        min-height: 60px;
    }
    
    /* Ensure mini-leaderboard is readable */
    .mini-leaderboard h2 {
        font-size: 1.3rem;
    }
    
    #result-message {
        font-size: 1.3rem;
        padding: 15px;
    }
}