/* ===== Стили интерактивного учебника ===== */

/* Body */
.learning-page {
    background: var(--bg-dark);
}

/* Header */
.learning-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.learning-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

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

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

.user-name {
    font-size: 14px;
    color: var(--text-primary);
}

.btn-logout-mini {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--bg-dark-lighter);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-logout-mini:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Container */
.learning-container {
    display: flex;
    height: calc(100vh - 109px); /* Высота viewport минус header минус footer */
}

/* Sidebar */
.learning-sidebar {
    width: 280px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.sidebar-content {
    padding: 12px;
}

/* Unit в sidebar */
.sidebar-unit {
    margin-bottom: 8px;
}

.sidebar-unit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-dark-lighter);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

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

.sidebar-unit-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-unit-badge {
    font-size: 12px;
    color: var(--text-muted);
}

/* Список уроков в sidebar */
.sidebar-lessons {
    margin-top: 8px;
    padding-left: 8px;
}

.sidebar-lesson {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.sidebar-lesson:hover {
    background: var(--bg-dark-lighter);
}

.sidebar-lesson.active {
    background: var(--primary);
    color: white;
}

.sidebar-lesson.completed {
    position: relative;
}

.sidebar-lesson.completed::after {
    content: '✓';
    position: absolute;
    right: 12px;
    color: var(--primary);
    font-size: 12px;
}

.sidebar-lesson.active.completed::after {
    color: white;
}

.sidebar-lesson-title {
    font-size: 13px;
    color: inherit;
}

/* Main content */
.learning-main {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-dark);
}

/* Lesson header */
.lesson-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 24px 0;
    position: sticky;
    top: 0;
    z-index: 50;
}

.lesson-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 16px 0;
}

.lesson-progress {
    display: flex;
    align-items: center;
    gap: 16px;
}

.progress-bar-small {
    flex: 1;
    height: 6px;
    background: var(--bg-dark-lighter);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill-small {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 60px;
    text-align: right;
}

/* Lesson content */
.lesson-content {
    padding: 32px 0;
}

/* Section */
.lesson-section {
    margin-bottom: 48px;
}

.section-header {
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.section-type {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* Exercise */
.exercise {
    margin-bottom: 32px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

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

.exercise-id {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.exercise-instruction {
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.6;
}

/* Questions */
.question {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.question:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.question-number {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 12px;
}

.question-text {
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 16px;
}

/* Answer options */
.answer-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.answer-option {
    padding: 12px 16px;
    background: var(--bg-dark-lighter);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.answer-option:hover {
    border-color: var(--primary);
}

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

.answer-option.correct {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.answer-option.incorrect {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Text input */
.answer-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-dark);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.answer-input:focus {
    outline: none;
    border-color: var(--primary);
}

.answer-input.correct {
    border-color: #10b981;
}

.answer-input.incorrect {
    border-color: #ef4444;
}

/* Feedback */
.answer-feedback {
    margin-top: 8px;
    font-size: 14px;
}

.answer-feedback.success {
    color: #10b981;
}

.answer-feedback.error {
    color: #ef4444;
}

.correct-answer {
    padding: 8px 12px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: #10b981;
    margin-top: 8px;
}

/* Button */
.btn-check {
    padding: 10px 20px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-check:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-glow);
}

/* Lesson navigation */
.lesson-nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 32px 0;
}

.btn-nav {
    flex: 1;
    padding: 14px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-nav:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

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

/* Footer */
.learning-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    bottom: 0;
    z-index: 100;
}

.footer-progress {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-progress-label {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.footer-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-dark-lighter);
    border-radius: 2px;
    overflow: hidden;
}

.footer-progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.footer-progress-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    min-width: 40px;
    text-align: right;
}

/* Media players */
.audio-player,
.video-player {
    margin: 16px 0;
    width: 100%;
}

.audio-player audio,
.video-player video {
    width: 100%;
}

/* Utility */
.text-muted {
    color: var(--text-muted);
}

/* Адаптивность */
@media (max-width: 768px) {
    .learning-container {
        flex-direction: column;
        height: auto;
    }

    .learning-sidebar {
        width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .learning-main {
        height: auto;
    }

    .lesson-nav {
        flex-direction: column;
    }

    .footer-progress {
        flex-wrap: wrap;
    }
}
