/* =========================================================
   COLOR VARIABLES (SAFE, LOCAL)
   ========================================================= */

:root {
    --c-primary: #E92820;
    --c-accent: #4376BE;
    --c-accent-soft: #E2F23B;
    --c-white: #FFFFFF;

    --c-text-main: #1f2937;
    --c-text-muted: #556070;

    --shadow-soft: 0 8px 24px rgba(67, 118, 190, 0.15);
    --shadow-hover: 0 16px 40px rgba(67, 118, 190, 0.25);
}

/* =========================================================
   GLOBAL BACKGROUND & TEXT
   ========================================================= */

body {
    color: var(--c-text-main);
    background: linear-gradient(
        180deg,
        #ffffff 0%,
        #f3f6fb 100%
    );
}

/* links */
a {
    color: var(--c-primary);
}

a:hover {
    color: var(--c-accent);
}

/* =========================================================
   BASE BUTTONS
   ========================================================= */

.btn {
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    transition: all .2s ease;
}

.btn-primary {
    background: var(--c-accent);
    color: #fff;
    box-shadow: 0 6px 16px rgba(233, 40, 32, 0.35);
}

.btn-primary:hover {
    background: #c91f19;
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--c-accent-soft);
    color: #222;
}

/* =========================================================
   SUBJECTS / HOMEWORK CARDS
   ========================================================= */

.subjects {
    padding: 60px 0;
}

.subjects__inner {
    max-width: 1200px;
    margin: 0 auto;
}

.subjects h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 32px;
    color: var(--c-primary);
}

.subjects__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
}

.subject-card {
    display: flex;
    flex-direction: column;
    align-items: center;

    padding: 24px;
    border-radius: 16px;

    background: var(--c-white);
    color: var(--c-text-main);
    text-decoration: none;

    box-shadow: var(--shadow-soft);
    transition: transform .2s ease, box-shadow .2s ease;
}

.subject-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
}

.subject-card img {
    width: 140px;
    height: 140px;
    object-fit: contain;
    margin-bottom: 16px;
}

.subject-card span {
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    color: var(--c-primary);
}

/* =========================================================
   S7 HERO SLIDER — CARD STYLE
   ========================================================= */

#s7Slider {
    position: relative;
    width: 100%;
    max-width: 1200px;
    height: 420px;
    margin: 0 auto;

    background: var(--c-white);
    border-radius: 16px;
    box-shadow: var(--shadow-soft);

    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
}

#s7Slider:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
}

/* viewport */
#s7Slider .s7-viewport {
    height: 100%;
    overflow: hidden;
}

/* track */
#s7Slider .s7-track {
    display: flex;
    height: 100%;
    will-change: transform;
    touch-action: pan-y;
}

/* slide */
#s7Slider .s7-slide {
    width: 100%;
    min-width: 100%;
    height: 100%;
    flex-shrink: 0;

    display: flex;
align-items: flex-start;
    position: relative;

    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
}

/* overlay for readability */
#s7Slider .s7-slide::before {
    display: none;
}


/* content */
#s7Slider .s7-content {
    position: relative;
    max-width: 900px;
    padding: 60px;
    pointer-events: none;
        background: none;
    border-radius: 0px;
}

#s7Slider h1 {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--c-primary);
}

#s7Slider p {
    font-size: 20px;
    color: var(--c-text-muted);
    margin-bottom: 32px;
}

#s7Slider .s7-actions {
    display: flex;
    gap: 16px;
}

/* buttons clickable */
#s7Slider .btn,
#s7Slider .s7-nav {
    pointer-events: auto;
}

/* =========================================================
   SLIDER NAVIGATION
   ========================================================= */

#s7Slider .s7-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;

    width: 36px;
    height: 36px;
    border-radius: 50%;

    background: var(--c-primary);
    color: #fff;
    border: none;

    font-size: 20px;
    line-height: 36px;
    text-align: center;

    cursor: pointer;
    box-shadow: 0 6px 14px rgba(67,118,190,.35);
    transition: background .2s ease;
}

#s7Slider .s7-nav:hover {
    background: var(--c-accent);
}

