/* --- GOOGLE FONTS --- */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@500;600;700;800&family=Roboto:wght@300;400;500&display=swap');

/* --- CSS VARIABLES & THEME --- */
:root {
    /* Colors */
    --primary-color: #0F172A;     /* Темно-синий */
    --primary-light: #1E293B;     /* Светлее */
    --accent-color: #F59E0B;      /* Янтарный */
    --accent-hover: #D97706;      
    --accent-gradient: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    
    --text-main: #334155;         
    --text-light: #64748B;
    --text-muted: #94a3b8;        
    
    --bg-body: #F1F5F9;           
    --bg-white: #FFFFFF;
    
    /* UI Elements */
    --border-radius: 16px;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-hover: 0 20px 25px -5px rgba(0,0,0,0.1);

    /* Animation */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- RESET & BASIC SETUP --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Roboto', sans-serif;
    color: var(--text-main);
    line-height: 1.6;
    background-color: var(--bg-body);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main { flex: 1; }

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-weight: 700;
}

a { text-decoration: none; color: var(--primary-color); transition: var(--transition); }
ul { list-style: none; padding: 0; margin: 0; }
img { max-width: 100%; height: auto; display: block; }
.container { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
section { padding: 60px 0; }

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 50px;
    position: relative;
    display: inline-block;
    width: 100%;
}
.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: var(--accent-color);
    margin: 15px auto 0;
    border-radius: 2px;
}

/* --- BUTTONS --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: var(--transition);
    border: none;
    box-shadow: var(--shadow-md);
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-primary { background: var(--accent-gradient); color: var(--bg-white); }
.btn-primary:hover { background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%); color: var(--bg-white); }
.btn-secondary { background-color: var(--bg-white); color: var(--primary-color); border: 1px solid #e2e8f0; }
.btn-secondary:hover { border-color: var(--primary-color); color: var(--primary-color); background-color: #f8fafc; }

/* Small Buttons */
.btn-sm { padding: 8px 16px; font-size: 0.85rem; border-radius: 8px; text-transform: uppercase; font-weight: 700; }
.btn-edit { background: #3b82f6; color: white; }
.btn-delete { background: #ef4444; color: white; }
.btn-view { background: #10b981; color: white; }

/* --- HEADER --- */
.main-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}
.main-header .container { display: flex; justify-content: space-between; align-items: center; }
.logo img { height: 45px; }
.main-nav ul { display: flex; align-items: center; gap: 30px; }
.main-nav a { font-weight: 600; font-size: 0.95rem; color: var(--text-main); position: relative; }
.main-nav a:not(.btn)::after {
    content: ''; position: absolute; width: 0; height: 2px; bottom: -5px; left: 0;
    background-color: var(--accent-color); transition: width 0.3s ease;
}
.main-nav a:not(.btn):hover::after { width: 100%; }

/* --- HERO --- */
.hero {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(15, 23, 42, 0.7) 100%), 
                url('../img/hero-bg.jpg') no-repeat center center/cover;
    height: 70vh; min-height: 500px; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--bg-white);
}
.hero h1 { font-size: 3.5rem; font-weight: 800; color: var(--bg-white); margin-bottom: 1.5rem; text-shadow: 0 2px 4px rgba(0,0,0,0.3); animation: fadeInUp 0.8s ease-out; }
.search-form { display: flex; max-width: 700px; margin: 0 auto; background: var(--bg-white); padding: 8px; border-radius: 50px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); animation: fadeInUp 1s ease-out; }
.search-form input { flex-grow: 1; padding: 15px 25px; border: none; border-radius: 50px; font-size: 1.1rem; outline: none; }
.search-form .btn { padding: 15px 40px; border-radius: 40px; margin-left: 5px; box-shadow: none; }

/* --- CATALOG FILTERS (GRID FIX) --- */
.filters-form {
    display: grid;
    /* Сетка: Поиск(широкий) - Категория - Дата - Стоимость - Кнопка */
    grid-template-columns: 2.5fr 1.2fr 1fr 1fr 1fr; 
    gap: 15px;
    align-items: end; /* Выравнивание по нижнему краю, чтобы кнопка была ровно с полями */
    margin-top: 20px;
}

