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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    overflow-x: hidden;
}

/* Навигационная кнопка: компактная синяя плашка + меньше белая иконка, выше для ровня с «Список модулей» */
.nav-toggle {
    position: fixed;
    top: max(0px, env(safe-area-inset-top, 0px));
    left: max(12px, env(safe-area-inset-left, 0px));
    z-index: 1002 !important;
    background: #4a90e2;
    color: white;
    border: none;
    padding: 3px 5px;
    border-radius: 6px;
    cursor: pointer !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.12);
    transition: background 0.2s ease, transform 0.15s ease;
    width: auto;
    min-width: 38px;
    min-height: 34px;
    font-size: 13px;
    font-weight: 500;
    pointer-events: auto !important;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.nav-toggle:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

/* Кастомная иконка — пропорционально уменьшена вместе с синей кнопкой */
.nav-toggle .nav-toggle-icon {
    display: block;
    flex-shrink: 0;
    width: clamp(18px, 4.2vw, 22px);
    height: clamp(18px, 4.2vw, 22px);
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 2px;
    background-color: transparent;
    background-image: url('../images/sidebar-menu-icon.png?v=jy20260422');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: contain;
    box-sizing: border-box;
}

/* Старые три полосы гамбургера — скрываем, если разметка ещё не обновлена */
.nav-toggle > span:not(.nav-toggle-icon):not(.nav-text) {
    display: none !important;
}

.nav-toggle .nav-text {
    margin-left: 0;
    font-size: 14px;
    white-space: nowrap;
}

.nav-toggle:hover {
    background: #357abd;
}

.nav-toggle:active {
    transform: scale(0.97);
}

/* Боковое меню */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 300px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    transition: left 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar.hidden {
    left: -300px;
}

.main-content.full-width {
    margin-left: 0 !important;
    width: 100% !important;
}

.sidebar-header {
    /* компактна кнопка ~38px + left 12px + зазор */
    padding: 6px 26px 12px 76px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.sidebar-header:hover {
    background: #e8f0fe;
}

.sidebar-header h2,
.sidebar-header__title {
    font-size: 18px;
    color: #4a90e2;
    font-weight: 600;
    margin: 0;
    width: 100%;
    max-width: 100%;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    padding-right: 14px;
    box-sizing: border-box;
}

.sidebar-header-admin {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    width: 100%;
}

/* Иначе display:flex выше перебивает стандартное скрытие по атрибуту hidden — карандаш был виден всем */
.sidebar-header-admin[hidden],
#sidebarEditActions[hidden],
#adminSidebarPlaylistBox[hidden] {
    display: none !important;
}

.sidebar-edit-toggle {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #4a90e2;
    border-radius: 6px;
    background: #fff;
    color: #4a90e2;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(40deg);
}

.sidebar-edit-toggle:hover {
    background: #e8f2fc;
}

.sidebar-edit-toggle__icon {
    display: block;
}