#s7Slider .s7-nav.prev { left: 12px; }
#s7Slider .s7-nav.next { right: 12px; }

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 768px) {
    #s7Slider {
        height: 320px;
        border-radius: 16px;
        margin: 0 12px;
    }

    #s7Slider .s7-content {
        padding: 24px;
    }

    #s7Slider h1 {
        font-size: 30px;
    }

    #s7Slider p {
        font-size: 16px;
    }
}

/* =========================================================
   JOOMLA CARD FIX
   ========================================================= */

.main-top.card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.main-top.card .card-body {
    padding: 0 !important;
}

/* =========================================================
   SLIDER ARROWS — NO CIRCLE, BIG ARROWS
   ========================================================= */

#s7Slider .s7-nav {
    background: none !important;
    box-shadow: none !important;

    font-size: 60px;
    line-height: 1;

    color: #C91F19;
    opacity: 0.7;

    transform: translateY(-50%);
    transition: opacity .2s ease, transform .2s ease;
    cursor: pointer;
}

#s7Slider .s7-nav:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.15);
}

/* позиционирование */
#s7Slider .s7-nav.prev {
    left: 20px;
}

#s7Slider .s7-nav.next {
    right: 20px;
}

/* FIX ARROWS JUMP */
#s7Slider .s7-nav {
    background: none !important;
    box-shadow: none !important;

    font-size: 60px;
    line-height: 1;

    color: #C91F19;
    opacity: 0.7;

    transform: translateY(-50%);
    transition: opacity .2s ease, transform .2s ease;
    cursor: pointer;
}

#s7Slider .s7-nav:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.15);
}

/* FIX SLIDE IMAGE VISIBILITY */
#s7Slider .s7-slide::before {
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0.65) 0%,
        rgba(255,255,255,0.30) 45%,
        rgba(255,255,255,0.0) 100%
    );
}

/* === HARD FIX: REMOVE SLIDE OVERLAY COMPLETELY === */
#s7Slider .s7-slide::before {
    content: none !important;
    display: none !important;
}

/* =========================================================
   SLIDER BACKGROUNDS (RESTORE)
   ========================================================= */

#s7Slider .slide-russia {
    background-image: url("/images/slider/slider-1.jpg");
}

#s7Slider .slide-history {
    background-image: url("/images/slider/slider-2.jpg");
}

#s7Slider .slide-social {
    background-image: url("/images/slider/slider-3.jpg");
}

/* === DISABLE SLIDER HOVER EFFECT === */
#s7Slider:hover {
    transform: none !important;
    box-shadow: var(--shadow-soft) !important;
}

/* === DISABLE TEXT SELECTION ON SLIDES === */
#s7Slider,
#s7Slider * {
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
}

/* === SLIDER ARROWS — WHITE OUTLINE (TEXT ONLY) === */
#s7Slider .s7-nav {
    background: none !important;
    border: none !important;
    box-shadow: none !important;

    font-size: 60px;
    line-height: 1;

    color: #C91F19; /* основной цвет стрелки */

    /* 🔥 БЕЛАЯ ОБВОДКА ПО КОНТУРУ СИМВОЛА */
    text-shadow:
        -1px -1px 0 #fff,
         1px -1px 0 #fff,
        -1px  1px 0 #fff,
         1px  1px 0 #fff,
         0   -2px 0 #fff,
         0    2px 0 #fff,
        -2px  0   0 #fff,
         2px  0   0 #fff;

    opacity: 0.85;
    cursor: pointer;

    transform: translateY(-50%);
    transition: opacity .2s ease, transform .2s ease;
}

/* hover — подчёркиваем кликабельность */
#s7Slider .s7-nav:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

/* позиционирование */
#s7Slider .s7-nav.prev { left: 20px; }
#s7Slider .s7-nav.next { right: 20px; }

/* === HIDE "Домашние задания" TITLE === */
.subjects h2 {
    display: none;
}

/* === STICKY HEADER (S7 STYLE) === */
.header.container-header {
    position: sticky;
    top: 0;
    z-index: 1000;

    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);

    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
    transition: background .2s ease, box-shadow .2s ease;
}