.filters-form .form-group {
    margin-bottom: 0; /* Убираем отступ снизу, так как в сетке он не нужен */
}

.filters-form .btn {
    width: 100%; /* Кнопка занимает всю ширину своей ячейки */
    margin-bottom: 2px; /* Микро-коррекция высоты */
    height: 50px; /* Фиксируем высоту кнопки, чтобы совпадала с инпутами */
}

/* --- CARDS & GRID --- */
.courses-grid, .catalog-grid, .profile-courses-grid, .category-grid { display: grid; gap: 30px; }
.courses-grid, .catalog-grid, .profile-courses-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.category-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

.course-card, .category-card { 
    background: var(--bg-white); 
    border-radius: var(--border-radius); 
    transition: var(--transition); 
    box-shadow: var(--shadow-md); 
    overflow: hidden; 
    display: flex;
    flex-direction: column;
    height: 100%;
}
.course-card:hover, .category-card:hover { transform: translateY(-8px); box-shadow: var(--shadow-hover); }

.category-card { padding: 30px 20px; text-align: center; border: 1px solid #f1f5f9; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.category-card i { font-size: 2.5rem; margin-bottom: 20px; color: var(--primary-color); background: #eff6ff; width: 80px; height: 80px; line-height: 80px; border-radius: 50%; transition: var(--transition); }
.category-card:hover i { background: var(--accent-color); color: var(--bg-white); }
.category-card h4 { font-size: 1.1rem; color: var(--text-main); margin: 0; }

.course-card-img { height: 200px; overflow: hidden; }
.course-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.course-card:hover .course-card-img img { transform: scale(1.05); }

.course-card-content { 
    padding: 24px;
    flex-grow: 1;          /* Это заставит блок растягиваться, выталкивая футер вниз */
    display: flex;
    flex-direction: column;
}
.course-card-content h3 { font-size: 1.25rem; margin-bottom: 15px; color: var(--primary-color); line-height: 1.3; }

/* FIX: Card Meta */
.course-card-meta { font-size: 0.9rem; color: var(--text-light); margin-bottom: 20px; }
.course-card-meta span { display: block; margin-bottom: 5px; }

.course-card-footer { 
    margin-top: auto; 
    padding-top: 20px;
}
.course-card-footer .btn { width: 100%; }

/* --- PAGINATION --- */
.pagination { display: flex; justify-content: center; align-items: center; gap: 15px; margin-top: 50px; }
.pagination li a, .pagination li span { width: 45px; height: 45px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background-color: var(--bg-white); box-shadow: var(--shadow-sm); color: var(--text-main); font-weight: 600; border: none; }
.pagination li a:hover { background-color: var(--primary-color); color: var(--bg-white); transform: translateY(-3px); }
.pagination li.active span { background: var(--accent-gradient); color: var(--bg-white); cursor: default; }

/* --- SECTIONS --- */
#advantages { background: var(--primary-color); color: var(--bg-white); position: relative; overflow: hidden; }
#advantages::before { content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: radial-gradient(circle, rgba(255,255,255,0.05) 1px, transparent 1px); background-size: 20px 20px; opacity: 0.3; }
.advantages-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; position: relative; z-index: 2; }
.advantage-item { text-align: center; padding: 20px; }
.advantage-item i { font-size: 3.5rem; color: var(--accent-color); margin-bottom: 20px; display: inline-block; padding: 20px; background: rgba(255,255,255,0.05); border-radius: 50%; }
.advantage-item h3 { color: var(--bg-white); font-size: 1.5rem; margin-bottom: 15px; }
.advantage-item p { color: #94a3b8; }

.testimonial-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 40px; }
.testimonial-card { 
    background: var(--bg-white);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    position: relative;
    /* Добавляем Flexbox */
    display: flex;
    flex-direction: column;
    height: 100%;
}
.testimonial-card::before { 
    content: '\201C'; 
    position: absolute; 
    top: 20px; 
    left: 20px; 
    font-size: 80px; 
    color: #e2e8f0; 
    font-family: serif; 
    line-height: 1; 
    z-index: 0; 
}
.testimonial-card p { 
    position: relative;
    z-index: 1;
    font-style: italic;
    color: var(--text-main);
    margin-bottom: 25px;
    /* Занимает всё свободное место */
    flex-grow: 1; 
}
.testimonial-author { 
    display: flex;
    align-items: center;
    position: relative;
    z-index: 1;
    /* Лишний отступ сверху теперь не нужен */
    margin-top: auto; 
}
.testimonial-author img { 
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin-right: 15px;
    border: 3px solid var(--bg-white);
    box-shadow: var(--shadow-sm);
    object-fit: cover; 
}
.testimonial-author h5 { margin: 0; font-size: 1.1rem; }
.testimonial-author span { color: var(--accent-color); font-size: 0.9rem; font-weight: 500; }

