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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f8f9fa;
    color: #1a1a1a;
    line-height: 1.6;
}

/* Header */
.header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.logo-icon {
    font-size: 1.75rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.language-switcher {
    display: flex;
    gap: 0.5rem;
    background: #f3f4f6;
    padding: 0.25rem;
    border-radius: 8px;
}

.lang-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: #6b7280;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.lang-btn.active {
    background: #3b82f6;
    color: white;
}

.back-to-course {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: #3b82f6;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
}

.back-to-course:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Stats Overview */
.stats-overview h1 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #111827;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* Module Progress */
.module-progress {
    margin-bottom: 3rem;
}

.module-progress h2,
.lessons-details h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #111827;
}

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

.module-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.module-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

.module-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.module-badge.free {
    background: #d1fae5;
    color: #065f46;
}

.module-badge.premium {
    background: #fef3c7;
    color: #92400e;
}

.module-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
}

.module-stat {
    display: flex;
    flex-direction: column;
}

.module-stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #3b82f6;
}

.module-stat-label {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.module-progress-bar {
    background: #e5e7eb;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.module-progress-fill {
    background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%);
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Section Header with Filters */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h2 {
    margin-bottom: 0;
}

/* Module Lessons Container */
.module-lessons {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Nested Lesson Card */
.lesson-card-nested {
    background: #f9fafb;
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    border-left: 3px solid #3b82f6;
    margin-left: 1rem;
    transition: all 0.2s ease;
}

.lesson-card-nested:hover {
    background: #f3f4f6;
    transform: translateX(4px);
}

.lesson-card-nested.locked {
    border-left-color: #d1d5db;
    opacity: 0.7;
}

.lesson-name-nested {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #374151;
    margin: 0;
}

/* Lessons Details */
.lessons-filter {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.625rem 1.25rem;
    border: 1px solid #d1d5db;
    background: white;
    color: #6b7280;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.filter-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

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

.lesson-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    transition: all 0.2s;
}

.lesson-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.lesson-card.locked {
    opacity: 0.6;
}

.lesson-info {
    flex: 1;
}

.lesson-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.5rem;
}

.lesson-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.lesson-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.lesson-meta-item svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.lesson-score {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.score-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.125rem;
}

.score-circle.perfect {
    background: #d1fae5;
    color: #065f46;
}

.score-circle.good {
    background: #dbeafe;
    color: #1e40af;
}

.score-circle.needs-work {
    background: #fef3c7;
    color: #92400e;
}

.lesson-actions {
    display: flex;
    gap: 0.75rem;
}

.retake-btn,
.view-btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.retake-btn {
    background: #3b82f6;
    color: white;
}

.retake-btn:hover:not(:disabled) {
    background: #2563eb;
    transform: translateY(-1px);
}

.retake-btn:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
}