/* =========================================================
   РАЗДЕЛЕНИЕ ШРИФТОВ (КАК НА MAY9.RU)
   ========================================================= */

@font-face {
    font-family: 'Bastion Kontrast Alt';
    src: url('../fonts/BastionKontrastAlt-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* 1. Настройка переменных Joomla Cassiopeia */
:root {
    --cassiopeia-font-family-body: 'Roboto', sans-serif;
    --cassiopeia-font-family-headings: 'Bastion Kontrast Alt', serif;
}

/* 2. ПРИМЕНЯЕМ BASTION ТОЛЬКО ДЛЯ АКЦЕНТОВ (Заголовки, кнопки, лого) */
h1, h2, h3, h4, h5, h6, 
.navbar-brand, 
.brand-logo,
.s7-content h1,
.subject-card span {
    font-family: 'Bastion Kontrast Alt', serif !important;
    font-weight: normal; 
    text-transform: uppercase; /* Фишка стиля Победы */
    letter-spacing: 0.03em;
}

/* 3. ПРИМЕНЯЕМ ROBOTO ДЛЯ ВСЕГО ОСТАЛЬНОГО ТЕКСТА */
body, 
p, 
ul, li, 
div, 
span:not(.subject-card span), /* исключаем текст в карточках */
.s7-content p {
    font-family: 'Roboto', sans-serif !important;
    font-weight: 400;
    line-height: 1.6; /* Увеличиваем межстрочный интервал для читаемости */
    color: #2c3e50;   /* Цвет текста делаем чуть мягче черного */
}

/* 4. Кнопки (сделаем их более солидными) */
.btn {
    font-size: 0.9rem;
    font-weight: bold;
    padding: 12px 24px;
}

/* Убираем горизонтальный скролл на всем сайте */
body {
    overflow-x: hidden;
    width: 100%;
}

/* Настройка слайдера для мобильных */
#s7Slider {
    width: 100% !important;
    max-width: 100vw !important;
    margin: 0 auto;
    box-sizing: border-box;
    left: 0;
}

#s7Slider .s7-slide {
    width: 100%;
    /* На мобильных уменьшаем высоту, чтобы слайдер не занимал весь экран */
    height: 100%; 
}

@media (max-width: 768px) {
    #s7Slider {
        height: 300px; /* Фиксированная высота для мобильных */
        border-radius: 0; /* На мобильных лучше без скруглений по краям */
    }
}




/* =========================================================
   ОПТИМИЗАЦИЯ ПОЛНОЭКРАННОГО СЛАЙДЕРА
   ========================================================= */

#s7Slider .s7-slide {
    /* Центрируем картинку, чтобы самое важное (центр) всегда было видно */
    background-position: center center !important;
    background-size: cover !important;
    background-repeat: no-repeat;
    
    /* Добавляем внутренние отступы, чтобы текст не прилипал к краям экрана */
    display: flex;
    align-items: center; /* Центрируем текст по вертикали */
}

#s7Slider .s7-content {
    /* Ограничиваем ширину текстового блока, чтобы он не растягивался на 2 метра */
    max-width: 1200px; 
    margin: 0 auto;
    padding: 0 40px; /* Отступы по бокам */
    width: 100%;
    pointer-events: none;
    background: none;
}

/* Эффект затемнения, чтобы текст читался на любом фоне */
#s7Slider .s7-slide::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0) 60%);
    z-index: 1;
}

#s7Slider .s7-content {
    position: relative;
    z-index: 2; /* Поднимаем текст над затемнением */
}



/* На больших мониторах увеличим высоту слайдера, чтобы картинка влезла лучше */
@media (min-width: 1200px) {
    #s7Slider {
        height: 680px !important; /* Было 420px, увеличили, чтобы меньше обрезалось */
    }
}



#s7Slider .s7-track {
    touch-action: pan-y !important;
    -webkit-user-drag: none;
    user-select: none;
}

/* ОБЩИЕ НАСТРОЙКИ ПЛАВНОГО СКРОЛЛА */
html {
    scroll-behavior: smooth;
}