.sidebar-edit-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.sidebar-edit-btn {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

.sidebar-edit-btn--save {
    background: #4a90e2;
    color: #fff;
}

.sidebar-edit-btn--save:hover {
    background: #3d7bc9;
}

.sidebar-nav {
    padding: 10px 0 10px 0;
    margin-top: 0;
}

.sidebar-nav ul {
    list-style: none;
}

/* Заголовок уровня */
.course-level-header {
    padding: 15px 20px;
    background: #4a90e2;
    color: white;
    font-weight: bold;
    font-size: 14px;
    text-transform: uppercase;
    margin-top: 10px;
    border-radius: 4px 4px 0 0;
    cursor: default;
}

.course-level-header:first-child {
    margin-top: 0;
}

.course-item {
    padding: 0;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
    display: flex;
    flex-direction: column;
}

.course-item:hover {
    background: #f8f9fa;
}

.course-item.active {
    background: #e3f2fd;
    border-left: 4px solid #4a90e2;
}

.course-item.active .course-item-text {
    color: #1976d2;
    font-weight: 600;
}

.course-item.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.course-item-header {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    cursor: pointer;
}

.course-item-text {
    flex: 1;
    min-width: 0;
    color: #333;
}

.course-expand-icon {
    font-size: 12px;
    color: #666;
    margin-left: 10px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.course-item.expanded .course-expand-icon {
    transform: rotate(180deg);
}

.course-description {
    padding: 10px 20px 15px 20px;
    background: #f8f9fa;
    color: #555;
    font-size: 13px;
    line-height: 1.5;
    border-top: 1px solid #e0e0e0;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 1000px;
    }
}

/* Блок с деталями курса в центре - плоский стиль */
.course-details {
    background: white;
    border-radius: 0;
    border: 1px solid #e0e0e0;
    padding: 30px;
    margin: 30px 0;
    box-shadow: none;
}

.course-details-header h2 {
    font-size: 24px;
    color: #333;
    margin-bottom: 20px;
    font-weight: 600;
    text-transform: none; /* Нормальная капитализация */
    letter-spacing: normal;
}

.course-details-description {
    font-size: 15px;
    line-height: 1.7;
    color: #444;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 0;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #4a90e2;
    text-transform: none; /* Нормальная капитализация */
    font-weight: 400;
    box-shadow: none;
}

.course-details-description p {
    margin: 0;
    text-transform: none; /* Нормальная капитализация */
}

.course-details-description strong {
    font-weight: 600;
    color: #333;
    text-transform: none; /* Нормальная капитализация */
}

.course-details-video {
    margin-top: 20px;
}

.course-details-video iframe {
    width: 100%;
    max-width: 800px;
    height: 450px;
    border-radius: 8px;
    border: none;
}

/* Список уроков внутри course-details */
.course-details .lessons-list {
    margin-top: 30px;
}

/* Список уроков для курса "Джйотиш экспресс" под установкой программы */
.lessons-list-express {
    max-width: 900px;
    margin: 30px auto;
    padding: 0 20px;
}

.lessons-list-express h3 {
    margin-bottom: 20px;
    color: #4a90e2;
    font-size: 20px;
    font-weight: 600;
}

/* Кликабельные элементы уроков в списке */
.lesson-item-clickable {
    background: white;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #4a90e2;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.lesson-item-clickable:hover {
    background: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateX(5px);
}

/* Кликабельные элементы уроков в списке */
.lesson-item-clickable {
    background: white;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #4a90e2;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.lesson-item-clickable:hover {
    background: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateX(5px);
}

.lesson-item-clickable.locked {
    border-left-color: #ccc;
    cursor: pointer !important;
    position: relative;
}

.lesson-item-clickable.locked .lesson-title,
.lesson-item-clickable.locked .lesson-desc {
    color: #999;
    opacity: 0.75;
}

/* Эффект при наведении на заблокированный урок */
.lesson-item-clickable.locked:hover {
    border: 3px solid #4caf50 !important;
    border-left: 6px solid #4caf50 !important;
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.3) !important;
    transform: translateX(5px) !important;
    background: #f1f8f4 !important;
    transition: all 0.3s ease;
}

.lesson-item-clickable.locked:hover .lesson-title,
.lesson-item-clickable.locked:hover .lesson-desc {
    color: #333 !important;
    opacity: 1 !important;
}

.lesson-item-clickable.locked:hover .buy-label {
    display: block !important;
    animation: pulse-buy 1s ease-in-out infinite;
}

.lesson-item-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lesson-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.lesson-item-clickable .lesson-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0;
    text-transform: none;
    flex: 1;
}

.lesson-item-clickable .lesson-desc {
    font-size: 14px;
    color: #666;
    margin: 0;
    line-height: 1.5;
}

.lesson-item-clickable .lesson-status {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 0;
    display: inline-block;
    width: fit-content;
}

.lesson-item-clickable .lesson-status.free {
    background: #e8f5e9;
    color: #2e7d32;
}

.lesson-item-clickable .lock-icon {
    font-size: 16px;
    flex-shrink: 0;
}

/* Стили для урока экспресс-курса со спойлерами */
.lesson-item-express {
    background: white;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #4a90e2;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.lesson-item-express.locked {
    border-left-color: #ccc;
    position: relative;
    cursor: pointer;
}

.lesson-item-express.locked .lesson-title,
.lesson-item-express.locked .lesson-desc {
    color: #999;
    opacity: 0.75;
}

/* Эффект при наведении на заблокированный урок */
.lesson-item-express.locked:hover {
    border: 3px solid #4caf50 !important;
    border-left: 6px solid #4caf50 !important;
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.3) !important;
    transform: translateX(5px);
    background: #f1f8f4 !important;
    transition: all 0.3s ease;
}

.lesson-item-express.locked:hover .lesson-title,
.lesson-item-express.locked:hover .lesson-desc {
    color: #333 !important;
    opacity: 1 !important;
}

/* Надпись "КУПИТЬ" при наведении */
.buy-label {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #4caf50;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 16px;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
    white-space: nowrap;
    pointer-events: none;
}

