.module-page {
    padding: 110px 0 60px;
}

.module-page .container {
    max-width: 800px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 24px;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--accent);
}

.module-header-v2 {
    border-radius: 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: 3px solid var(--module-color, var(--accent));
    overflow: hidden;
    margin-bottom: 32px;
}

.module-header-v2-top {
    padding: 32px 32px 24px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.module-header-v2-info {
    flex: 1;
}

.module-header-v2 h1 {
    margin: 0 0 8px;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
}

.module-progress-ring {
    width: 80px;
    height: 80px;
    position: relative;
    flex-shrink: 0;
    margin-left: 24px;
}

.module-progress-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.module-progress-ring .ring-bg {
    fill: none;
    stroke: rgba(255,255,255,0.06);
    stroke-width: 6;
}

[data-theme="light"] .module-progress-ring .ring-bg {
    stroke: rgba(0,0,0,0.06);
}

.module-progress-ring .ring-fill {
    fill: none;
    stroke: var(--module-color, #10b981);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 263.9;
    stroke-dashoffset: 263.9;
    transition: stroke-dashoffset 0.8s ease;
}

.ring-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.ring-icon {
    display: none;
}

.ring-percent {
    font-size: 0.85rem;
    color: var(--text);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.module-header-v2-bar {
    padding: 0 32px;
}

.module-progress-track {
    height: 3px;
    background: rgba(255,255,255,0.04);
    border-radius: 2px;
    overflow: hidden;
}

[data-theme="light"] .module-progress-track {
    background: rgba(0,0,0,0.06);
}

.module-progress-fill {
    width: 0%;
    height: 100%;
    background: var(--module-color, #10b981);
    border-radius: 2px;
    transition: width 0.8s ease;
}

.module-header-v2-bottom {
    padding: 18px 32px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.module-continue-btn {
    padding: 8px 20px !important;
    border-radius: 10px !important;
    font-size: 0.85rem !important;
}

.module-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.module-difficulty,
.badge-free,
.badge-premium,
.badge-category {
    padding: 4px 12px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.module-difficulty.beginner {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
}

.module-difficulty.intermediate {
    background: rgba(234, 179, 8, 0.12);
    color: #eab308;
}

.badge-free {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent);
}

.badge-premium {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent);
}

.module-difficulty svg,
.badge-free svg,
.badge-premium svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.module-description {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.module-stats {
    display: flex;
    gap: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
    align-items: center;
    flex-wrap: wrap;
}

.module-actions-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 32px;
    text-align: center;
}

.module-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 500;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.module-status.completed {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
}

.module-status.available {
    background: var(--accent-soft);
    color: var(--accent);
}

.status-icon {
    display: inline-flex;
    align-items: center;
}

.status-icon svg {
    width: 18px;
    height: 18px;
}

.module-section-header {
    margin: 28px 0 14px;
}

.module-section-header h2 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-secondary);
}

.timeline {
    position: relative;
    padding-left: 0;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.timeline-track {
    display: none;
}

.timeline-progress {
    display: none;
}

.timeline-item {
    position: relative;
    text-decoration: none;
    color: inherit;
    display: block;
}

.timeline-node {
    display: none;
}

.timeline-content {
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.timeline-content.completed {
    background: var(--bg-card);
    border: 1px solid rgba(16, 185, 129, 0.12);
    border-left: 3px solid var(--module-color, #10b981);
}

.timeline-content.current {
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-left: 3px solid var(--accent);
}

.timeline-content.locked {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid rgba(255, 255, 255, 0.04);
    opacity: 0.45;
}

.timeline-item:hover .timeline-content.completed,
.timeline-item:hover .timeline-content.current {
    border-color: var(--accent);
    border-left-color: var(--accent);
}

.timeline-icon {
    display: none;
}

.lesson-num {
    min-width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.timeline-content.completed .lesson-num {
    background: rgba(16, 185, 129, 0.12);
    color: var(--module-color, #10b981);
}

.timeline-content.current .lesson-num {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent);
}

.timeline-content.locked .lesson-num {
    background: rgba(255, 255, 255, 0.04);
    color: #6b7280;
}

.timeline-info {
    flex: 1;
    min-width: 0;
}

.timeline-title {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 2px;
}

.timeline-content.locked .timeline-title {
    color: #6b7280;
}

.timeline-desc {
    font-size: 0.78rem;
    color: #6b7280;
}

.timeline-badge {
    flex-shrink: 0;
    font-size: 0.78rem;
    padding: 4px 12px;
    border-radius: 8px;
    font-weight: 500;
}

.timeline-badge.completed {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
}

.timeline-badge.current {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    padding: 5px 14px;
}

.timeline-badge.locked {
    color: #4b5563;
    padding: 0;
    display: flex;
    align-items: center;
}

.timeline-badge.locked svg {
    width: 16px;
    height: 16px;
    opacity: 0.4;
}

.timeline-progress-bar {
    padding: 10px 16px;
    background: rgba(99, 102, 241, 0.06);
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 32px;
}

.timeline-progress-track {
    width: 120px;
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    overflow: hidden;
}

.timeline-progress-fill {
    width: 0%;
    height: 100%;
    background: var(--module-color, #10b981);
    border-radius: 2px;
    transition: width 0.5s ease;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

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

.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 32px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg);
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
}

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

.modal-content h2 {
    margin: 0 0 20px;
    font-size: 1.2rem;
    font-weight: 600;
}

.learn-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.learn-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.learn-list li:last-child {
    border-bottom: none;
}

.module-auth-wall {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 40px 20px;
}

.module-auth-wall h2 {
    font-size: 1.5rem;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.module-auth-wall h2 svg {
    width: 24px;
    height: 24px;
    opacity: 0.5;
    flex-shrink: 0;
}

.module-auth-wall p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    max-width: 400px;
}

[data-theme="light"] .timeline-content.locked {
    border-left-color: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .lesson-num {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .timeline-progress-track {
    background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .modal {
    background: rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
    .module-header-v2-top {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 24px 20px 18px;
    }

    .module-progress-ring {
        margin-left: 0;
        margin-top: 14px;
    }

    .module-header-v2-bar {
        padding: 0 20px;
    }

    .module-header-v2-bottom {
        flex-direction: column;
        gap: 14px;
        padding: 14px 20px 20px;
    }

    .module-header-v2 h1 {
        font-size: 1.35rem;
    }

    .module-badges {
        justify-content: center;
    }

    .module-stats {
        justify-content: center;
    }

    .timeline-content {
        flex-wrap: wrap;
    }

    .timeline-badge {
        width: 100%;
        text-align: center;
    }
}
