/* ==========================================
   GLOBAL STYLES & RESET
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette - Refined Medical Theme */
    --primary-color: #991b1b;
    --primary-dark: #7f1d1d;
    --primary-light: #b91c1c;
    --secondary-color: #4a7c59;
    --secondary-dark: #3d6b4a;
    --secondary-light: #5a9367;
    --accent-green: #16a34a;
    --accent-green-light: #22c55e;
    --accent-red: #991b1b;
    --error-color: #dc2626;
    --error-light: #fca5a5;
    --success-color: #16a34a;
    --warning-color: #ea580c;

    /* Brand Colors */
    --study-green: #5a9367;
    --physio-red: #991b1b;

    /* Neutral Colors */
    --bg-primary: #fafafa;
    --bg-secondary: rgba(255, 255, 255, 0.8);
    --bg-tertiary: rgba(249, 250, 251, 0.7);
    --text-primary: #1a1a1a;
    --text-secondary: #4b5563;
    --text-light: #6b7280;
    --border-color: rgba(148, 163, 184, 0.15);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.15);

    /* Spacing */
    --header-height: 70px;
    --sidebar-width: 300px;

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 25%, #fafafa 50%, #f8f8f8 75%, #fafafa 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(185, 28, 28, 0.015) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(185, 28, 28, 0.01) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.hidden {
    display: none !important;
}

/* ==========================================
   HEADER
   ========================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: linear-gradient(to right, #7f1d1d 0%, #991b1b 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 1.5rem;
    max-width: 100%;
}

.menu-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: var(--transition-fast);
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.site-title {
    color: white;
    font-size: 1.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.site-title i {
    font-size: 1.8rem;
}

.title-study {
    color: #ffffff;
    font-weight: 700;
}

.title-physio {
    color: #ffffff;
    font-weight: 700;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-indicator {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    font-weight: 600;
}

.progress-indicator i {
    color: var(--warning-color);
}

/* ==========================================
   SIDEBAR
   ========================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: var(--header-height);
    bottom: 0;
    width: var(--sidebar-width);
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
    border-right: 1px solid rgba(255, 255, 255, 0.6);
    overflow-y: auto;
    transition: transform var(--transition-normal);
    z-index: 999;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-tertiary);
}

.sidebar-header h2 {
    font-size: 1.25rem;
    color: var(--text-primary);
}

.close-sidebar {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    transition: var(--transition-fast);
}

.close-sidebar:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.sidebar-nav {
    padding: 1rem 0;
}

.unit-section {
    margin-bottom: 0.5rem;
}

.unit-header {
    width: 100%;
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.unit-header:hover {
    background: var(--bg-tertiary);
}

.unit-header i {
    transition: transform var(--transition-normal);
    color: var(--primary-color);
}

.unit-header.collapsed i {
    transform: rotate(-90deg);
}

.unit-content {
    max-height: 500px;
    overflow: hidden;
    transition: max-height var(--transition-normal);
}

.unit-content.collapsed {
    max-height: 0;
}

.nav-item {
    display: block;
    padding: 0.875rem 1.5rem 0.875rem 3rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition-fast);
    border-left: 3px solid transparent;
    font-size: 0.95rem;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(185, 28, 28, 0.08) 0%, transparent 100%);
    color: var(--primary-color);
    font-weight: 600;
    border-left-color: var(--primary-color);
}

/* ==========================================
   MAIN CONTENT
   ========================================== */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 2rem;
    min-height: calc(100vh - var(--header-height));
    transition: margin-left var(--transition-normal);
    position: relative;
    z-index: 1;
}

/* ==========================================
   HOME SECTION
   ========================================== */
.home-section {
    max-width: 1200px;
    margin: 0 auto;
}

.welcome-card {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.6);
    text-align: center;
    position: relative;
}

@keyframes rotateGradient {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.welcome-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.welcome-title .title-study {
    color: var(--study-green);
}

.welcome-title .title-physio {
    color: var(--physio-red);
}

.welcome-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.welcome-description {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto 3rem;
    line-height: 1.8;
    position: relative;
    z-index: 1;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.feature-card {
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    padding: 1.25rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: all var(--transition-normal);
    position: relative;
    box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.08);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 32px 0 rgba(0, 0, 0, 0.12);
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
}

.feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    position: relative;
    z-index: 1;
}

.feature-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    position: relative;
    z-index: 1;
}

