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

:root {
    --primary: #8b5cf6;
    --primary-dark: #7c3aed;
    --secondary: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-dark: #0f0b1a;
    --bg-card: rgba(26, 19, 38, 0.8);
    --border-color: #3c2f5a;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: linear-gradient(135deg, #0f0b1a 0%, #1a1326 50%, #241b33 100%);
    min-height: 100vh;
    color: var(--text-primary);
}

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

/* Text Gradient */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.3);
}

.btn-secondary {
    background: rgba(60, 47, 90, 0.3);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--primary);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #34d399);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #f87171);
    color: white;
}

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

/* Cards */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 20px;
}

.card-header {
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.5em;
    font-weight: 700;
    margin-bottom: 8px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(60, 47, 90, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1em;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* Select dropdown styling */
select.form-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

select.form-input option {
    background: #1a1326;
    color: #f8fafc;
    padding: 10px;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 2em;
    margin-bottom: 10px;
}

.login-header p {
    color: var(--text-secondary);
}

/* Navigation */
.navbar {
    background: rgba(15, 11, 26, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.navbar-nav {
    display: flex;
    gap: 15px;
    align-items: center;
}

.btn-logout {
    flex-shrink: 0;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
    background: rgba(139, 92, 246, 0.2);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-name {
    color: var(--text-secondary);
}

/* Dashboard */
.dashboard-header {
    text-align: center;
    margin-bottom: 40px;
}

.dashboard-header h1 {
    font-size: 2.2em;
    margin-bottom: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
}

.stat-value {
    font-size: 2.5em;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-value.primary { color: var(--primary); }
.stat-value.success { color: var(--success); }
.stat-value.warning { color: var(--warning); }

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9em;
}

/* Module Grid */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.module-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 30px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.module-card:hover:not(.locked) {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(139, 92, 246, 0.2);
    border-color: var(--primary);
}

.module-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.module-card.locked:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--border-color);
}

.module-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.module-number {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2em;
}

.module-title {
    font-size: 1.2em;
    font-weight: 700;
}

.module-progress {
    margin-bottom: 20px;
}

.progress-bar {
    background: rgba(60, 47, 90, 0.3);
    border-radius: 8px;
    height: 8px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    border-radius: 8px;
    transition: width 0.6s ease;
}

.progress-fill.excellent { background: linear-gradient(135deg, var(--success), #34d399); }
.progress-fill.good { background: linear-gradient(135deg, var(--warning), #fbbf24); }
.progress-fill.needs-work { background: linear-gradient(135deg, var(--danger), #f87171); }
.progress-fill.incomplete { background: linear-gradient(135deg, var(--primary), #a78bfa); }

/* Quiz Page */
.quiz-header {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px 30px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quiz-info {
    display: flex;
    gap: 30px;
}

.quiz-info-item {
    text-align: center;
}

.quiz-info-label {
    color: var(--text-muted);
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quiz-info-value {
    font-size: 1.3em;
    font-weight: 700;
}

.question-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 20px;
}

.question-number {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
}

.question-text {
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 25px;
    line-height: 1.4;
}

.options-grid {
    display: grid;
    gap: 12px;
}

.option {
    background: rgba(60, 47, 90, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 15px;
}

.option:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--primary);
}

.option.selected {
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--primary);
}

.option.correct {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--success);
}

.option.incorrect {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--danger);
}

.option-letter {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(139, 92, 246, 0.3);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.option.selected .option-letter {
    background: var(--primary);
    color: white;
}

.option.correct .option-letter {
    background: var(--success);
    color: white;
}

.option.incorrect .option-letter {
    background: var(--danger);
    color: white;
}

.option-text {
    flex: 1;
    color: var(--text-secondary);
}

.option.selected .option-text,
.option.correct .option-text,
.option.incorrect .option-text {
    color: var(--text-primary);
}

/* Explanation */
.explanation-container {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    display: none;
}

.explanation-container.show {
    display: block;
    animation: slideDown 0.4s ease;
}

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

.explanation-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.explanation-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.explanation-icon.correct {
    background: var(--success);
    color: white;
}

.explanation-icon.incorrect {
    background: var(--danger);
    color: white;
}

.explanation-title {
    font-weight: 600;
}

.explanation-text {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Quiz Controls */
.quiz-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

/* Results */
.results-container {
    text-align: center;
    padding: 40px;
}

.results-score {
    font-size: 4em;
    font-weight: 800;
    margin: 20px 0;
}

.results-score.excellent { color: var(--success); }
.results-score.good { color: var(--warning); }
.results-score.needs-work { color: var(--danger); }

.results-message {
    font-size: 1.2em;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

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

/* Alert */
.alert {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive - Tablet */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .navbar-content {
        flex-wrap: wrap;
        gap: 8px;
        padding: 0 15px;
    }

    .navbar-brand {
        font-size: 1.1em;
        width: 100%;
        text-align: center;
        order: -1;
    }

    .navbar-right {
        width: 100%;
        justify-content: space-between;
        gap: 10px;
    }

    .navbar-nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .nav-link {
        padding: 6px 12px;
        font-size: 0.9em;
    }

    .btn-logout {
        padding: 8px 12px;
        font-size: 0.85em;
    }

    .dashboard-header h1 {
        font-size: 1.6em;
    }

    .quiz-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px 20px;
    }

    .quiz-info {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }

    .module-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .card {
        padding: 20px;
        border-radius: 12px;
    }

    .module-card {
        padding: 20px;
    }

    .question-container {
        padding: 20px;
    }

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

    .results-score {
        font-size: 3em;
    }
}

/* Responsive - Mobile */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .navbar {
        padding: 8px 0;
    }

    .navbar-content {
        padding: 0 10px;
        gap: 6px;
    }

    .navbar-brand {
        font-size: 1em;
        line-height: 1.2;
        width: 100%;
        text-align: center;
        order: -1;
    }

    .navbar-right {
        width: 100%;
        justify-content: space-between;
        gap: 6px;
    }

    .navbar-nav {
        gap: 5px;
    }

    .nav-link {
        padding: 5px 8px;
        font-size: 0.75em;
    }

    .btn-logout {
        padding: 5px 10px;
        font-size: 0.75em;
    }

    .btn {
        padding: 10px 16px;
        font-size: 0.9em;
    }

    .dashboard-header {
        margin-bottom: 20px;
    }

    .dashboard-header h1 {
        font-size: 1.3em;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin-bottom: 20px;
    }

    .stat-card {
        padding: 15px 10px;
        border-radius: 10px;
    }

    .stat-value {
        font-size: 1.8em;
    }

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

    .module-card {
        padding: 15px;
        border-radius: 12px;
    }

    .module-header {
        gap: 10px;
        margin-bottom: 15px;
    }

    .module-number {
        width: 40px;
        height: 40px;
        font-size: 1em;
        border-radius: 10px;
    }

    .module-title {
        font-size: 1em;
    }

    .card {
        padding: 15px;
        border-radius: 10px;
        margin-bottom: 15px;
    }

    .card-title {
        font-size: 1.2em;
    }

    /* Quiz page mobile */
    .quiz-header {
        padding: 12px 15px;
        border-radius: 12px;
        margin-bottom: 15px;
    }

    .quiz-info {
        gap: 12px;
    }

    .quiz-info-item {
        min-width: 60px;
    }

    .quiz-info-label {
        font-size: 0.7em;
    }

    .quiz-info-value {
        font-size: 1.1em;
    }

    .question-container {
        padding: 15px;
        border-radius: 12px;
        margin-bottom: 15px;
    }

    .question-number {
        font-size: 0.8em;
        margin-bottom: 10px;
    }

    .question-text {
        font-size: 1em;
        margin-bottom: 20px;
        line-height: 1.5;
    }

    .options-grid {
        gap: 10px;
    }

    .option {
        padding: 12px 15px;
        border-radius: 10px;
        gap: 12px;
    }

    .option-letter {
        width: 30px;
        height: 30px;
        font-size: 0.9em;
        border-radius: 6px;
    }

    .option-text {
        font-size: 0.95em;
        line-height: 1.4;
    }

    .explanation-container {
        padding: 15px;
        border-radius: 10px;
        margin-top: 15px;
    }

    .explanation-text {
        font-size: 0.9em;
    }

    .quiz-controls {
        flex-direction: column;
        gap: 10px;
    }

    .quiz-controls .btn {
        width: 100%;
    }

    /* Results mobile */
    .results-container {
        padding: 20px;
    }

    .results-score {
        font-size: 2.5em;
    }

    .results-message {
        font-size: 1em;
        margin-bottom: 20px;
    }

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

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

    /* Form mobile */
    .form-input {
        padding: 12px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .form-label {
        font-size: 0.9em;
    }

    .form-group {
        margin-bottom: 15px;
    }

    /* Login mobile */
    .login-container {
        padding: 15px;
    }

    .login-container .card {
        padding: 20px;
    }

    /* Progress page mobile */
    .progress-bar {
        height: 6px;
    }

    /* Charts grid mobile */
    [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}

/* Overall Test Card */
.overall-test-card {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.2));
    border: 2px solid var(--primary);
}

.overall-test-card .module-number {
    width: 60px;
    height: 60px;
    font-size: 1.5em;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* Module Details Grid (Progress page) */
.module-details-grid {
    display: grid;
    gap: 15px;
}

@media (max-width: 480px) {
    .module-details-grid {
        gap: 12px;
    }
}

/* Module Detail Cards (Progress page) */
.module-detail-card {
    background: rgba(60, 47, 90, 0.3);
    border-radius: 12px;
    padding: 20px;
}

.module-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.module-detail-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.module-detail-number {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.module-detail-title {
    font-weight: 600;
}

.module-detail-attempts {
    color: var(--text-muted);
    font-size: 0.9em;
}

.module-detail-scores {
    display: flex;
    align-items: center;
    gap: 30px;
}

.module-score-item {
    text-align: center;
}

.module-score-label {
    color: var(--text-muted);
    font-size: 0.8em;
}

.module-score-value {
    font-weight: 700;
}

.module-status {
    min-width: 100px;
    text-align: right;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .module-detail-card {
        padding: 15px;
    }

    .module-detail-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .module-detail-info {
        gap: 12px;
        width: 100%;
    }

    .module-detail-number {
        width: 35px;
        height: 35px;
        font-size: 0.9em;
    }

    .module-detail-title {
        font-size: 0.95em;
    }

    .module-detail-attempts {
        font-size: 0.8em;
    }

    .module-detail-scores {
        width: 100%;
        justify-content: space-between;
        gap: 15px;
        padding-top: 10px;
        border-top: 1px solid rgba(60, 47, 90, 0.5);
        margin-top: 5px;
    }

    .module-score-item {
        flex: 1;
    }

    .module-status {
        min-width: auto;
        flex: 1;
        text-align: center;
    }
}

/* Class Dashboard Styles */
.class-stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.class-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.class-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    flex-shrink: 0;
}

.class-stat-icon.purple { background: rgba(139, 92, 246, 0.2); }
.class-stat-icon.green { background: rgba(16, 185, 129, 0.2); }
.class-stat-icon.orange { background: rgba(245, 158, 11, 0.2); }
.class-stat-icon.pink { background: rgba(236, 72, 153, 0.2); }

.class-stat-value {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--text-primary);
}

.class-stat-label {
    font-size: 0.75em;
    color: var(--text-muted);
}

/* Chart wrapper for fixed Y-axis */
.chart-wrapper {
    display: flex;
    align-items: stretch;
}

.chart-y-axis {
    display: none;
    flex-shrink: 0;
    width: 45px;
}

.chart-y-axis canvas {
    width: 45px !important;
    height: 350px !important;
}

/* Chart scroll container */
.chart-scroll-container {
    flex: 1;
    overflow-x: hidden;
    overflow-y: hidden;
    padding-bottom: 10px;
}

/* Enable scroll only on mobile */
@media (max-width: 768px) {
    .chart-scroll-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

.chart-inner {
    min-width: 100%;
    height: 350px;
}

.scroll-hint {
    display: none;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85em;
    margin-top: 10px;
    animation: pulse 2s infinite;
}

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

@media (max-width: 768px) {
    .class-stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .class-stat-card {
        padding: 12px;
        gap: 8px;
    }

    .class-stat-icon {
        width: 35px;
        height: 35px;
        font-size: 1em;
    }

    .class-stat-value {
        font-size: 1.2em;
    }

    .class-stat-label {
        font-size: 0.7em;
    }

    .chart-inner {
        height: 350px;
    }
}

@media (max-width: 480px) {
    .class-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .class-stat-card {
        padding: 10px;
        gap: 8px;
        flex-direction: column;
        text-align: center;
    }

    .class-stat-icon {
        width: 32px;
        height: 32px;
        font-size: 0.9em;
    }

    .class-stat-value {
        font-size: 1.1em;
    }

    .class-stat-label {
        font-size: 0.65em;
    }

    .chart-inner {
        height: 300px;
    }

    .scroll-hint {
        font-size: 0.75em;
    }
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* ==================== LOADING & SKELETON STYLES ==================== */

/* Page Loading Overlay */
.page-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
    z-index: 9999;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.page-loading.fade-out {
    opacity: 0;
    visibility: hidden;
}

.page-loading .spinner-large {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.page-loading .loading-text {
    color: var(--text-secondary);
    font-size: 0.95em;
}

/* Skeleton Animation */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Skeleton Base */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(60, 47, 90, 0.3) 25%,
        rgba(139, 92, 246, 0.1) 50%,
        rgba(60, 47, 90, 0.3) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 8px;
}

/* Skeleton Text Lines */
.skeleton-text {
    height: 16px;
    margin-bottom: 10px;
    border-radius: 4px;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-text.medium {
    width: 80%;
}

.skeleton-text.long {
    width: 100%;
}

/* Skeleton Title */
.skeleton-title {
    height: 28px;
    width: 50%;
    margin-bottom: 15px;
    border-radius: 6px;
}

/* Skeleton Card */
.skeleton-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 20px;
}

/* Skeleton Module Card */
.skeleton-module-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 30px;
}

.skeleton-module-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.skeleton-module-number {
    width: 50px;
    height: 50px;
    border-radius: 12px;
}

.skeleton-module-title {
    height: 24px;
    width: 70%;
    border-radius: 6px;
}

.skeleton-progress-bar {
    height: 8px;
    width: 100%;
    border-radius: 8px;
    margin-top: 15px;
}

/* Skeleton Stat Card */
.skeleton-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
}

.skeleton-stat-value {
    height: 40px;
    width: 60%;
    margin: 0 auto 10px;
    border-radius: 6px;
}

.skeleton-stat-label {
    height: 14px;
    width: 80%;
    margin: 0 auto;
    border-radius: 4px;
}

/* Skeleton Question */
.skeleton-question {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 30px;
}

.skeleton-question-number {
    height: 14px;
    width: 100px;
    margin-bottom: 15px;
    border-radius: 4px;
}

.skeleton-question-text {
    height: 24px;
    width: 90%;
    margin-bottom: 25px;
    border-radius: 6px;
}

.skeleton-option {
    height: 54px;
    width: 100%;
    margin-bottom: 12px;
    border-radius: 12px;
}

/* Skeleton Table */
.skeleton-table {
    width: 100%;
}

.skeleton-table-row {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.skeleton-table-cell {
    height: 20px;
    border-radius: 4px;
}

.skeleton-table-cell.small {
    width: 80px;
}

.skeleton-table-cell.medium {
    width: 150px;
}

.skeleton-table-cell.large {
    flex: 1;
}

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

.content-loaded {
    animation: fadeIn 0.4s ease forwards;
}

/* Staggered Animation for Grid Items */
.module-grid .module-card {
    opacity: 0;
    animation: fadeIn 0.4s ease forwards;
}

.module-grid .module-card:nth-child(1) { animation-delay: 0.05s; }
.module-grid .module-card:nth-child(2) { animation-delay: 0.1s; }
.module-grid .module-card:nth-child(3) { animation-delay: 0.15s; }
.module-grid .module-card:nth-child(4) { animation-delay: 0.2s; }
.module-grid .module-card:nth-child(5) { animation-delay: 0.25s; }
.module-grid .module-card:nth-child(6) { animation-delay: 0.3s; }

.stats-grid .stat-card {
    opacity: 0;
    animation: fadeIn 0.4s ease forwards;
}

.stats-grid .stat-card:nth-child(1) { animation-delay: 0.05s; }
.stats-grid .stat-card:nth-child(2) { animation-delay: 0.1s; }
.stats-grid .stat-card:nth-child(3) { animation-delay: 0.15s; }
.stats-grid .stat-card:nth-child(4) { animation-delay: 0.2s; }

/* Loading Spinner Inline */
.loading-inline {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
}

.loading-inline .spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Button Loading State */
.btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-top: -10px;
    margin-left: -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Content Container with Loading */
.content-container {
    position: relative;
    min-height: 200px;
}

.content-container.is-loading .content-actual {
    display: none;
}

.content-container.is-loading .content-skeleton {
    display: block;
}

.content-container .content-skeleton {
    display: none;
}

/* Smooth Transition for Content */
.smooth-appear {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.smooth-appear.visible {
    opacity: 1;
}