.lesson-item-express.locked:hover .buy-label {
    display: block;
    animation: pulse-buy 1s ease-in-out infinite;
}

@keyframes pulse-buy {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.05);
        box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6);
    }
}

.lesson-actions {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

.lesson-actions .btn-watch-lesson,
.lesson-actions .btn-spoiler-toggle {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.btn-watch-lesson,
.btn-spoiler-toggle {
    padding: 10px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    width: fit-content;
}

.btn-watch-lesson {
    background: #4a90e2;
    color: white;
}

.btn-watch-lesson:hover {
    background: #357abd;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.btn-spoiler-toggle {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

.btn-spoiler-toggle:hover {
    background: #e0e0e0;
}

.lesson-spoiler {
    margin-top: 10px;
    padding: 12px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.spoiler-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.material-link {
    display: inline-block;
    padding: 8px 12px;
    background: white;
    color: #4a90e2;
    text-decoration: none;
    border: 1px solid #4a90e2;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.material-link:hover {
    background: #4a90e2;
    color: white;
}

/* Основной контент */
.main-content {
    margin-left: 300px;
    transition: margin-left 0.3s ease;
    min-height: 100vh;
    padding: 20px;
    padding-top: 80px;
}

.main-content.full-width {
    margin-left: 0 !important;
    width: 100% !important;
}

.sidebar.active ~ .main-content {
    margin-left: 300px;
}

/* Шапка */
.header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    background: white;
    padding: 15px 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 999;
    display: flex;
    justify-content: flex-end;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.btn-auth {
    padding: 8px 16px;
    border: 1px solid #4a90e2;
    background: white;
    color: #4a90e2;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-auth:hover {
    background: #4a90e2;
    color: white;
}

/* Стиль для кнопки "УРОК ОНЛАЙН" */
.btn-auth[href="lesson-online.html"],
a.btn-auth[href*="lesson-online"] {
    background: #28a745 !important;
    color: white !important;
    border-color: #28a745;
}

.btn-auth[href="lesson-online.html"]:hover,
a.btn-auth[href*="lesson-online"]:hover {
    background: #218838 !important;
    color: white !important;
    border-color: #218838;
}

/* Страница курсов */
.courses-page {
    max-width: 1200px;
    margin: 0 auto;
}

.courses-page h1 {
    font-size: 32px;
    margin-bottom: 30px;
    color: #333;
    text-align: center;
}

/* Обертка для кликабельного блока */
.trial-lesson-central-clickable {
    display: block;
    text-decoration: none;
    color: inherit;
    max-width: 900px;
    margin: 40px auto;
    cursor: pointer;
    transition: opacity 0.2s;
}

.trial-lesson-central-clickable:hover {
    opacity: 0.95;
}

/* Центральный блок Пробный урок - плоский стиль */
.trial-lesson-central {
    max-width: 100%;
    margin: 0;
    background: #e8f5e9;
    border-radius: 0;
    padding: 40px;
    text-align: center;
    box-shadow: none;
    border: 1px solid #4caf50;
    position: relative;
    transition: background-color 0.2s;
}

.trial-lesson-central-clickable:hover .trial-lesson-central {
    background: #d4edda;
}

.trial-lesson-central::before {
    display: none;
}

.trial-lesson-central h2 {
    font-size: 32px;
    color: #1b5e20;
    margin-bottom: 20px;
    font-weight: 600;
    position: relative;
    text-shadow: none;
}

.trial-description {
    font-size: 16px;
    color: #2e7d32;
    margin-bottom: 25px;
    line-height: 1.6;
    position: relative;
    font-weight: 400;
}

/* Превью видео для пробного урока */
.trial-video-preview {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 20px auto;
    cursor: pointer;
    border: 2px solid #4caf50;
}

.preview-thumbnail {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.2s;
    aspect-ratio: 16/9;
    object-fit: cover;
}

.trial-lesson-central-clickable:hover .preview-thumbnail {
    opacity: 0.9;
}

.play-button-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: rgba(76, 175, 80, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
    pointer-events: none;
    transition: all 0.2s;
    border: 3px solid white;
}

.trial-lesson-central-clickable:hover .play-button-overlay {
    background: rgba(69, 160, 73, 0.95);
    transform: translate(-50%, -50%) scale(1.1);
}

/* Превью видео для модуля */
.module-video-preview {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 20px auto;
}

.video-preview-link {
    position: relative;
    display: block;
    cursor: pointer;
    border: 2px solid #4a90e2;
}

.module-preview-thumbnail {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.2s;
}

.video-preview-link:hover .module-preview-thumbnail {
    opacity: 0.9;
}

.video-preview-link .play-button-overlay {
    background: rgba(74, 144, 226, 0.9);
    border-color: white;
}

.video-preview-link:hover .play-button-overlay {
    background: rgba(74, 144, 226, 0.95);
    transform: translate(-50%, -50%) scale(1.1);
}

.video-preview-hint {
    text-align: center;
    margin-top: 10px;
    font-size: 14px;
    color: #666;
}

.next-lesson-hint {
    margin-top: 20px;
    font-size: 14px;
    color: #1b5e20;
    font-weight: 500;
    opacity: 1;
    position: relative;
    padding: 10px 15px;
    background: white;
    border-radius: 0;
    border: 1px solid #4caf50;
    display: inline-block;
}

.lesson-item .next-lesson-hint {
    margin-top: 12px;
    font-size: 15px;
    color: #2e7d32;
    font-weight: 600;
    opacity: 1;
    padding: 8px 15px;
    background: #e8f5e9;
    border-radius: 0;
    border-left: 3px solid #4caf50;
}

.lesson-item.free .next-lesson-hint {
    color: #1b5e20;
    background: #e8f5e9;
}

.trial-link-btn {
    display: inline-block;
    padding: 16px 40px;
    background: #4caf50;
    color: white;
    text-decoration: none;
    border-radius: 0;
    font-weight: 600;
    font-size: 16px;
    transition: background-color 0.2s;
    box-shadow: none;
    border: 1px solid #45a049;
    position: relative;
    letter-spacing: 0.3px;
}

.trial-link-btn:hover {
    background: #45a049;
    transform: none;
    box-shadow: none;
}

/* Указатель прокрутки вниз */
.scroll-down-indicator {
    display: block;
    text-align: center;
    margin: 40px auto;
    padding: 16px 40px;
    background: transparent;
    border: 2px solid #4caf50;
    border-radius: 0;
    width: fit-content;
    cursor: pointer;
    transition: all 0.3s ease;
}

.scroll-down-indicator:hover {
    background: rgba(76, 175, 80, 0.1);
    border-color: #388e3c;
}

.scroll-down-text {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 24px;
    font-weight: 400;
    font-style: normal;
    color: #2e7d32;
    margin-bottom: 8px;
    text-transform: none;
    letter-spacing: 1px;
}

.scroll-down-arrows {
    font-size: 20px;
    color: #4caf50;
    letter-spacing: 8px;
    line-height: 1;
    font-weight: 400;
    /* Без анимации - статично, зеленые стрелки вниз */
}

@media (max-width: 768px) {
    .trial-lesson-central {
        padding: 30px 20px;
        margin: 30px auto;
    }
    
    .trial-lesson-central h2 {
        font-size: 28px;
    }
    
    .trial-description {
        font-size: 16px;
    }
    
    .trial-link-btn {
        padding: 14px 30px;
        font-size: 16px;
    }
    
    .scroll-down-indicator {
        margin: 30px auto;
        padding: 14px 30px;
    }
    
    .scroll-down-text {
        font-size: 20px;
        margin-bottom: 6px;
    }
    
    .scroll-down-arrows {
        font-size: 18px;
        letter-spacing: 6px;
    }
    
    .trial-video-preview {
        width: 100%;
        max-width: 100%;
        margin: 20px auto;
    }
    
    .preview-thumbnail {
        width: 100%;
        height: auto;
        aspect-ratio: 16/9;
        object-fit: cover;
    }
}

.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

/* Список уроков под пробным уроком */
.lessons-list {
    max-width: 900px;
    margin: 40px auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.lesson-item {
    background: white;
    border-radius: 0;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-left: 4px solid #ddd;
    transition: all 0.2s;
}

.lesson-item.free {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f4 100%);
    border-left-color: #4caf50;
}

.lesson-item.locked {
    background: #f9f9f9;
    position: relative;
    cursor: pointer;
}

.lesson-item.locked .lesson-title,
.lesson-item.locked .lesson-desc {
    color: #999;
    opacity: 0.75;
}

/* Эффект при наведении на заблокированный урок (для lesson-item) */
.lesson-item.locked:hover {
    border: 3px solid #4caf50 !important;
    border-left: 6px solid #4caf50 !important;
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.3) !important;
    transform: translateX(5px) !important;
    background: #f1f8f4 !important;
    transition: all 0.3s ease;
}

.lesson-item.locked:hover .lesson-title,
.lesson-item.locked:hover .lesson-desc {
    color: #333 !important;
    opacity: 1 !important;
}

.lesson-item.locked:hover .buy-label {
    display: block !important;
    animation: pulse-buy 1s ease-in-out infinite;
}

.lesson-item.lesson1-highlight {
    border: 2px solid #ff9800;
    box-shadow: 0 4px 16px rgba(255, 152, 0, 0.3);
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0%, 100% {
        box-shadow: 0 4px 16px rgba(255, 152, 0, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(255, 152, 0, 0.5);
    }
}

.lesson-item:not(.locked):hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.lesson-item-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lesson-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.lesson-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
    flex: 1;
}

.lesson-item.free .lesson-title {
    color: #1b5e20;
}

.lock-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.lesson-desc {
    font-size: 14px;
    color: #666;
    margin: 0;
    line-height: 1.5;
}

.lesson-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 0;
    font-size: 12px;
    font-weight: 500;
    align-self: flex-start;
}

.lesson-status.free {
    background: #c8e6c9;
    color: #2e7d32;
}

.lesson-status.locked {
    background: #e0e0e0;
    color: #757575;
}

@media (max-width: 768px) {
    .lessons-list {
        margin: 30px 10px;
    }
    
    .lesson-item {
        padding: 15px;
    }
    
    .lesson-title {
        font-size: 16px;
    }
}

.course-card {
    background: white;
    border-radius: 0;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    position: relative;
}

.course-card:hover:not(.locked) {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.course-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.course-card.locked::after {
    content: '🔒';
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
}

.course-number {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.course-title,
.course-title-link {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
    display: block;
    text-decoration: none;
    transition: color 0.2s;
}

.course-title-link {
    cursor: pointer;
}

.course-title-link:hover {
    color: #4a90e2;
    text-decoration: underline;
}

.course-description {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
}

.course-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 0;
    font-size: 12px;
    font-weight: 500;
}

.course-status.free {
    background: #e8f5e9;
    color: #2e7d32;
}

.course-status.locked {
    background: #f5f5f5;
    color: #757575;
}

/* Видео блок (муляж) */
.video-placeholder {
    max-width: 800px;
    margin: 40px auto;
    background: #1a1a1a;
    border-radius: 0;
    overflow: hidden;
    position: relative;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.video-placeholder::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0.3;
}

.video-play-btn {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: transform 0.2s;
}

.video-play-btn:hover {
    transform: scale(1.1);
}

.video-play-btn::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 28px solid #333;
    border-top: 18px solid transparent;
    border-bottom: 18px solid transparent;
    margin-left: 6px;
}

.video-title {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
    z-index: 1;
    text-align: center;
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 0;
    max-width: 400px;
    width: 90%;
    position: relative;
    animation: slideDown 0.3s;
}

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

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #333;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #333;
}

/* Оплата урока: широкая модалка на десктопе */
.modal-content--lesson-payment {
    max-width: 900px;
    max-height: 90vh;
    min-height: 0;
    flex-shrink: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}

/* Десктоп: без align-items:center на оверлее — иначе flex-ребёнок не сжимается и нет прокрутки внутри панели */
@media (min-width: 769px) {
    #lessonPaymentModal.modal.active {
        align-items: flex-start;
        justify-content: center;
        padding: clamp(16px, 4vh, 48px) 16px;
        box-sizing: border-box;
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* Только большой экран: кнопка снова видна и прилипает к низу панели; на телефоне действует JS как раньше */
    #lessonPaymentModal #confirmLessonPaymentBtn {
        display: block !important;
        position: sticky;
        bottom: 0;
        z-index: 6;
        margin-top: 20px;
        box-shadow: 0 -12px 24px rgba(255, 255, 255, 0.98), 0 6px 18px rgba(27, 158, 88, 0.35);
        border-radius: 6px;
    }
}