/* ДЕСКТОПНЫЙ ХЕДЕР */
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    height: 64px;
}

.desktop-menu ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 25px;
}

.desktop-menu a {
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    transition: color 0.2s;
    font-family: 'Roboto', sans-serif !important;
    text-transform: none !important; /* У S7 меню не капсом */
}

.desktop-menu a:hover {
    color: #c91f19;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 13px;
}

.login-link {
    color: #333;
    text-decoration: none;
    font-weight: bold;
}

/* МОБИЛЬНОЕ МЕНЮ (СКРЫТО НА ДЕСКТОПЕ) */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid #eee;
    z-index: 110009;
    justify-content: space-around;
    padding: 8px 0 calc(env(safe-area-inset-bottom) + 8px); /* Учет челок iPhone */
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #8e8e93;
    font-size: 10px;
    flex: 1;
    text-align: center;
    gap: 4px;
}

.nav-item img {
    width: 24px;
    height: 24px;
}

.nav-item.active {
    color: #76b82a; /* Фирменный салатовый S7 для активного пункта */
}

.nav-item span {
    font-family: 'Roboto', sans-serif !important;
}

/* АДАПТИВНОСТЬ */
@media (max-width: 992px) {
    .desktop-menu, .header-right {
        display: none;
    }
    
    .mobile-bottom-nav {
        display: flex;
    }

    /* Добавляем отступ снизу, чтобы контент не перекрывался меню */
    body {
        padding-bottom: 80px;
    }
}

/* Убираем фон у всех оберток хедера сразу */
header.header, 
.header.container-header, 
.header-inner, 
.navbar-brand {
    background: transparent !important;
    background-image: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
    border: none !important;
    backdrop-filter: none !important;
}

/* 1. НАСТРОЙКИ ДЛЯ ДЕСКТОПА (Экраны от 992px) */
@media (min-width: 992px) {
    header.header.container-header {
        display: block !important;
        position: relative !important; /* Возвращаем в общий поток (не поверх слайдера) */
        background-color: #ffffff !important; /* Чистый белый фон без полос и картинок */
        background-image: none !important;    /* Гарантированно убираем узор-полосу */
        box-shadow: 0 2px 5px rgba(0,0,0,0.05) !important; /* Едва заметная тень снизу для разделения */
        padding: 10px 0 !important;
        margin: 0 !important;
        border: none !important;
    }

    /* Настройка внутреннего контейнера для выравнивания */
    .header-inner {
        display: flex;
        justify-content: space-between;
        align-items: center;
        max-width: 1320px; /* Стандартная ширина контейнера */
        margin: 0 auto;
        padding: 0 15px;
    }

    /* Шрифты и стили ссылок меню */
    .desktop-menu ul {
        display: flex;
        list-style: none;
        margin: 0;
        padding: 0;
        gap: 25px; /* Расстояние между пунктами */
    }

    .desktop-menu ul li a {
        font-family: 'Roboto', sans-serif !important; /* Шрифт сайта */
        font-weight: 400;
        font-size: 16px;
        color: #333333 !important; /* Темный цвет текста */
        text-decoration: none;
        transition: color 0.3s ease;
    }

    .desktop-menu ul li a:hover {
        color: #0056b3 !important; /* Цвет при наведении */
    }

    /* Настройка правой части (RUB и Войти) */
    .header-right {
        font-family: 'Roboto', sans-serif !important;
        display: flex;
        align-items: center;
        gap: 20px;
    }
}

/* 2. НАСТРОЙКИ ДЛЯ МОБИЛЬНЫХ (Экраны до 991px) */
@media (max-width: 991.98px) {
    header.header.container-header {
        display: none !important; /* Полностью скрыто на телефонах */
    }
}
/* =========================================================
   STICKY S7 STYLE HEADER
   ========================================================= */