#newsletter { background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); color: var(--bg-white); text-align: center; }
#newsletter h2 { color: var(--bg-white); }
#newsletter p { color: #cbd5e1; margin-bottom: 30px; }
.newsletter-form form { display: flex; gap: 15px; justify-content: center; max-width: 600px; margin: 0 auto; }
.newsletter-form input { flex-grow: 1; padding: 15px 20px; border-radius: 50px; border: none; outline: none; }
.newsletter-form .checkbox-group { margin-top: 20px; color: #94a3b8; justify-content: center; }

/* --- FORMS --- */
.form-section { min-height: 80vh; display: flex; align-items: center; justify-content: center; }
.form-container { background: var(--bg-white); padding: 50px; border-radius: 20px; box-shadow: var(--shadow-lg); width: 100%; max-width: 550px; }
.form-group { margin-bottom: 25px; }
.form-group label { display: block; margin-bottom: 10px; font-weight: 600; color: var(--primary-color); font-size: 0.95rem; }
.form-group input:not([type="checkbox"]), .form-group select, .form-group textarea {
    width: 100%; padding: 14px 18px; border: 2px solid #e2e8f0; border-radius: 10px; font-size: 1rem; transition: var(--transition); background: #f8fafc; font-family: 'Roboto', sans-serif;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--accent-color); background: var(--bg-white); box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.1); }
.checkbox-group { display: flex; align-items: center; }
.checkbox-group input { width: 20px; height: 20px; margin-right: 12px; cursor: pointer; }
.error-message { color: #ef4444; font-size: 0.85rem; margin-top: 8px; display: block; }

/* --- FIX: FOOTER LINKS --- */
.main-footer { background-color: var(--primary-color); color: #94a3b8; padding: 60px 0 30px; font-size: 0.95rem; }
.main-footer .container { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 50px; }
.footer-col h4 { color: var(--bg-white); margin-bottom: 25px; font-size: 1.2rem; }
.footer-col ul { list-style: none; padding: 0; }
.footer-col li { margin-bottom: 12px; }

/* Явный цвет для ссылок в футере */
.footer-col a { 
    color: #f8fafc; /* Почти белый цвет */
    transition: var(--transition); 
    display: inline-block; 
}
.footer-col a:hover { 
    color: var(--accent-color); 
    padding-left: 5px; 
    text-decoration: none;
}

.social-links { margin-top: 20px; }
.social-links a { 
    display: inline-flex; 
    justify-content: center; 
    align-items: center; 
    width: 40px; 
    height: 40px; 
    background: rgba(255,255,255,0.1); 
    border-radius: 50%; 
    margin-right: 10px; 
    color: var(--bg-white); /* Цвет иконки */
    text-decoration: none;
}
.social-links a:hover { 
    background: var(--accent-color); 
    color: #ffffff !important; /* Принудительно оставляем иконку белой */
    transform: translateY(-3px); 
    padding-left: 0; /* Отменяем сдвиг текста, который настроен для обычных ссылок в футере */
}

/* --- ANIMATIONS --- */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }

/* --- RESPONSIVE --- */
@media (max-width: 992px) {
    .testimonial-grid, .course-details-grid, .main-footer .container, .advantages-grid { grid-template-columns: 1fr; }
    /* На планшете в две колонки */
    .filters-form { grid-template-columns: 1fr 1fr; }
    .filters-form .btn { grid-column: span 2; }
}
@media (max-width: 768px) {
    .hero h1 { font-size: 2.5rem; }
    .section-title { font-size: 2rem; }
    .search-form, .newsletter-form form { flex-direction: column; background: transparent; box-shadow: none; padding: 0; }
    .search-form input, .search-form .btn { width: 100%; border-radius: 12px; margin: 0 0 10px 0; }
    /* На телефоне в одну колонку */
    .filters-form { grid-template-columns: 1fr; }
    .filters-form .btn { grid-column: span 1; }
}

/* =========================================
   BAD UI STYLES (Special for Register & Login)
   ========================================= */

/* Grid Layout for Form */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.full-width { grid-column: span 2; }
@media (max-width: 600px) {
    .form-grid { grid-template-columns: 1fr; }
    .full-width { grid-column: span 1; }
}

.input-row { display: flex; gap: 10px; }
.readonly-input { text-align: center; font-weight: 800; font-size: 1.1rem; color: var(--primary-color); letter-spacing: 1px; background-color: #e2e8f0; cursor: not-allowed; border: 2px solid #cbd5e1 !important; }
.agreement-box { height: 120px; overflow-y: scroll; border: 2px solid #cbd5e1; padding: 10px; background: #fff; font-size: 0.75rem; border-radius: 10px; color: #334155; box-shadow: inset 0 2px 4px rgba(0,0,0,0.05); }
.agreement-box h4 { font-size: 0.9rem; color: #ef4444; margin-bottom: 5px; text-align: center; }
.agreement-box p { margin-bottom: 8px; line-height: 1.4; }
.bad-ui-comment { font-size: 0.8rem; color: var(--text-muted); display: block; margin-top: 5px; min-height: 20px; font-weight: 500; }
.runaway-container { margin-top: 10px; height: 60px; position: relative; }
.password-msg { margin-top: 5px; font-weight: bold; font-size: 0.85rem; }

/* Course Details Fixes */
.course-details-grid { align-items: start; }
.course-main-content > img { 
    display: block;
    max-width: 500px;    /* Ограничиваем ширину, чтобы высота не была огромной */
    width: 100%;         /* Позволяет картинке сужаться на мобильных */
    height: auto;        /* Высота подстроится пропорционально, БЕЗ ОБРЕЗКИ */
    margin: 0 auto 30px; /* Центрируем картинку и даем отступ снизу */
    border-radius: 20px;
    box-shadow: var(--shadow-md);
}
.course-organizer { background: var(--bg-white); padding: 20px 25px; border-radius: 16px; box-shadow: var(--shadow-sm); display: flex; align-items: center; margin: 20px 0; border: 1px solid #f1f5f9; }
.course-organizer img { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; margin-right: 20px; border: 2px solid #e2e8f0; }
.course-main-content ul li { position: relative; padding-left: 30px; margin-bottom: 15px; }
.course-main-content ul li::before { content: '\f00c'; font-family: "Font Awesome 5 Free"; font-weight: 900; position: absolute; left: 0; top: 2px; color: var(--accent-color); }
.course-sidebar { background: var(--bg-white); padding: 35px; border-radius: 20px; position: sticky; top: 100px; box-shadow: var(--shadow-lg); border: 1px solid #f1f5f9; }
.course-sidebar h3 { border-bottom: 2px solid #f1f5f9; padding-bottom: 15px; margin-bottom: 25px; }
.course-sidebar li { padding: 12px 0; border-bottom: 1px solid #f8fafc; color: var(--text-main); display: flex; align-items: center; }
.course-sidebar li i { color: var(--accent-color); width: 30px; font-size: 1.1rem; }

/* Profile Badges */
.badge { display: inline-block; padding: 4px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.badge-active { background: #dcfce7; color: #166534; }
.badge-draft { background: #f1f5f9; color: #475569; }
.profile-header { background: linear-gradient(135deg, var(--primary-color) 0%, #1e293b 100%); padding: 60px 0; color: var(--bg-white); }
.profile-header h1 { color: var(--bg-white); margin-bottom: 5px; }
.profile-courses-grid .course-card { border-top: 4px solid var(--accent-color); }
.profile-course-card .card-actions { display: flex; gap: 10px; flex-wrap: wrap; }


/* =========================================
   MOBILE OPTIMIZATION (ADDITIONAL STYLES)
   ========================================= */

@media (max-width: 768px) {
    /* 1. Общие настройки и типографика */
    section {
        padding: 40px 0; /* Уменьшаем отступы секций */
    }
    
    .section-title {
        font-size: 1.8rem;
        margin-bottom: 30px;
    }

    h1 { font-size: 2rem !important; }
    h2 { font-size: 1.6rem; }
    h3 { font-size: 1.4rem; }

    .container {
        padding: 0 15px;
    }

    /* 2. Шапка (Header) */
    .main-header {
        padding: 10px 0;
    }
    
    .logo img {
        height: 35px; /* Уменьшаем логотип */
    }

    /* 3. Герой-секция (Hero) */
    .hero {
        height: auto;
        min-height: 400px;
        padding: 60px 0;
    }

    .hero h1 {
        font-size: 2.2rem;
        padding: 0 10px;
    }

    .search-form {
        width: 100%;
        border-radius: 15px;
        background: transparent;
        box-shadow: none;
    }

    .search-form input {
        background: var(--bg-white);
        margin-bottom: 10px;
        border-radius: 12px;
        box-shadow: var(--shadow-sm);
    }

    /* 4. Фильтры каталога */
    .filters-form {
        display: flex;
        flex-direction: column; /* Стекинг всех полей фильтрации */
        gap: 12px;
    }

    .filters-form .form-group label {
        margin-bottom: 5px;
        font-size: 0.85rem;
    }

    /* 5. Карточки курсов */
    .courses-grid, .catalog-grid, .profile-courses-grid {
        grid-template-columns: 1fr; /* По одной карточке в ряд */
        gap: 20px;
    }

    .course-card-img {
        height: 180px;
    }

    /* 6. Преимущества (Advantages) */
    .advantages-grid {
        gap: 20px;
    }
    
    .advantage-item {
        padding: 10px;
    }

    .advantage-item i {
        font-size: 2.5rem;
        padding: 15px;
    }

    /* 7. Детали курса (Course Details) */
    .course-details-grid {
        display: grid;
        grid-template-columns: 1fr 380px; /* Основной контент + фиксированная ширина для боковой панели */
        gap: 40px;                       /* Расстояние между колонками */
        align-items: start;
        margin-top: 30px;
    }

    .course-sidebar {
        background: var(--bg-white);
        padding: 30px;
        border-radius: 20px;
        position: sticky;        /* Карточка будет "ехать" за пользователем */
        top: 120px;              /* Отступ от верха экрана при скролле */
        box-shadow: var(--shadow-lg);
        border: 1px solid #f1f5f9;
    }

    .course-organizer {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }

    .course-organizer img {
        margin-right: 0;
        margin-bottom: 15px;
    }

    /* 8. Пагинация */
    .pagination {
        gap: 8px;
        flex-wrap: wrap;
    }

    .pagination li a, .pagination li span {
        width: 38px;
        height: 38px;
        font-size: 0.9rem;
    }

    /* 9. Формы (Регистрация/Логин) */
    .form-container {
        padding: 30px 20px;
        margin: 20px;
    }

    .form-grid {
        grid-template-columns: 1fr; /* Все поля в одну колонку */
    }

    .full-width {
        grid-column: span 1;
    }

    .input-row {
        flex-direction: column;
    }

    /* 10. Футер */
    .main-footer .container {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 30px;
    }

    .footer-col h4::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .social-links {
        justify-content: center;
        display: flex;
    }
}

/* Маленькие смартфоны (iPhone SE и др.) */
@media (max-width: 480px) {
    .section-title {
        font-size: 1.5rem;
    }

    .btn {
        width: 100%; /* Кнопки на всю ширину */
        padding: 12px 20px;
    }

    .newsletter-form form {
        gap: 10px;
    }

    .course-card-content {
        padding: 15px;
    }
    
    /* Исправление для Runaway Button (Плохой UI) */
    .runaway-container {
        height: 80px;
    }
}

/* Фикс для таблиц/списков, чтобы не вылезали за края */
table, img, video, canvas {
    max-width: 100%;
    height: auto;
}

/* --- СТИЛИ ДЛЯ ГАМБУРГЕРА --- */
.menu-toggle {
    display: none; /* Скрыт на десктопе */
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1001;
    padding: 0;
}

.menu-toggle span {
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 10px;
    transition: var(--transition);
}

/* Анимация превращения в крестик при открытии */
.menu-toggle.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}
.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}
.menu-toggle.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* --- АДАПТИВ ПОД МОБИЛУ (992px и ниже) --- */
@media (max-width: 992px) {
    .course-details-grid {
        grid-template-columns: 1fr;
        display: flex;
        flex-direction: column;
    }
    
    .course-sidebar {
        position: static;    /* Отключаем прилипание на мобильных */
        order: 2;            /* Текст будет первым, карточка под ним */
        width: 100%;
        box-sizing: border-box;
    }

    .menu-toggle {
        display: flex; /* Показываем кнопку */
    }

    .main-nav {
        position: absolute;
        top: 100%; /* Выпадает сразу под шапкой */
        left: 0;
        width: 100%;
        background: var(--bg-white);
        box-shadow: var(--shadow-lg);
        max-height: 0; /* Изначально скрыто через высоту */
        overflow: hidden;
        transition: max-height 0.4s ease-in-out;
    }

    /* Когда меню открыто (добавляется через JS) */
    .main-nav.active {
        max-height: 500px; /* Высота выпадающего списка */
        border-top: 1px solid #eee;
    }

    .main-nav ul {
        flex-direction: column; /* Ссылки друг под другом */
        gap: 0;
        padding: 20px;
    }

    .main-nav ul li {
        width: 100%;
        text-align: center;
        border-bottom: 1px solid #f8fafc;
    }
    
    .main-nav ul li:last-child { border: none; }

    .main-nav a {
        display: block;
        padding: 15px 0;
        font-size: 1.1rem;
    }

    .main-nav .btn {
        margin-top: 10px;
        width: 100%; /* Кнопка регистрации на всю ширину */
    }
}

/* 1. Сетка страницы: Контент слева (1fr), Инфо-блок справа (350px) */
.course-details-grid {
    display: grid;
    grid-template-columns: 1fr 350px; 
    gap: 50px;
    align-items: start; /* Чтобы блоки не растягивались по высоте друг друга */
    margin-top: 40px;
}

/* 2. Адекватный размер фото */
.course-cover {
    display: block;
    max-width: 600px;    /* Фото не будет шире 600px */
    width: 100%;         /* На мобилках будет сужаться */
    height: auto;        /* Сохраняет пропорции, не обрезает бутылки */
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
}

/* 3. Оформление боковой панели */
.course-sidebar {
    background: var(--bg-white);
    padding: 30px;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    position: sticky;    /* Панель "прилипает" при скролле текста */
    top: 100px;          /* Отступ от шапки при скролле */
    border: 1px solid #f1f5f9;
}

.course-sidebar h3 {
    margin-top: 0;
    font-size: 1.4rem;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 15px;
}

.course-sidebar ul {
    list-style: none;
    padding: 0;
    margin-bottom: 25px;
}

.course-sidebar li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f8fafc;
}

.course-sidebar li i {
    color: var(--accent-color);
    width: 20px;
    text-align: center;
}

.course-sidebar .btn {
    width: 100%; /* Кнопка на всю ширину панели */
}

/* 4. Адаптив для мобилок (в одну колонку) */
@media (max-width: 992px) {
    .course-details-grid {
        grid-template-columns: 1fr;
    }
    .course-sidebar {
        position: static;
        width: 100%;
    }
    .course-cover {
        max-width: 100%; /* На мобилках фото на всю ширину */
    }
}