/* Тарифы: три колонки на широком экране */
.tariff-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.tariff-options .tariff-option {
    min-width: 0;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #4a90e2;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #357abd;
}

/* «Я оплатил» — зелёный акцент как на portal.universl.top (отличается от «Перейти к оплате») */
#lessonPaymentModal #confirmLessonPaymentBtn {
    background: #1b9e58;
    color: #fff;
    font-weight: 600;
    border: none;
}

#lessonPaymentModal #confirmLessonPaymentBtn:hover {
    background: #158a4c;
}

#lessonPaymentModal #confirmLessonPaymentBtn:active {
    background: #127a43;
}

/* Подсказка после «Я оплатил» — своё окно, не системный alert (portal) */
.lesson-paid-hint-modal.modal {
    z-index: 2100;
    background-color: rgba(32, 40, 48, 0.45);
}

.lesson-paid-hint-dialog {
    max-width: 420px;
    width: 92%;
    padding: 28px 26px 22px;
    border-radius: 18px;
    background: linear-gradient(165deg, #fefdfb 0%, #f6f3ee 55%, #f0ebe3 100%);
    border: 1px solid rgba(180, 160, 130, 0.35);
    box-shadow:
        0 24px 48px rgba(28, 24, 20, 0.18),
        0 0 0 1px rgba(255, 255, 255, 0.6) inset;
    font-family: 'Nunito Sans', system-ui, sans-serif;
    text-align: center;
    box-sizing: border-box;
}

.lesson-paid-hint-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: #8a8075;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    border-radius: 10px;
    transition: background 0.2s, color 0.2s;
}

