/* ============================================
   Ecosystem Quiz Game - Styles
   ============================================ */

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

:root {
    --primary-color: #4CAF50;
    --primary-dark: #45a049;
    --secondary-color: #2196F3;
    --secondary-dark: #0b7dda;
    --accent-color: #FF9800;
    --danger-color: #f44336;
    --background: #f5f9fc;
    --card-background: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --success-color: #4CAF50;
    --error-color: #f44336;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    padding-top: 60px;
    color: var(--text-primary);
}

/* ============================================
   Top Navigation Styles
   ============================================ */

.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.nav-link {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: color 0.3s;
}

.nav-link:hover {
    color: var(--secondary-dark);
    text-decoration: underline;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

/* ============================================
   Header Styles
   ============================================ */

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* ============================================
   Card Styles
   ============================================ */

.welcome-card,
.leaderboard-card,
.question-card,
.results-card {
    background: var(--card-background);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
}

/* ============================================
   Home Page Styles
   ============================================ */

.home-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.welcome-card h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.input-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.input-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.input-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

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

.info-section {
    background: var(--card-background);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.info-section h3 {
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.info-section ul {
    list-style: none;
    padding-left: 0;
}

.info-section li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
}

.info-section li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

/* ============================================
   Quiz Page Styles
   ============================================ */

.quiz-header-info {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 8px;
}

.quiz-content {
    min-height: 400px;
}

.question-text {
    font-size: 1.5rem;
    margin-bottom: 30px;
    color: var(--text-primary);
    line-height: 1.6;
}

.choices-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.choice-btn {
    padding: 18px 25px;
    background: var(--card-background);
    border: 3px solid var(--border-color);
    border-radius: 10px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    font-weight: 500;
    color: var(--text-primary);
}

.choice-btn:hover:not(:disabled) {
    background: #f0f0f0;
    border-color: var(--secondary-color);
    transform: translateX(5px);
}

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

.choice-btn.correct {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
    animation: pulse 0.5s;
}

.choice-btn.incorrect {
    background: var(--error-color);
    color: white;
    border-color: var(--error-color);
    animation: shake 0.5s;
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* ============================================
   Results Page Styles
   ============================================ */

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

.results-card h2 {
    color: var(--primary-color);
    margin-bottom: 30px;
    font-size: 2rem;
}

.final-score {
    margin: 30px 0;
}

.score-display {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.score-percentage {
    font-size: 3rem;
    font-weight: bold;
    color: var(--secondary-color);
    margin: 20px 0;
}

.results-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    flex-wrap: wrap;
}

#confetti-container {
    position: relative;
    height: 200px;
    overflow: hidden;
    margin: 20px 0;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--primary-color);
    top: -10px;
    animation: confetti-fall linear;
}

@keyframes confetti-fall {
    to {
        transform: translateY(400px) rotate(360deg);
        opacity: 0;
    }
}

/* ============================================
   Leaderboard Styles
   ============================================ */

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.leaderboard-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: var(--primary-color);
    background: rgba(76, 175, 80, 0.1);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(76, 175, 80, 0.1);
}

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

.leaderboard-table thead {
    background: var(--primary-color);
    color: white;
}

.leaderboard-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.leaderboard-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

.leaderboard-table tbody tr:hover {
    background: #f5f5f5;
}

.leaderboard-table tbody tr.top-three {
    background: #fff9e6;
    font-weight: 600;
}

.loading,
.no-scores {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* ============================================
   Button Styles
   ============================================ */

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: var(--secondary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(33, 150, 243, 0.3);
}

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

.btn-danger:hover {
    background: #d32f2f;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(244, 67, 54, 0.3);
}

/* ============================================
   Utility Classes
   ============================================ */

.hidden {
    display: none !important;
}

/* ============================================
   Mobile Responsive Styles
   ============================================ */

@media (max-width: 768px) {
    body {
        padding: 10px;
        padding-top: 60px;
    }

    .top-nav {
        padding: 10px 15px;
    }

    .nav-link {
        font-size: 0.9rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .welcome-card,
    .leaderboard-card,
    .question-card,
    .results-card {
        padding: 20px;
    }

    .question-text {
        font-size: 1.2rem;
    }

    .choice-btn {
        padding: 15px 20px;
        font-size: 1rem;
    }

    .quiz-header-info {
        flex-direction: column;
        gap: 10px;
        font-size: 1rem;
    }

    .score-display {
        font-size: 1.5rem;
    }

    .score-percentage {
        font-size: 2rem;
    }

    .results-actions {
        flex-direction: column;
    }

    .results-actions .btn {
        width: 100%;
    }

    .leaderboard-header {
        flex-direction: column;
    }

    .leaderboard-header .btn {
        width: 100%;
    }

    .leaderboard-tabs {
        flex-wrap: wrap;
    }

    .tab-btn {
        flex: 1;
        min-width: 100px;
        padding: 10px 15px;
        font-size: 0.9rem;
    }

    .leaderboard-table {
        font-size: 0.9rem;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 10px 8px;
    }

    .leaderboard-table th:nth-child(5),
    .leaderboard-table td:nth-child(5) {
        display: none;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }

    .question-text {
        font-size: 1.1rem;
    }

    .choice-btn {
        padding: 12px 15px;
        font-size: 0.95rem;
    }

    .leaderboard-table th:nth-child(4),
    .leaderboard-table td:nth-child(4) {
        display: none;
    }
}