header.header.container-header {
    /* Фиксация */
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;

    /* Градиент: снизу (полупрозрачный) вверх (непрозрачный) */
    background: linear-gradient(
        to top, 
        rgba(255, 255, 255, 0.85) 0%, 
        rgba(255, 255, 255, 1) 100%
    ) !important;

    /* Эффект размытия фона за меню (как в iOS и на S7.ru) */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    /* Тонкая граница и мягкая тень для глубины */
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
    
    transition: all 0.3s ease;
    margin: 0 !important;
}

/* Убираем лишние отступы, чтобы меню было компактным как у S7 */
.header-inner {
    height: 60px !important;
    display: flex;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Стилизация ссылок под S7 */
.desktop-menu ul li a {
    font-family: 'Roboto', sans-serif !important;
    font-weight: 500 !important;
    font-size: 14px !important;
    color: #333 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    padding: 10px 5px;
}

.desktop-menu ul li a:hover {
    color: #c91f19 !important; /* Фирменный красный из вашего проекта */
}

/* На мобильных устройствах скрываем верхнюю шапку, если используем нижний навбар */
@media (max-width: 991px) {
    header.header.container-header {
        display: none !important;
    }
}

/* ===== MODAL BASE ===== */
/* 1. Главный контейнер (должен перекрывать всё) */
.class-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: none; /* Прячем по умолчанию */
    z-index: 100000 !important; /* Максимальный приоритет */
}

/* 2. Состояние при открытии (используем flex для центрирования) */
.class-modal.active {
    display: flex !important; 
    align-items: center;
    justify-content: center;
}

/* 3. Подложка (Overlay) — именно на неё вешается клик в JS */
.class-modal__overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.6) !important;
    z-index: 1 !important; /* Самый нижний слой внутри модалки */
    cursor: pointer !important;
    pointer-events: auto !important; /* Гарантируем, что клики проходят */
}

/* 4. Контентное окно (Белая карточка) */
.class-modal__content {
    position: relative !important;
    z-index: 2 !important; /* Выше чем overlay, чтобы клики по кнопкам работали */
    width: 95% !important;
    max-width: 1000px !important;
    background: #fff !important;
    border-radius: 24px !important;
    padding: 30px !important;
    box-shadow: 0 30px 80px rgba(0,0,0,0.35) !important;
    
    display: flex !important;
    flex-direction: column !important;
    max-height: 90vh !important;
    overflow: hidden !important;
}

.class-modal.active {
display: flex !important; /* Показываем при активации */
    align-items: center;
    justify-content: center;
}

.class-modal__overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.6) !important; /* Затемнение фона */
    z-index: 1 !important; /* Ниже контента */
    cursor: pointer !important; /* Подсказка пользователю, что сюда можно нажать */
}

/* ===== MODAL CONTENT ===== */
.class-modal__content {
    position: relative !important;
    max-width: 1000px !important;
    z-index: 2 !important; /* Выше overlay */
    width: 95% !important;
    margin: 4vh auto !important; /* Уменьшил отступ сверху */
    background: #fff !important;
    border-radius: 24px !important;
    padding: 30px !important;
    
    /* ФИКС ПРОКРУТКИ */
    max-height: 90vh !important; /* Модалка не может быть выше 90% экрана */
    display: flex !important;
    flex-direction: column !important; /* Элементы идут друг за другом сверху вниз */
    overflow: hidden !important; /* Скрываем то, что вылетает за границы радиуса */
    box-shadow: 0 30px 80px rgba(0,0,0,.35) !important;
}

@keyframes modalIn {
    from {
        transform: translateY(20px) scale(0.98);
        opacity: 0;
    }
    to {
        transform: none;
        opacity: 1;
    }
}

/* ===== HEADER ===== */
.class-modal__title {
    margin-bottom: 24px;
    font-size: 22px;
    text-align: center;
}

/* ===== CLOSE ===== */
.class-modal__close {
    position: absolute;
    top: 16px;
    right: 18px;
    font-size: 26px;
    border: none;
    background: none;
    cursor: pointer;
}

