* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f7fafc;
    color: #1a202c;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Боковое меню */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background-color: #3182ce;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar-logo {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 14px 24px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.nav-item.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border-left-color: #ffffff;
    font-weight: 600;
}

.nav-icon {
    width: 24px;
    height: 24px;
    margin-right: 12px;
    flex-shrink: 0;
}

.nav-text {
    font-size: 15px;
}

/* Оверлей для мобильных */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Основной контент */
.main-content {
    margin-left: 280px;
    min-height: 100vh;
}

.top-header {
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.menu-toggle {
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.menu-toggle:hover {
    background-color: #f7fafc;
}

.menu-toggle svg {
    width: 24px;
    height: 24px;
    color: #4a5568;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: #1a202c;
}

.content {
    padding: 24px;
}

.content.hidden {
    display: none;
}

.hidden {
    display: none !important;
}

/* Сетка карточек */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}

/* Карточка теста */
.test-card {
    background: #ffffff;
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}

.test-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(49, 130, 206, 0.18);
    border-color: #3182ce;
}

/* Баннер с фото из «Вида» */
.test-card-banner {
    height: 200px;
    background-size: cover;
    background-position: center;
    background-color: #ebf4ff;
    background-image: linear-gradient(135deg, #3182ce, #2c5aa0);
    display: flex;
    align-items: center;
    justify-content: center;
}

.test-card-banner .banner-placeholder {
    width: 64px;
    height: 64px;
    color: rgba(255, 255, 255, 0.85);
}

.test-card-body {
    padding: 18px 20px 20px;
}

.test-card-title {
    font-size: 19px;
    font-weight: 700;
    color: #1a202c;
    line-height: 1.3;
}

.test-card-sub {
    margin-top: 6px;
    font-size: 13px;
    color: #718096;
}

/* Рейтинг (звёзды + отзывы) */
.test-card-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.test-card-stars {
    color: #f6ad55;
    font-size: 17px;
    letter-spacing: 2px;
    line-height: 1;
}

.test-card-reviews {
    font-size: 13px;
    color: #a0aec0;
}

/* Пустое состояние */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #a0aec0;
    font-size: 16px;
    background: #ffffff;
    border-radius: 12px;
    border: 2px dashed #e2e8f0;
}

/* Адаптивность */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-280px);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: flex;
    }

    .content {
        padding: 16px;
    }

    .cards-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .test-card-banner {
        height: 170px;
    }

    .course-top-header {
        padding: 16px;
    }

    .course-hero-title {
        font-size: 18px;
    }

    .course-hero-icon {
        width: 38px;
        height: 38px;
    }

    .test-view-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .test-social-row {
        width: 100%;
    }

    .accordion-paragraph {
        padding-left: 20px;
    }
}

@media (min-width: 769px) {
    .sidebar-overlay {
        display: none;
    }
}

/* Ссылка на главную в сайдбаре */
.sidebar-logo-link {
    text-decoration: none;
    color: inherit;
}

.header-breadcrumb {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Шапка страницы курса */
.course-top-header {
    align-items: flex-start;
    padding: 20px 24px;
}

.course-hero {
    flex: 1;
    min-width: 0;
}

.course-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.breadcrumb-link {
    font-size: 14px;
    color: #718096;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}

.breadcrumb-link:hover {
    color: #3182ce;
}

.breadcrumb-sep {
    color: #cbd5e0;
    font-size: 16px;
    line-height: 1;
}

.course-hero-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3182ce, #2c5aa0);
    background-size: cover;
    background-position: center;
    overflow: hidden;
}

.course-hero-icon.has-photo {
    background-color: #ebf4ff;
}

.course-hero-icon svg {
    width: 22px;
    height: 22px;
    color: rgba(255, 255, 255, 0.9);
}

.course-hero-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a202c;
    line-height: 1.3;
    margin: 0;
}

.course-hero-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-left: 2px;
}

.course-hero-stars {
    color: #f6ad55;
    font-size: 16px;
    letter-spacing: 2px;
    line-height: 1;
}

.course-hero-reviews {
    font-size: 13px;
    color: #a0aec0;
}

