/* ==================
   Scenario Page
   ================== */
.scenario-container {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    color: var(--text-primary);
    padding: 48px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    margin: 40px 0;
    animation: fadeIn 0.5s ease;
}

.scenario-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.2);
    flex-wrap: wrap;
    gap: 16px;
}

.scenario-header h1 {
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
    font-size: 2rem;
    font-weight: 700;
}

.scenario-badge {
    background: var(--primary-gradient);
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    animation: pulse 2s infinite;
}

.scenario-description {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 28px;
    border-radius: var(--border-radius);
    border-left: 5px solid var(--primary-color);
    font-size: 1.15rem;
    line-height: 1.9;
    margin: 24px 0;
    box-shadow: var(--shadow-sm);
}

.response-section {
    margin: 36px 0;
}

.response-section h3 {
    color: var(--text-primary);
    margin-bottom: 16px;
    font-family: 'Poppins', sans-serif;
}

.instruction {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin: 16px 0;
    font-weight: 500;
}

.button-group {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 28px;
}

/* Feedback */
.feedback-section {
    margin-top: 40px;
    animation: slideIn 0.5s ease;
}

.result {
    padding: 28px;
    border-radius: var(--border-radius);
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

.result-correct {
    background: linear-gradient(135deg, #d5f4e6 0%, #a7e9af 100%);
    border-left: 5px solid var(--success-color);
    color: #0f8850;
}

.result-incorrect {
    background: linear-gradient(135deg, #fadbd8 0%, #f8b4ae 100%);
    border-left: 5px solid var(--danger-color);
    color: #c53c2e;
}

.result h3 {
    margin-bottom: 16px;
    font-size: 1.5rem;
    font-weight: 700;
}

.result p {
    margin: 12px 0;
    line-height: 1.7;
    font-size: 1.05rem;
}

.score,
.total-score {
    font-weight: 700;
    font-size: 1.2rem;
    margin-top: 20px;
}

.feedback-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 28px;
}

/* ==================
   Leaderboard
   ================== */
.leaderboard-container {
    padding: 48px 0;
}

.leaderboard-container h1 {
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Global Table Styles (Dark Theme Enforcement) */
table,
.leaderboard-table table,
.responses-table table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-primary);
}

.leaderboard-table,
.recent-responses {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
}

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

th,
.leaderboard-table th {
    padding: 20px;
    text-align: left;
    font-weight: 700;
    font-size: 1.05rem;
    color: white;
    text-transform: none;
    /* Enforce sentence case */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

td,
.leaderboard-table td {
    padding: 20px;
    font-size: 1rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

tbody tr:hover,
.leaderboard-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03) !important;
    /* Subtle hover */
}

.leaderboard-table .rank-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 700;
    min-width: 40px;
    text-align: center;
}

.rank-1 {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #856404;
}

.rank-2 {
    background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
    color: #495057;
}

.rank-3 {
    background: linear-gradient(135deg, #cd7f32 0%, #e09152 100%);
    color: #fff;
}

.current-user-row {
    background: rgba(102, 126, 234, 0.1);
    font-weight: 600;
    border-left: 4px solid var(--primary-color);
}

/* ==================
   Progress & Analytics
   ================== */
.progress-container,
.analytics-container {
    padding: 48px 0;
}

.progress-container h1,
.analytics-container h1 {
    margin-bottom: 32px;
    color: white;
    font-family: 'Poppins', sans-serif;
    font-size: 2.5rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
}

.stat-box {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    padding: 32px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.stat-box:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-box h3 {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    color: var(--text-secondary);
    /* Ensure visibility */
}

.stat-number {
    font-size: 3rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.progress-breakdown,
.vulnerability-profile {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    padding: 40px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: 40px;
}

.progress-breakdown h2,
.vulnerability-profile h2 {
    margin-bottom: 28px;
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
}

.progress-bars {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.progress-item {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.05rem;
}

.progress-bar {
    background: rgba(0, 0, 0, 0.08);
    height: 36px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    background: var(--success-gradient);
    height: 100%;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 12px;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
}

/* Recent Responses */
.recent-responses {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    padding: 40px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: 40px;
}

.recent-responses h2 {
    margin-bottom: 28px;
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
}

.responses-table {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--primary-gradient);
    color: white;
}

th,
td {
    padding: 16px;
    text-align: left;
}

th {
    font-weight: 600;
}

tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.3s ease;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.correct-row {
    background: rgba(56, 239, 125, 0.05);
}

.incorrect-row {
    background: rgba(244, 92, 67, 0.05);
}

.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(56, 239, 125, 0.2);
    color: #0f8850;
}

.badge-danger {
    background: rgba(244, 92, 67, 0.2);
    color: #c53c2e;
}

.action-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 36px;
    flex-wrap: wrap;
}

/* ==================
   Footer
   ================== */
footer {
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    color: white;
    text-align: center;
    padding: 24px 0;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

footer p {
    opacity: 0.9;
}

/* ==================
   Responsive Design
   ================== */
@media (max-width: 768x) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .scenario-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .button-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-option {
        width: 100%;
    }

    .nav-links {
        gap: 1rem;
        font-size: 0.9rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .action-buttons,
    .feedback-actions {
        flex-direction: column;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 12px;
        font-size: 0.9rem;
    }

    .dashboard-container h1,
    .leaderboard-container h1,
    .progress-container h1 {
        font-size: 2rem;
    }

    .auth-box {
        padding: 32px 24px;
    }

    .stat-value {
        font-size: 2rem;
    }

    .stat-number {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .scenario-container,
    .auth-box,
    .achievements-section {
        padding: 24px;
    }

    .action-section {
        padding: 32px 24px;
    }

    .logo {
        font-size: 1.2rem;
    }
}

/* Profile Avatar */
.profile-avatar {
    width: 120px;
    height: 120px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: white;
    margin: 0 auto 24px;
    border: 4px solid white;
    box-shadow: var(--shadow-lg);
}