/* ===== GRID ===== */
/* Сетка для удобства */
.class-modal__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 25px;
    padding: 10px 10px 30px 10px; /* Отступ снизу для красоты */
    
    /* ВКЛЮЧАЕМ ПРОКРУТКУ ТУТ */
    overflow-y: auto !important; 
    flex-grow: 1; /* Сетка занимает всё свободное место */
    
    /* Настройка плавного скролла */
    scrollbar-width: thin;
    scrollbar-color: var(--c-accent) #f0f4fb;
}

/* ===== CLASS CARD ===== */
/* Стили для карточки задания (перенесено из твоего старого дизайна) */
.task-card {
    text-decoration: none;
    background: #fff;
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,.12);
    transition: transform .2s ease, box-shadow .2s ease;
    display: flex;
    flex-direction: column;
    color: var(--c-text-main);
}

.task-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 18px 45px rgba(0,0,0,.18);
}

.task-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 8px;
}

.task-card span {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    /* Обрезка длинного текста до 2 строк */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== BADGE ===== */
.class-card .badge {
    margin-top: 6px;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 10px;
    background: #c91f19;
    color: #fff;
}

/* ===== MOBILE ===== */
@media (max-width: 600px) {
    .class-modal__content {
        margin: 5vh 12px;
        padding: 20px;
    }
}



/* ===== TASK MODAL ===== */
.task-modal {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: none;
}

.task-modal.active {
    display: block;
}

.task-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(4px);
}

/* CONTENT */
.task-modal__content {
    position: relative;
    max-width: 1000px;
    margin: 6vh auto;
    background: #fff;
    border-radius: 20px;
    padding: 28px;
    box-shadow: 0 30px 80px rgba(0,0,0,.25);
    display: flex;
    flex-direction: column;
    max-height: 88vh; /* ⬅️ КЛЮЧЕВОЕ */
}

/* HEADER */
.task-modal__title {
    font-size: 22px;
    margin-bottom: 20px;
    text-align: center;
}

/* CLOSE */
.task-modal__close {
    position: absolute;
    top: 16px;
    right: 18px;
    font-size: 26px;
    border: none;
    background: none;
    cursor: pointer;
}

/* SCROLL AREA */
.task-modal__grid {
    display: grid !important;
    /* По умолчанию 2 колонки (для мобильных) */
    grid-template-columns: repeat(2, 1fr) !important; 
    gap: 15px !important; /* Немного уменьшим отступ для мобильных */
    padding: 10px;
    overflow-y: auto;
}

/* TASK CARD */
.task-card {
    text-decoration: none;
    background: #fff;
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,.12);
    transition: transform .2s ease, box-shadow .2s ease;
    display: flex;
    flex-direction: column;
}

.task-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 18px 45px rgba(0,0,0,.18);
}

.task-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 12px;
}

/* TITLE (2 LINES + ELLIPSIS) */
.task-card span {
    margin-top: 10px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;

    display: -webkit-box;
    -webkit-line-clamp: 2;        /* ⬅️ 2 строки */
    -webkit-box-orient: vertical;
    overflow: hidden;
}




/* ===== HARD FIX: TASK MODAL ===== */


/* Стиль для списка заданий (2 уровень) */
.task-item-link {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: background 0.3s;
    border-left: 4px solid #001B4C;
    width: 100%;
}

.task-item-link:hover {
    background: #e9ecef;
}

.task-icon {
    margin-right: 15px;
    font-size: 1.2rem;
}

.no-tasks {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    color: #666;
}

/* Контейнер для картинки и плейсхолдера */
.class-card__image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--c-accent); /* Синий фон, если нет фото */
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

/* Сама картинка (лежит поверх плейсхолдера) */
.class-card__image-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2; /* Выше фона */
}

/* Плейсхолдер (текст под картинкой) */
.class-card__placeholder {
    font-family: 'Bastion Kontrast Alt', serif !important;
    font-size: 48px;
    inset: 8px;  
    color: rgba(255, 255, 255, 0.4);
    z-index: 1; /* Ниже картинки */
    user-select: none;
}

/* Специально для карточек заданий можно сделать фон другого цвета */
.task-card .class-card__image-container {
    background: var(--c-primary); /* Красный фон для заданий */
}