.back-link {
    font-size: 13px;
    color: #3182ce;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

.section-heading {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
    color: #1a202c;
}

/* Аккордеон программы курса */
.accordion {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.accordion-item {
    border-bottom: 1px solid #edf2f7;
}

.accordion-item:last-child {
    border-bottom: none;
}

.accordion-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: #ffffff;
    border: none;
    cursor: pointer;
    text-align: left;
    font-size: 15px;
    font-weight: 600;
    color: #2d3748;
    transition: background 0.15s;
}

.accordion-header:hover {
    background: #f7fafc;
}

.accordion-header.open .accordion-chevron {
    transform: rotate(90deg);
}

.accordion-level-1 > .accordion-header {
    font-size: 16px;
    background: #f8fafc;
    padding: 16px 18px;
}

.accordion-level-1 > .accordion-header.open {
    background: #f0f4f8;
}

.accordion-level-2 > .accordion-header {
    padding-left: 28px;
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
}

.accordion-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.accordion-icon svg {
    width: 18px;
    height: 18px;
}

.accordion-icon-class {
    background: #ebf4ff;
    color: #3182ce;
}

.accordion-icon-course {
    background: #faf5ff;
    color: #805ad5;
}

.accordion-title {
    flex: 1;
    min-width: 0;
}

.accordion-chevron {
    width: 20px;
    height: 20px;
    color: #a0aec0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.accordion-chevron svg {
    width: 16px;
    height: 16px;
}

.accordion-body {
    display: none;
    padding: 4px 0 10px;
    background: #fafbfc;
}

.accordion-body.open {
    display: block;
}

.accordion-level-1 > .accordion-body {
    background: #ffffff;
}

.accordion-nested {
    padding: 0;
}

.accordion-paragraph {
    padding: 4px 14px 4px 42px;
}

.paragraph-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
    padding: 11px 14px;
    border: 1px solid transparent;
    background: #ffffff;
    border-radius: 10px;
    font-size: 14px;
    color: #2d3748;
    cursor: pointer;
    transition: all 0.15s;
}

.paragraph-item:hover:not(.disabled) {
    border-color: #e2e8f0;
    background: #f7fafc;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.paragraph-item.disabled {
    opacity: 0.55;
    cursor: default;
}

.paragraph-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #edf2f7;
    color: #718096;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.paragraph-icon svg {
    width: 16px;
    height: 16px;
}

.paragraph-item:hover:not(.disabled) .paragraph-icon {
    background: #e6fffa;
    color: #319795;
}

.paragraph-name {
    flex: 1;
    min-width: 0;
    font-weight: 500;
    line-height: 1.4;
}

.paragraph-arrow {
    width: 18px;
    height: 18px;
    color: #cbd5e0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    transition: color 0.15s, transform 0.15s;
}

.paragraph-arrow svg {
    width: 14px;
    height: 14px;
}

.paragraph-item:hover:not(.disabled) .paragraph-arrow {
    color: #718096;
    transform: translateX(2px);
}

/* Просмотр теста */
.back-to-program {
    margin-bottom: 20px;
    padding: 8px 14px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    border-radius: 8px;
    font-size: 14px;
    color: #3182ce;
    cursor: pointer;
}

.back-to-program:hover {
    background: #f7fafc;
}

.test-view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.test-view-title {
    font-size: 24px;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
    line-height: 1.3;
}

.test-view-video {
    position: relative;
    width: 100%;
    max-width: 800px;
    aspect-ratio: 16 / 9;
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

.intro-content-wrap {
    margin-top: 8px;
    margin-bottom: 24px;
    max-width: 900px;
}

.intro-content-panel {
    font-size: 15px;
    line-height: 1.7;
    color: #2d3748;
    padding-top: 4px;
}

.intro-content-panel img {
    max-width: 100%;
    height: auto;
}

.test-view-video iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.test-view-audio-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.audio-icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    cursor: pointer;
    font-size: 14px;
    color: #4a5568;
    transition: all 0.15s;
}

.audio-icon-btn svg {
    width: 22px;
    height: 22px;
    color: #3182ce;
}

.audio-icon-btn:hover {
    border-color: #3182ce;
    background: #ebf4ff;
}

.test-view-audio-player {
    margin-bottom: 28px;
    max-width: 480px;
}

.test-view-audio-player audio {
    width: 100%;
}