.view-btn {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.view-btn:hover {
    background: #e5e7eb;
}

.retake-timer {
    font-size: 0.75rem;
    color: #ef4444;
    margin-top: 0.25rem;
}

/* ==========================================
   RESPONSIVE - ENHANCED MOBILE DESIGN
   ========================================== */

/* Mobile-first: Comprehensive mobile adaptations */
@media (max-width: 768px) {
    /* Header - mobile optimization */
    .header-content {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .logo {
        font-size: 1rem;
    }

    .logo-icon {
        font-size: 1.5rem;
    }

    /* Header actions - stack and optimize */
    .header-actions {
        width: 100%;
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }

    /* Language switcher - touch-friendly */
    .language-switcher {
        width: 100%;
        justify-content: center;
        padding: 0.375rem;
    }

    .lang-btn {
        flex: 1;
        padding: 0.625rem 0.75rem;
        font-size: 0.875rem;
        min-height: 44px;
    }

    /* Back to course button - full width and touch-friendly */
    .back-to-course {
        width: 100%;
        justify-content: center;
        padding: 0.875rem 1.25rem;
        font-size: 0.9375rem;
        min-height: 44px;
    }

    /* Container - optimized padding */
    .container {
        padding: 1rem;
    }

    /* Stats overview - mobile typography */
    .stats-overview h1 {
        font-size: 1.625rem;
        margin-bottom: 1.5rem;
    }

    /* Stats cards - better mobile grid */
    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        margin-bottom: 2rem;
    }

    .stat-card {
        padding: 1.25rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

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

    .stat-value {
        font-size: 1.375rem;
        line-height: 1.2;
    }

    .stat-label {
        font-size: 0.8125rem;
    }

    /* Module progress - mobile optimization */
    .module-progress {
        margin-bottom: 2rem;
    }

    .module-progress h2,
    .lessons-details h2 {
        font-size: 1.25rem;
        margin-bottom: 1.25rem;
    }

    .module-card {
        padding: 1.25rem;
        border-radius: 0.75rem;
    }

    .module-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

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

    .module-badge {
        padding: 0.375rem 0.75rem;
        font-size: 0.6875rem;
    }

    .module-stats {
        gap: 1.5rem;
        margin-bottom: 1rem;
        flex-wrap: wrap;
    }

    .module-stat-value {
        font-size: 1.125rem;
    }

    .module-stat-label {
        font-size: 0.6875rem;
    }

    .module-progress-bar {
        height: 6px;
    }

    /* Section header - stack on mobile */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    /* Module lessons - reduce margin on mobile */
    .module-lessons {
        margin-top: 0.75rem;
        padding-top: 0.75rem;
    }

    /* Nested lesson card - reduce margin on mobile */
    .lesson-card-nested {
        margin-left: 0.5rem;
        padding: 0.875rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .lesson-name-nested {
        font-size: 0.875rem;
    }

    /* Lessons details - mobile optimization */
    .lessons-details {
        margin-bottom: 2rem;
    }

    /* Filter buttons - touch-friendly */
    .lessons-filter {
        gap: 0.5rem;
        margin-bottom: 1.25rem;
    }

    .filter-btn {
        padding: 0.75rem 1rem;
        font-size: 0.8125rem;
        min-height: 44px;
        flex: 1;
        min-width: 0;
    }

    /* Lesson cards - mobile layout */
    .lesson-card {
        padding: 1.25rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        border-radius: 0.75rem;
    }

    .lesson-info {
        width: 100%;
    }

    .lesson-name {
        font-size: 1rem;
        margin-bottom: 0.625rem;
    }

    .lesson-meta {
        gap: 1rem;
    }

    .lesson-meta-item {
        font-size: 0.8125rem;
    }

    .lesson-meta-item svg {
        width: 14px;
        height: 14px;
    }

    /* Lesson score - full width layout */
    .lesson-score {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .score-circle {
        width: 56px;
        height: 56px;
        font-size: 1rem;
    }

    /* Lesson actions - touch-friendly buttons */
    .lesson-actions {
        width: 100%;
        flex-direction: column;
        gap: 0.625rem;
    }

    .retake-btn,
    .view-btn {
        width: 100%;
        justify-content: center;
        padding: 0.875rem 1.25rem;
        font-size: 0.9375rem;
        min-height: 44px;
    }

    .retake-timer {
        font-size: 0.6875rem;
        text-align: center;
    }

    /* Footer - responsive */
    footer {
        padding: 1.5rem 0 !important;
        margin-top: 2.5rem !important;
    }

    footer > div {
        padding: 0 1rem !important;
    }

    footer a {
        font-size: 0.8125rem !important;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    footer p {
        font-size: 0.8125rem !important;
    }

    /* Ensure inputs don't zoom on iOS */
    input,
    button,
    select,
    textarea {
        font-size: 16px !important;
    }

    /* Improve tap targets */
    a,
    button {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Very small screens (< 375px) - older/smaller phones */
@media (max-width: 374px) {
    .stats-overview h1 {
        font-size: 1.375rem;
    }

    .stats-cards {
        grid-template-columns: 1fr;
        gap: 0.875rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-icon {
        font-size: 1.75rem;
    }

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

    .module-progress h2,
    .lessons-details h2 {
        font-size: 1.125rem;
    }

    .module-card {
        padding: 1rem;
    }

    .filter-btn {
        padding: 0.75rem 0.875rem;
        font-size: 0.75rem;
    }

    .lesson-card {
        padding: 1rem;
    }

    .lesson-name {
        font-size: 0.9375rem;
    }

    .score-circle {
        width: 52px;
        height: 52px;
        font-size: 0.9375rem;
    }
}

/* Tablet (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .container {
        padding: 1.5rem;
    }

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

    .header-actions {
        gap: 1rem;
    }
}

/* Landscape mobile phones */
@media (max-width: 896px) and (orientation: landscape) {
    .stats-overview h1 {
        font-size: 1.5rem;
        margin-bottom: 1.25rem;
    }

    .stats-cards {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-icon {
        font-size: 1.75rem;
    }

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

    .stat-label {
        font-size: 0.75rem;
    }

    .module-progress h2,
    .lessons-details h2 {
        font-size: 1.125rem;
        margin-bottom: 1rem;
    }
}

/* High-DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}