/* ЭФФЕКТ ПРИ НАВЕДЕНИИ (как на главной) */
.hover-effect {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease !important;
    cursor: pointer;
}

.hover-effect:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 27, 76, 0.15) !important;
}

/* СТИЛИЗАЦИЯ ТЕКСТА ЗАДАНИЙ (Уровень 2) */
.task-card__title {
    display: block;
    margin-top: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--c-text-main);
    text-align: center; /* Выравнивание по центру */
    
    /* Обрезка текста до 2 строк с многоточием */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    
    line-height: 1.4;
    min-height: 2.8em; /* Резервируем место под 2 строки, чтобы сетка не прыгала */
}

/* КНОПКА НАЗАД (Шрифт заголовков) */
.class-modal__back {
    /* Используем шрифт Bastion как в заголовках */
    font-family: 'Bastion Kontrast Alt', 'Roboto', serif !important;
    font-size: 16px; 
    letter-spacing: 0.03em;
    text-transform: uppercase;
    background: #f0f4fb;
    color: var(--c-accent);
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.class-modal__back:hover {
    background: var(--c-accent);
    color: #fff;
}

/* Красивый скроллбар для Chrome/Safari */
.class-modal__grid::-webkit-scrollbar {
    width: 6px;
}
.class-modal__grid::-webkit-scrollbar-track {
    background: #f0f4fb;
    border-radius: 10px;
}
.class-modal__grid::-webkit-scrollbar-thumb {
    background-color: var(--c-accent);
    border-radius: 10px;
}

/* Заголовок и кнопка не должны скроллиться */
.class-modal__title {
    margin-bottom: 20px;
    flex-shrink: 0; /* Не сжимать заголовок */
}

.class-modal__back {
    margin-bottom: 15px;
    align-self: flex-start;
    flex-shrink: 0; /* Не сжимать кнопку */
}

/* 1. Назначаем Roboto всем кнопкам и элементам управления в модальном окне */
.class-modal__content button,
.class-modal__back,
.class-modal__close,
.class-card span,
.task-card__title,
.no-tasks {
    font-family: 'Roboto', sans-serif !important;
}

/* 2. Специфические настройки для кнопки "Назад" */
.class-modal__back {
    font-weight: 700; /* Делаем шрифт жирным */
    font-size: 15px;
    letter-spacing: 0.02em;
    text-transform: none; /* Убираем ВЕРХНИЙ РЕГИСТР, если он был */
    
    background: #f0f4fb;
    color: var(--c-accent);
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    margin-bottom: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.class-modal__back:hover {
    background: var(--c-accent);
    color: #fff;
}

/* 3. Настройка текста заданий (чтобы тоже был Roboto) */
.task-card__title {
    font-weight: 500; /* Средняя жирность для читабельности */
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
    margin-top: 10px;
}

/* 4. Если на кнопке Назад есть символ стрелочки, можно его подправить */
.class-modal__back::before {
    font-size: 18px;
    line-height: 1;
}

.class-modal.mobile-sheet {
  align-items: flex-end;
}

.class-modal.mobile-sheet .class-modal__content {
  height: 90vh;
  border-radius: 12px 12px 0 0;
  overflow-y: auto;
  position: relative;
}

.class-modal.mobile-sheet .class-modal__content::before {
  content: '';
  display: block;
  height: 8px;
  background: #6a3cc7; /* фиолетовая полоса */
  border-radius: 12px 12px 0 0;
}

/* Убираем фон при hover/focus */
.class-card:hover,
.class-card:focus,
.class-card:active {
  background: transparent;
}

.class-modal__content {
    /* Запрещает браузеру обрабатывать системные жесты, 
       когда мы работаем с модалкой вручную */
    touch-action: pan-x pan-y; 
    will-change: transform; /* Оптимизация для плавной анимации */
}

/* Общая настройка сетки для обоих уровней модального окна */
.class-modal__grid {
    display: grid !important;
    /* По умолчанию 2 колонки (для мобильных) */
    grid-template-columns: repeat(2, 1fr) !important; 
    gap: 15px !important; /* Немного уменьшим отступ для мобильных */
    padding: 10px;
    overflow-y: auto;
}

/* Настройка для десктопа (экраны шире 992px) */
@media (min-width: 992px) {
    .class-modal__grid, 
    .task-modal__grid {
        /* 4 колонки для больших экранов */
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 25px !important; /* Увеличиваем отступы на десктопе */
    }
}

/* Начальное состояние контента для анимации */
.class-modal__content {
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform;
}

/* Когда модалка активна */
.class-modal.active .class-modal__content {
    transform: translateY(0);
}

/* Отключаем анимацию во время перетаскивания пальцем, 
   чтобы окно не "отставало" от руки. Класс добавим через JS */
.class-modal__content.is-dragging {
    transition: none !important;
}

/* Состояние модалки по умолчанию */
.class-modal__content {
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.32, 1, 0.23, 1);
    will-change: transform;
}

/* Когда активно */
.class-modal.active .class-modal__content {
    transform: translateY(0);
}

/* Убираем анимацию только при ручном перетаскивании */
.class-modal__content.is-dragging {
    transition: none !important;
}

/* Контейнер модального окна */
/* Контейнер на весь экран */
.class-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: flex-end;    /* Прижимаем к нижней части экрана */
    justify-content: center;  /* ЦЕНТРИРУЕМ карточку по горизонтали */
    pointer-events: auto;
}
.class-modal.active { display: flex; }