/* Вопросы теста */
.test-questions {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.question-block {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px 24px;
}

.question-num {
    font-size: 13px;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.question-desc,
.question-ai {
    font-size: 15px;
    line-height: 1.6;
    color: #2d3748;
    margin-bottom: 16px;
}

.question-desc img,
.question-ai img {
    max-width: 100%;
    height: auto;
}

.question-answers {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.answer-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s;
}

.answer-option:hover {
    border-color: #3182ce;
    background: #f7fafc;
}

.answer-option input {
    margin-top: 3px;
    flex-shrink: 0;
}

.comparison-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 12px;
    padding: 12px;
    background: #f7fafc;
    border-radius: 8px;
}

.comparison-left {
    font-weight: 600;
    min-width: 120px;
}

.comparison-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.empty-questions,
.error-text {
    color: #a0aec0;
    font-size: 15px;
}

.error-text {
    color: #e53e3e;
}

/* Материалы перед тестом */
.test-materials-actions {
    margin-top: 28px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
}

.test-social-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    flex-shrink: 0;
}

.btn-motivation {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    border-radius: 10px;
    border: 1px solid #f6ad55;
    background: #fffaf0;
    color: #c05621;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-motivation:hover {
    background: #feebc8;
    border-color: #ed8936;
}

/* Модальное окно «Мотивация» */
.motivation-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.motivation-modal.hidden {
    display: none !important;
}

.motivation-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
}

.motivation-modal-dialog {
    position: relative;
    width: 100%;
    max-width: 860px;
    background: #ffffff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.motivation-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
}

.motivation-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a202c;
    margin: 0;
}

.motivation-modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: #f7fafc;
    border-radius: 8px;
    font-size: 24px;
    line-height: 1;
    color: #718096;
    cursor: pointer;
    transition: background 0.15s;
}

.motivation-modal-close:hover {
    background: #edf2f7;
    color: #1a202c;
}

.motivation-modal-body {
    padding: 0;
}

.motivation-modal-video {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}

.motivation-modal-video iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.btn-start-test {
    padding: 14px 32px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #3182ce, #2c5aa0);
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 14px rgba(49, 130, 206, 0.35);
}

.btn-start-test:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(49, 130, 206, 0.45);
}

.btn-start-test.hidden {
    display: none;
}

/* Прохождение теста */
.test-runner {
    max-width: 900px;
}

.question-cells {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.question-cell {
    min-width: 44px;
    height: 44px;
    padding: 0 12px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    font-size: 15px;
    font-weight: 600;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.15s;
}

.question-cell:hover {
    border-color: #3182ce;
    color: #3182ce;
}

.question-cell.active {
    border-color: #3182ce;
    background: #3182ce;
    color: #ffffff;
}

.question-cell.answered:not(.active) {
    border-color: #68d391;
    background: #f0fff4;
    color: #276749;
}

.content-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 20px;
}

.content-tab {
    padding: 12px 20px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: #718096;
    cursor: pointer;
    position: relative;
    transition: color 0.15s;
}

.content-tab:hover {
    color: #3182ce;
}

.content-tab.active {
    color: #3182ce;
}

.content-tab.active::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 2px;
    background: #3182ce;
}

.content-tab.hidden {
    display: none;
}

.question-content-panel {
    min-height: 80px;
    font-size: 15px;
    line-height: 1.7;
    color: #2d3748;
    margin-bottom: 8px;
}

.question-content-panel img {
    max-width: 100%;
    height: auto;
}

.test-divider {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 24px 0;
}

.question-answers-panel {
    margin-bottom: 32px;
}

.test-finish-wrap {
    display: flex;
    justify-content: flex-end;
    padding-top: 8px;
}

.btn-finish-test {
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    background: #38a169;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
}

.btn-finish-test:hover {
    background: #2f855a;
    transform: translateY(-1px);
}

/* Кнопка выхода в сайдбаре */
.nav-logout {
    width: 100%;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    font-family: inherit;
    font-size: inherit;
    text-align: left;
    margin-top: auto;
    appearance: none;
    -webkit-appearance: none;
}

.nav-logout:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* Личный кабинет */
.profile-card {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 24px;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3182ce, #2c5aa0);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    flex-shrink: 0;
}

.profile-name {
    font-size: 22px;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 6px;
}

.profile-phone {
    font-size: 15px;
    color: #4a5568;
    margin-bottom: 4px;
}

.profile-meta {
    font-size: 13px;
    color: #a0aec0;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #3182ce;
}

.stat-label {
    font-size: 13px;
    color: #718096;
    margin-top: 6px;
}

.history-table-wrap {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th,
.history-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #edf2f7;
    font-size: 14px;
}

.history-table th {
    background: #f7fafc;
    font-weight: 600;
    color: #4a5568;
}

.history-table tr:last-child td {
    border-bottom: none;
}

.result-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    background: #ebf4ff;
    color: #2c5282;
    font-weight: 600;
    font-size: 13px;
}