.cta-button {
    background: linear-gradient(to right, #7f1d1d 0%, #991b1b 100%);
    color: white;
    border: none;
    padding: 1rem 3rem;
    font-size: 1.125rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all var(--transition-normal);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    background: linear-gradient(to right, #991b1b 0%, #b91c1c 100%);
}

/* ==========================================
   CHECKUP SETUP SECTION
   ========================================== */
.checkup-setup-section {
    max-width: 1000px;
    margin: 0 auto;
}

.setup-card {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.6);
    position: relative;
}

.setup-header {
    text-align: center;
    margin-bottom: 2rem;
}

.setup-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.setup-info {
    text-align: center;
    margin-bottom: 2rem;
}

.setup-info p {
    font-size: 1.125rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.setup-info .highlight {
    color: var(--primary-color);
    font-weight: 700;
}

.info-instruction {
    color: var(--text-secondary) !important;
    font-size: 1rem !important;
}

.topics-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.topic-pill {
    background: var(--primary-color);
    color: white;
    padding: 0.625rem 1.5rem;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

.topic-pill:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.topic-pill.unselected {
    background: #9ca3af;
    opacity: 0.7;
}

.topic-pill.unselected:hover {
    background: #6b7280;
}

.setup-divider {
    height: 2px;
    background: rgba(0, 0, 0, 0.1);
    margin: 2rem 0;
}

.questions-per-topic-section {
    text-align: center;
    margin-bottom: 2.5rem;
}

.section-prompt {
    font-size: 1.125rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.number-selector {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.number-btn {
    width: 60px;
    height: 60px;
    background: #6b7280;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.number-btn:hover {
    background: #4b5563;
    transform: scale(1.05);
}

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

.btn-start-exam {
    width: auto;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 3rem;
    font-size: 1.125rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: block;
    margin: 0 auto;
    box-shadow: 0 12px 28px rgba(153, 27, 27, 0.35);
}

.btn-start-exam:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(127, 29, 29, 0.35);
}

.btn-start-exam:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================
   QUESTION SECTION
   ========================================== */
.question-section {
    max-width: 900px;
    margin: 0 auto;
}

.section-header {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    padding: 1.5rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.section-header h2 {
    font-size: 1.75rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.progress-bar-container {
    position: relative;
    background: var(--bg-tertiary);
    height: 12px;
    border-radius: 20px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(to right, #7f1d1d 0%, #991b1b 100%);
    border-radius: 20px;
    transition: width var(--transition-slow);
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 1rem;
    transform: none;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.9);
    padding: 0.25rem 0.75rem;
    border-radius: 8px;
    z-index: 10;
}

.question-card {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.6);
    margin-bottom: 1.5rem;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.question-number {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.question-type-badge {
    background: linear-gradient(to right, #7f1d1d 0%, #991b1b 100%);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.question-content {
    margin-bottom: 1.5rem;
}

.question-text {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    line-height: 1.8;
    font-weight: 500;
}

/* Options */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.option {
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 2px solid rgba(255, 255, 255, 0.5);
    padding: 1.25rem;
    border-radius: 16px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.05rem;
}

.option:hover {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    transform: translateX(5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.option.selected {
    border-color: var(--primary-color);
    background: rgba(185, 28, 28, 0.05);
    box-shadow: 0 4px 16px rgba(185, 28, 28, 0.1);
}

.option.correct {
    border-color: var(--accent-green);
    background: rgba(22, 163, 74, 0.1);
}

.option.incorrect {
    border-color: var(--error-color);
    background: rgba(220, 38, 38, 0.1);
}

.option.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.option-label {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.option.correct .option-label {
    background: var(--accent-green);
}

.option.incorrect .option-label {
    background: var(--error-color);
}

/* Fill in the Blank */
.fill-blank-container,
.short-answer-container,
.matching-container {
    margin-top: 1rem;
}

.fill-blank-input,
.short-answer-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1.05rem;
    font-family: inherit;
    transition: var(--transition-fast);
    background: var(--bg-tertiary);
}

.fill-blank-input:focus,
.short-answer-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
}

.short-answer-input {
    resize: vertical;
    min-height: 120px;
}

/* Matching Questions */
.matching-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.matching-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.matching-column-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.matching-item {
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 2px solid rgba(255, 255, 255, 0.5);
    padding: 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    min-height: 60px;
}

.matching-item:hover {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    transform: translateX(3px);
}

.matching-item.selected {
    border-color: var(--primary-color);
    background: rgba(153, 27, 27, 0.08);
    box-shadow: 0 4px 16px rgba(153, 27, 27, 0.15);
}

.matching-item.matched-correct {
    border-color: var(--accent-green);
    background: rgba(22, 163, 74, 0.1);
    pointer-events: none;
}

.matching-item.matched-incorrect {
    border-color: var(--error-color);
    background: rgba(220, 38, 38, 0.1);
    pointer-events: none;
}

.matching-item-label {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.matching-item.matched-correct .matching-item-label {
    background: var(--accent-green);
}

.matching-item.matched-incorrect .matching-item-label {
    background: var(--error-color);
}

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

/* Feedback */
.feedback-container {
    margin-top: 1.5rem;
    padding: 1.5rem;
    border-radius: 12px;
    animation: slideDown var(--transition-normal);
}

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

.feedback-container.correct {
    background: rgba(16, 185, 129, 0.1);
    border: 2px solid var(--accent-green);
}

.feedback-container.incorrect {
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid var(--error-color);
}

.feedback-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

.feedback-container.correct .feedback-message {
    color: var(--accent-green);
}

.feedback-container.incorrect .feedback-message {
    color: var(--error-color);
}

.feedback-message i {
    font-size: 1.5rem;
}

.exam-summary {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
}

.topic-breakdown {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(249, 250, 251, 0.7);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.topic-breakdown ul {
    list-style: none;
    margin: 0.75rem 0 0 0;
    padding: 0;
}

.topic-breakdown li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topic-breakdown li:last-child {
    border-bottom: none;
}

.user-answer {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.unanswered-text {
    color: var(--error-color);
    font-style: italic;
    font-weight: 600;
}

.explanation {
    color: var(--text-primary);
    line-height: 1.8;
    font-size: 1.05rem;
}

.explanation strong {
    color: var(--primary-color);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-top: 1.5rem;
}

.btn {
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-fast);
    flex: 1;
    justify-content: center;
}

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

.btn-primary {
    background: linear-gradient(to right, #7f1d1d 0%, #991b1b 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    background: linear-gradient(to right, #991b1b 0%, #b91c1c 100%);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border-color);
}

/* Question Navigation - Pagination Style */
.question-navigation {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border-radius: 16px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

.question-navigation.hidden {
    display: none;
}

.nav-numbers {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.nav-number-btn {
    min-width: 50px;
    height: 50px;
    padding: 0 0.75rem;
    border-radius: 8px;
    border: 2px solid #cbd5e1;
    background: white;
    color: #64748b;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-number-btn:hover:not(.current):not(.ellipsis):not(:disabled) {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(153, 27, 27, 0.2);
}

.nav-number-btn.answered {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.nav-number-btn.current {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(153, 27, 27, 0.3),
                0 0 20px rgba(153, 27, 27, 0.4),
                0 4px 12px rgba(0, 0, 0, 0.15);
    transform: scale(1.15);
    animation: pulse-glow 2s ease-in-out infinite;
    position: relative;
    z-index: 10;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(153, 27, 27, 0.3),
                    0 0 20px rgba(153, 27, 27, 0.4),
                    0 4px 12px rgba(0, 0, 0, 0.15);
    }
    50% {
        box-shadow: 0 0 0 5px rgba(153, 27, 27, 0.4),
                    0 0 30px rgba(153, 27, 27, 0.6),
                    0 6px 16px rgba(0, 0, 0, 0.2);
    }
}

.nav-number-btn.unanswered {
    background: white;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.nav-number-btn.ellipsis {
    border: none;
    background: transparent;
    cursor: default;
    color: #64748b;
    min-width: 40px;
}

.nav-number-btn.ellipsis:hover {
    transform: none;
    box-shadow: none;
}

.nav-prev-next {
    min-width: 120px;
    padding: 0 1.5rem;
    font-size: 1rem;
}

.nav-prev-next.nav-prev {
    background: white;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.nav-prev-next.nav-prev:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.nav-prev-next.nav-next {
    background: linear-gradient(to right, #7f1d1d 0%, #991b1b 100%);
    color: white;
    border-color: var(--primary-color);
}

.nav-prev-next.nav-next:hover:not(:disabled) {
    background: linear-gradient(to right, #991b1b 0%, #b91c1c 100%);
    box-shadow: 0 8px 24px rgba(153, 27, 27, 0.3);
}

.nav-prev-next:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.nav-prev-next.nav-prev:disabled {
    background: white;
    border-color: #cbd5e1;
    color: #94a3b8;
}

.nav-prev-next.nav-next:disabled {
    background: #9ca3af;
    border-color: #9ca3af;
}

.nav-prev-next:disabled:hover {
    transform: none;
    box-shadow: none;
}

.btn-submit-final {
    background: linear-gradient(to right, #7f1d1d 0%, #991b1b 100%);
    color: white;
    border: none;
    padding: 1rem 3rem;
    font-size: 1.125rem;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.btn-submit-final:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    background: linear-gradient(to right, #991b1b 0%, #b91c1c 100%);
}

.btn-submit-final:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: linear-gradient(to right, #9ca3af 0%, #6b7280 100%);
}

.btn-submit-final.hidden {
    display: none;
}

/* Review Screen */
.review-screen {
    max-width: 1200px;
    margin: 0 auto;
}

.review-header {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-radius: 20px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.6);
    text-align: center;
}

.review-score {
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.review-score-details {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.review-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.review-topic-badge {
    padding: 0.625rem 1.25rem;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    border: 2px solid;
}

.review-topic-badge.mastered {
    background: rgba(22, 163, 74, 0.1);
    border-color: #16a34a;
    color: #15803d;
}

.review-topic-badge.good {
    background: rgba(234, 179, 8, 0.1);
    border-color: #eab308;
    color: #a16207;
}

.review-topic-badge.needs-work {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #dc2626;
}

.review-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.review-all-questions {
    margin-bottom: 2rem;
}

.review-question-card {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.6);
    position: relative;
}

.review-question-card.correct {
    border-left: 5px solid #16a34a;
}

.review-question-card.incorrect {
    border-left: 5px solid #ef4444;
}

.review-question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.review-question-number {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.review-result-badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.review-result-badge.correct {
    background: rgba(22, 163, 74, 0.1);
    color: #16a34a;
}

.review-result-badge.incorrect {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.review-question-text {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    line-height: 1.8;
    font-weight: 500;
}

.review-answer-section {
    margin-bottom: 1rem;
}

.review-answer-label {
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.review-answer-label.your-answer {
    color: var(--text-primary);
}

.review-answer-label.correct-answer {
    color: #16a34a;
}

.review-answer-content {
    padding: 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.5);
    font-size: 1.05rem;
}

.review-answer-content.correct {
    background: rgba(22, 163, 74, 0.08);
    border: 2px solid rgba(22, 163, 74, 0.3);
}

.review-answer-content.incorrect {
    background: rgba(239, 68, 68, 0.08);
    border: 2px solid rgba(239, 68, 68, 0.3);
}

.review-explanation {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: rgba(249, 250, 251, 0.7);
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
}

.review-explanation-label {
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.review-explanation-text {
    color: var(--text-primary);
    line-height: 1.8;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
    z-index: 998;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .close-sidebar {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 280px;
    }

    .site-title {
        font-size: 1.35rem;
    }

    .site-title i {
        font-size: 1.4rem;
    }

    .progress-indicator span {
        display: none;
    }

    .main-content {
        padding: 1rem;
    }

    .welcome-card {
        padding: 2rem 1.5rem;
    }

    .welcome-title {
        font-size: 2rem;
    }

    .welcome-subtitle {
        font-size: 1.25rem;
    }

    .feature-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .question-card {
        padding: 1.5rem;
    }

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

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    /* Navigation buttons - keep Prev/Next on same line, Submit below */
    .nav-numbers {
        flex-wrap: wrap;
    }

    .nav-number-btn {
        min-width: 45px;
        height: 45px;
        font-size: 1rem;
    }

    .nav-prev-next {
        min-width: 100px;
        padding: 0 1rem;
        font-size: 0.95rem;
    }

    /* Force submit button to new line but keep prev/next together */
    .btn-submit-final {
        width: 100%;
        order: 999;
        flex-basis: 100%;
    }
}

@media (max-width: 480px) {
    .header-content {
        padding: 0 1rem;
    }

    .welcome-title {
        font-size: 1.75rem;
    }

    .welcome-subtitle {
        font-size: 1.1rem;
    }

    .question-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    /* Hide question number buttons on very small screens - only show prev/next */
    .nav-number-btn:not(.nav-prev-next) {
        display: none;
    }
}

/* ==========================================
   SCROLLBAR STYLING
   ========================================== */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* ==========================================
   FOOTER
   ========================================== */
.site-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    padding: 1.5rem 0;
    text-align: center;
    width: 100%;
    margin-top: auto;
}

.site-footer p {
    margin: 0;
    color: #999;
    font-size: 0.9rem;
}

.site-footer a {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

/* Ensure body uses flexbox for footer to stick to bottom */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
}