/* Фон */
.class-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

/* Шторка (85% высоты) */
.class-modal__container {
    position: relative;
    z-index: 2;
    
    /* ШИРИНА И ОТСТУПЫ */
    width: calc(100% - 30px); /* Вычитаем по 15px с каждой стороны */
    max-width: 500px;         /* Ограничение ширины для больших экранов */
    height: 85vh;             /* 15% свободного места сверху */
    margin-bottom: 20px;      /* ОТСТУП ОТ НИЖНЕГО КРАЯ экрана */
    
    /* ОФОРМЛЕНИЕ */
    background: #f0ebf8;
    border-radius: 24px;      /* Скругляем ВСЕ углы для эффекта карточки */
    overflow: hidden;         /* Чтобы контент не вылезал за скругления */
    
    /* АНИМАЦИЯ */
    transform: translateY(120%); /* Спрятана чуть глубже из-за отступа */
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 0 -5px 25px rgba(0,0,0,0.2);
}
.class-modal.active .class-modal__container { transform: translateY(0); }

.class-modal__accent-bar {
    height: 10px;
    background: #673ab7;
    border-radius: 16px 16px 0 0;
}

.class-modal__header {
    background: #fff;
    margin: 12px 12px 4px;
    padding: 24px 20px;
    border-radius: 8px;
    border: 1px solid #dadce0;
    cursor: pointer;
}

.class-modal__handle {
    width: 36px;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    margin: -12px auto 12px;
}

.class-modal__title {
    font-size: 28px;
    margin: 0;
    color: #202124;
    font-weight: 400;
}

.class-modal__grid {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
}

/* Фикс наложения и отступа */
.class-modal {
    position: fixed;
    inset: 0;
    z-index: 99999 !important; /* Выше чем header и footer */
    display: none;
    align-items: flex-end;
    pointer-events: auto;
}
.class-modal.active { display: flex; }

.class-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1;
}

.class-modal__container {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 85vh; /* 15% сверху свободны */
    background: #f0ebf8;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

.class-modal__accent-bar {
    height: 10px;
    background: #673ab7;
    border-radius: 20px 20px 0 0;
}

.class-modal__header {
    background: #fff;
    margin: 10px 10px 5px;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #dadce0;
    text-align: center;
    touch-action: none; /* Важно для корректного свайпа */
}

.class-modal__handle {
    width: 40px;
    height: 4px;
    background: #ddd;
    margin: -10px auto 10px;
    border-radius: 2px;
}

.class-modal__grid {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    -webkit-overflow-scrolling: touch;
}

/* Стили карточек */
.class-card, .task-card {
    background: #fff;
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 12px;
    border: 1px solid #dadce0;
    display: block;
    text-decoration: none;
    color: #333;
}