.lesson-paid-hint-close:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #4a433a;
}

.lesson-paid-hint-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: linear-gradient(145deg, #2db970, #1b9e58);
    color: #fff;
    font-size: 28px;
    line-height: 52px;
    font-family: 'Nunito Sans', system-ui, sans-serif;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(27, 158, 88, 0.35);
}

.lesson-paid-hint-title {
    margin: 0 0 12px;
    font-size: 1.45rem;
    font-weight: 700;
    color: #2c2824;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.lesson-paid-hint-title--solo {
    margin-bottom: 22px;
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.45;
    color: #4a433a;
}

.lesson-paid-hint-text {
    margin: 0 0 22px;
    font-size: 1.08rem;
    line-height: 1.55;
    color: #4a433a;
    font-weight: 500;
}

.lesson-paid-hint-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    font-family: 'Nunito Sans', system-ui, sans-serif;
}

.btn-hint-cancel {
    padding: 12px 20px;
    border-radius: 12px;
    border: 2px solid rgba(120, 110, 98, 0.35);
    background: rgba(255, 255, 255, 0.65);
    color: #4a433a;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.btn-hint-cancel:hover {
    background: #fff;
    border-color: rgba(120, 110, 98, 0.55);
}

.btn-hint-ok {
    padding: 12px 22px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(180deg, #24b065, #1b9e58);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(27, 158, 88, 0.35);
    transition: filter 0.2s, transform 0.15s;
}

.btn-hint-ok:hover {
    filter: brightness(1.05);
}

.btn-hint-ok:active {
    transform: scale(0.98);
}

@media (max-width: 480px) {
    .lesson-paid-hint-dialog {
        padding: 24px 18px 18px;
        border-radius: 16px;
    }

    .lesson-paid-hint-title {
        font-size: 1.3rem;
    }

    .lesson-paid-hint-text {
        font-size: 1rem;
    }

    .lesson-paid-hint-actions {
        flex-direction: column-reverse;
    }

    .btn-hint-cancel,
    .btn-hint-ok {
        width: 100%;
    }
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .sidebar {
        width: 280px;
        left: -280px;
        min-width: 280px;
    }
    
    .sidebar.active {
        left: 0;
        z-index: 1002;
    }
    
    .sidebar.active ~ .main-content {
        margin-left: 0;
    }
    
    .sidebar-header {
        padding: 6px 16px 12px 78px;
        text-align: left;
    }
    
    .sidebar-header h2,
    .sidebar-header__title {
        font-size: 16px;
        text-align: left;
    }
    
    .course-item {
        padding: 0;
        font-size: 14px;
        white-space: normal;
        word-wrap: break-word;
        display: flex;
        flex-direction: column;
    }
    
    .course-item-header {
        padding: 12px 15px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .course-item-text {
        flex: 1;
        min-width: 0;
        color: #333;
        overflow: visible;
    }
    
    .course-description {
        padding: 10px 15px 15px 15px;
        font-size: 12px;
    }
    
    .course-details {
        padding: 20px 15px;
        margin: 20px 0;
    }
    
    .course-details-header h2 {
        font-size: 22px;
    }
    
    .course-details-description {
        font-size: 14px;
        padding: 15px;
    }
    
    .course-details-video iframe {
        height: 250px;
    }
    
    .main-content {
        padding: 20px 10px;
        padding-top: 100px;
        margin-left: 0;
    }
    
    .courses-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-toggle {
        top: max(2px, env(safe-area-inset-top, 0px)) !important;
        left: 8px !important;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 1003 !important;
        width: 40px;
        min-width: 40px;
        height: 36px;
        min-height: 36px;
        font-size: 18px;
        padding: 4px;
        pointer-events: auto !important;
    }

    .nav-toggle .nav-toggle-icon {
        width: clamp(18px, 4.8vw, 22px);
        height: clamp(18px, 4.8vw, 22px);
    }
    
    .header {
        padding: 10px;
    }
    
    .header-actions {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .btn-auth {
        padding: 6px 12px;
        font-size: 12px;
    }

    /* Модалка оплаты: block + вертикальный скролл (flex на оверлее часто ломает листание на iOS/Android) */
    #lessonPaymentModal.modal.active {
        display: block;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding: 12px 8px 28px;
        box-sizing: border-box;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .modal-content--lesson-payment {
        width: calc(100vw - 16px);
        max-width: none;
        margin: 0 auto 8px;
        padding: 18px 14px 24px;
        max-height: none;
        overflow: visible;
    }

    /* Тарифы: горизонтальная карусель; чуть больше gap — карточки визуально не слипаются */
    .tariff-options {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        grid-template-columns: unset;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 20px;
        margin-bottom: 20px;
        padding: 2px 6px 14px;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        touch-action: pan-x pan-y;
        scrollbar-width: thin;
    }

    .tariff-options .tariff-option {
        flex: 0 0 min(88vw, 340px);
        width: min(88vw, 340px);
        max-width: min(88vw, 340px);
        scroll-snap-align: start;
        scroll-margin-inline: 6px;
        box-sizing: border-box;
    }

    #lessonPaymentModal .payment-methods-tabs {
        flex-wrap: wrap;
        gap: 8px;
    }

    #lessonPaymentModal .payment-tab {
        padding: 12px 16px !important;
        font-size: 14px !important;
    }
}

@media (max-width: 480px) {
    .courses-page h1 {
        font-size: 24px;
    }
    
    .sidebar {
        width: 100%;
        left: -100%;
    }
    
    .sidebar.active {
        left: 0;
        z-index: 1002;
    }
    
    .nav-toggle {
        top: max(1px, env(safe-area-inset-top, 0px)) !important;
        left: 8px !important;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 1003 !important;
        width: 38px;
        min-width: 38px;
        height: 34px;
        min-height: 34px;
        padding: 3px;
        pointer-events: auto !important;
    }

    .nav-toggle .nav-toggle-icon {
        width: clamp(17px, 5vw, 21px);
        height: clamp(17px, 5vw, 21px);
    }
}

/* Ссылки из описания YouTube внутри спойлера — колонка, без горизонтального «ряда» у кнопок */
.lesson-yt-extras-in-spoiler .yt-material-buttons {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
}

.lesson-yt-extras-in-spoiler a.btn-yt-extra {
    width: 100%;
    max-width: 100%;
    justify-content: center;
    box-sizing: border-box;
}

.yt-material-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

a.btn-yt-extra {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-sizing: border-box;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid #4a90e2;
    background: #f0f7ff;
    color: #4a90e2;
    max-width: 100%;
    line-height: 1.3;
}

a.btn-yt-extra:hover {
    background: #e3f0fc;
}

a.btn-yt-extra--file {
    border-color: #43a047;
    background: #f1f8f4;
    color: #2e7d32;
}

a.btn-yt-extra--file:hover {
    background: #e8f5e9;
}

/* Только модалки оплаты: тот же крем на телефоне и ПК */
.lesson-payment-success-modal.modal { z-index: 2200; }
.portal-app-dialog-modal.modal { z-index: 2300; }
.portal-app-dialog-actions--alert { justify-content: flex-end !important; }
.lesson-paid-hint-actions--single {
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.lesson-paid-hint-actions--single .btn-hint-ok { width: 100%; max-width: 300px; }
.lesson-paid-hint-dialog { position: relative; margin-left: auto; margin-right: auto; }

@media (max-width: 768px) {
    .lesson-paid-hint-modal.modal.active,
    .lesson-payment-success-modal.modal.active,
    .portal-app-dialog-modal.modal.active {
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: 20px 16px;
        box-sizing: border-box;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        background-color: rgba(32, 40, 48, 0.45) !important;
    }
    .lesson-paid-hint-modal .lesson-paid-hint-dialog,
    .lesson-payment-success-modal .lesson-paid-hint-dialog,
    .portal-app-dialog-modal .lesson-paid-hint-dialog {
        width: min(420px, calc(100vw - 32px));
        margin: auto;
    }
}
@media (max-width: 480px) {
    .lesson-paid-hint-actions--single { flex-direction: column !important; }
}

/* Админ: плейлист в левом сайдбаре */
.admin-sidebar-playlist-box {
    margin: 0 10px 14px;
    padding: 12px 12px 14px;
    background: #f0f7ff;
    border: 1px solid #c5daf5;
    border-radius: 8px;
    box-sizing: border-box;
}
.admin-sidebar-playlist-box__title {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 700;
    color: #4a90e2;
    text-transform: none;
}
.admin-sidebar-playlist-box__label {
    display: block;
    font-size: 11px;
    color: #555;
    margin-bottom: 4px;
    font-weight: 600;
}
.admin-sidebar-playlist-box__input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    margin-bottom: 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
}
.admin-sidebar-playlist-box__btn {
    width: 100%;
    margin-top: 4px;
    padding: 10px 14px;
    background: #4a90e2;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}
.admin-sidebar-playlist-box__btn:hover {
    background: #3d7bc9;
}

.admin-sidebar-playlist-box__msg {
    margin: 8px 0 0;
    font-size: 12px;
    line-height: 1.4;
    color: #c0392b;
    min-height: 0;
}
.admin-sidebar-playlist-box__msg:empty {
    display: none;
}

/* Режим правки меню: те же цвета, поля ввода и «ручки» перетаскивания */
.sidebar.sidebar--edit-mode #courseList > li.course-level-header {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.sidebar.sidebar--edit-mode .sb-grip {
    flex-shrink: 0;
    width: 14px;
    min-height: 22px;
    cursor: grab;
    color: rgba(255, 255, 255, 0.85);
    font-size: 10px;
    line-height: 1;
    letter-spacing: -2px;
    user-select: none;
    opacity: 0.9;
}

.sidebar.sidebar--edit-mode .sb-grip:active {
    cursor: grabbing;
}

.sidebar.sidebar--edit-mode .sb-header-edit {
    flex: 1;
    min-width: 0;
    padding: 4px 6px;
    border: none;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font: inherit;
    font-weight: bold;
    text-transform: uppercase;
    box-sizing: border-box;
}

.sidebar.sidebar--edit-mode .sb-yt-delete {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 4px;
    background: rgba(180, 40, 40, 0.85);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.sidebar.sidebar--edit-mode .course-item-header {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar.sidebar--edit-mode .sb-course-edit {
    flex: 1;
    min-width: 0;
    padding: 8px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font: inherit;
    color: #333;
    background: #fff;
    box-sizing: border-box;
    cursor: text;
}

.sidebar.sidebar--edit-mode li.course-item[data-sb-seg='course'] .sb-grip--course {
    cursor: grab;
}

/* Перетаскивание: исходные строки «остаются на месте» приглушёнными */
.sidebar.sidebar--edit-mode #courseList > li.sb-dnd-source {
    opacity: 0.38;
    transition: opacity 0.15s ease;
}

.sidebar.sidebar--edit-mode #courseList > li.course-item.sb-dnd-source {
    box-shadow: inset 0 0 0 2px rgba(74, 144, 226, 0.35);
}

/* Линия места вставки */
.sidebar.sidebar--edit-mode #courseList > li.sb-dnd-drop-marker {
    list-style: none;
    height: 5px;
    margin: 2px 8px;
    padding: 0;
    border-radius: 3px;
    background: linear-gradient(90deg, #4a90e2, #1976d2);
    box-shadow: 0 0 10px rgba(74, 144, 226, 0.55);
    pointer-events: none;
}

.sidebar.sidebar--edit-mode #courseList > li.sb-dnd-drop-marker--seg {
    height: 6px;
    margin: 4px 6px;
}

/* «Плавающая» карточка под курсором (превью drag) */
.sb-dnd-floating-card {
    background: #fff;
    border-radius: 8px;
    box-shadow:
        0 14px 44px rgba(0, 0, 0, 0.22),
        0 6px 16px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transform: rotate(-0.5deg);
}

.sb-dnd-floating-card--single {
    transform: rotate(-0.3deg);
}

.sb-dnd-floating-card__head {
    background: #4a90e2;
    color: #fff;
    padding: 11px 14px;
    font-weight: bold;
    font-size: 13px;
    line-height: 1.25;
    text-transform: uppercase;
}

.sb-dnd-floating-card__row,
.sb-dnd-floating-card__course {
    padding: 11px 14px;
    font-size: 13px;
    line-height: 1.35;
    color: #333;
    background: #fafcff;
}

.sb-dnd-floating-card__meta {
    padding: 8px 14px;
    font-size: 11px;
    color: #789;
    background: #f5f7fa;
}
