/* =========================================
   HEADER (Умная шапка - Premium UI FINAL)
   ========================================= */

/* 1. ГЛОБАЛЬНЫЕ ФИКСЫ (Убиваем белые дыры от старых стилей base.css) */
body { padding-top: 0 !important; }
main { margin-top: 0 !important; padding-top: 0 !important; }

/* 2. БАЗА ШАПКИ */
.header {
  position: sticky; /* Шапка в потоке, мобильное меню толкает контент вниз */
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background-color: #191d32;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.header.scrolled {
  background-color: rgba(25, 29, 50, 0.98);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* 3. КОНТЕЙНЕР (Железобетонная сетка) */
.header__container {
  width: 100%;
  max-width: 1340px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  height: 90px;
  transition: height 0.3s ease;
  position: relative; 
  flex-wrap: wrap;
}
.header.scrolled .header__container { height: 65px; }

/* 4. ЛОГОТИП (Жестко прижат влево) */
.header__logo { 
  flex: 0 0 auto; /* Запрещаем сжимать логотип! */
  margin-right: auto; /* Магия: отталкивает меню и правые кнопки вправо */
  max-width: 230px; 
  display: flex; 
  align-items: center; 
  z-index: 20; 
}
.header__logo a { display: block; width: 100%; min-width: 110px; }
.header__logo img { width: 100%; height: 100%; object-fit: contain; max-height: 50px; transition: max-height 0.3s ease; }
.header.scrolled .header__logo img { max-height: 40px; }

/* --- ГЛАВНОЕ МЕНЮ --- */
.header__nav { 
  flex: 1 1 auto;
  display: flex; 
  justify-content: center; 
  height: 100%; 
}
.header__nav .menu.flex { display: flex; align-items: center; gap: 20px; color: #fff; height: 100%; }

/* Делаем ВСЕ пункты меню (li) одинаково отцентрованными по вертикали */
.header__nav .menu.flex > li {
  display: flex;
  align-items: center;
  height: 100%;
}

.header__nav .menu.flex > li > a { 
  display: flex;          /* Делаем текст и стрелочку единым целым */
  align-items: center;
  gap: 6px;               /* Отступ до стрелочки */
  position: relative; 
  padding: 10px 0; 
  font-weight: 600; 
  font-size: 15px; 
  text-transform: uppercase; 
  letter-spacing: 0.5px; 
  transition: color 0.3s ease;
  white-space: nowrap; 
}
.header__nav .menu.flex > li > a::before { 
  content: ""; position: absolute; bottom: 0; right: 0; width: 0; height: 2px; 
  background: #00d26a; transition: width 0.3s ease; 
}
.header__nav .menu.flex > li > a:hover::before { left: 0; right: auto; width: 100%; }
.header__nav .menu.flex > li > a:hover { color: #00d26a; }

/* Подменю (Dropdowns) */
.menu-item-has-children { position: relative; cursor: pointer; }

/* Выравниваем треугольник (без vertical-align) */
.menu-item-has-children > a::after {
  content: ""; 
  display: block; 
  border-top: 5px solid; border-right: 4px solid transparent; border-left: 4px solid transparent;
  transition: transform 0.3s ease; opacity: 0.7; color: #fff;
}

.header__nav .sub-menu { 
  position: absolute; top: 100%; left: 50%; transform: translate(-50%, 15px); 
  z-index: 10; min-width: 220px; background-color: #191d32; 
  border: 1px solid rgba(255,255,255,0.05); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  visibility: hidden; opacity: 0; pointer-events: none; transition: all 0.3s ease;
}

/* Эффекты открытия */
.menu-item-has-children.active > a::after,
.menu-item-has-children:hover > a::after { transform: rotate(180deg); }

.menu-item-has-children.active .sub-menu,
.menu-item-has-children:hover .sub-menu { 
  visibility: visible; opacity: 1; transform: translate(-50%, 0); pointer-events: auto; 
}

.header__nav .sub-menu li a { font-size: 15px; font-weight: 500; color: #fff; padding: 10px 20px; display: block; transition: all 0.2s; white-space: normal; }
.header__nav .sub-menu li a:hover { background-color: rgba(255,255,255,0.05); color: #00d26a; }

/* ========================================================
   СЕКРЕТНЫЙ КЛАСС: Скрываем меню по клику даже при ховере
   ======================================================== */
.menu-item-has-children.force-close .sub-menu,
.header__actions-lang.force-close .dropdown__content {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translate(-50%, 15px) !important;
}
.menu-item-has-children.force-close > a::after,
.header__actions-lang.force-close > a svg {
    transform: rotate(0deg) !important;
}
/* 6. БЛОК ДЕЙСТВИЙ (Жестко прижат вправо) */
.header__actions { 
  flex: 0 0 auto; /* Запрещаем сжиматься правым кнопкам */
  margin-left: auto; /* Магия: отталкивается от меню и логотипа влево */
  display: flex; align-items: center; height: 100%; gap: 20px; 
}

/* Кнопка LIVE */
.header__live-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background-color: #00d26a; color: #ffffff !important; padding: 8px 16px; 
  border-radius: 50px; font-weight: 700; font-size: 14px; text-transform: uppercase;
  transition: all 0.3s ease; position: relative; z-index: 20; white-space: nowrap;
}
.header__live-btn:hover { background-color: #00b359; transform: translateY(-1px); }
.header__live-btn .live-indicator { display: block; width: 8px; height: 8px; background-color: #fff; border-radius: 50%; position: relative; }
.header__live-btn .live-indicator::after {
  content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 100%; height: 100%; background-color: #fff; border-radius: 50%;
  animation: live-pulse 1.5s infinite ease-out;
}
@keyframes live-pulse { 0% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; } 100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; } }

/* ПОИСК */
.header__actions-search { display: flex; align-items: center; position: static; }
.header__actions-search-toggle { background: transparent; border: none; cursor: pointer; display: flex; z-index: 20; position: relative; padding: 0; }
.header__actions-search-toggle svg.show { width: 22px; height: 22px; fill: #fff; transition: fill 0.3s; }
.header__actions-search-toggle:hover svg.show { fill: #00d26a; }
.header__actions-search-toggle svg.close { display: none; width: 24px; height: 24px; color: #fff; }
.header__actions-search.active .header__actions-search-toggle svg.show { display: none; }
.header__actions-search.active .header__actions-search-toggle svg.close { display: block; }

.header__actions-search .search-block { 
  position: absolute; top: 0; left: 160px; right: 200px; height: 100%; 
  background-color: #191d32; z-index: 15; display: flex; align-items: center; justify-content: center; padding: 0 30px; 
  visibility: hidden; opacity: 0; transform: translateY(-5px); transition: all 0.3s ease; 
}
.header__actions-search.active .search-block { visibility: visible; opacity: 1; transform: translateY(0); }
.header__actions-search .search-block form { width: 100%; max-width: 600px; display: flex; align-items: center; border-bottom: 1px solid rgba(255,255,255,0.2); transition: border-color 0.3s; }
.header__actions-search .search-block form:focus-within { border-bottom-color: #00d26a; }
.header__actions-search .search-block input { width: 100%; background: transparent; color: #fff; font-size: 18px; padding: 5px 10px; }
.header__actions-search .search-block input::placeholder { color: rgba(255,255,255,0.4); }
.header__actions-search .search-block button { color: #fff; padding: 5px; cursor: pointer; }
.header__actions-search .search-block button svg { width: 20px; height: 20px; fill: #fff; transition: fill 0.3s; }
.header__actions-search .search-block button:hover svg { fill: #00d26a; }

/* =========================================
   ЯЗЫКИ (Premium UI - Финал)
   ========================================= */
.header__actions-lang { 
    position: relative; 
    display: flex; 
    align-items: center; 
    height: 100%; 
    cursor: pointer; 
    z-index: 20; 
}

.header__actions-lang > a { 
    display: flex; 
    align-items: center; 
    color: #fff; 
    font-size: 16px; 
    font-weight: 600; 
    gap: 6px; 
    transition: color 0.3s; 
}

.header__actions-lang:hover > a { 
    color: #00d26a; 
}

.header__actions-lang > a svg { 
    width: 12px; 
    transition: transform 0.3s ease; 
    fill: #fff; 
}

/* Сам выпадающий блок */
.header__actions-lang .dropdown__content { 
    display: block !important; /* Убиваем любой display: none из старых файлов */
    position: absolute !important; 
    top: 100% !important; /* Строго под шапкой */
    left: 50% !important; 
    transform: translateX(-50%) !important; 
    background-color: #191d32; 
    min-width: 65px; 
    border-radius: 0 0 6px 6px; 
    border: 1px solid rgba(255, 255, 255, 0.05); 
    border-top: none; 
    box-shadow: 0 10px 20px rgba(0,0,0,0.2); 
    
    /* Скрыто по умолчанию */
    visibility: hidden; 
    opacity: 0; 
    pointer-events: none; 
    transition: all 0.3s ease !important;
    margin-top: 0 !important;
}

/* Невидимый мостик, чтобы мышка не соскальзывала на ПК */
.header__actions-lang .dropdown__content::before { 
    content: ''; 
    position: absolute; 
    top: -15px; 
    left: 0; 
    width: 100%; 
    height: 15px; 
    background: transparent; 
}

/* --- МАГИЯ ОТКРЫТИЯ (ПК - hover, Мобилка - активный класс от JS) --- */
.header__actions-lang:hover .dropdown__content,
.header__actions-lang.active .dropdown__content { 
    visibility: visible; 
    opacity: 1; 
    pointer-events: auto; 
}

.header__actions-lang:hover > a svg,
.header__actions-lang.active > a svg { 
    transform: rotate(180deg) !important; 
}

/* Ссылки внутри языков */
.header__actions-lang .dropdown__content-item a { 
    display: block; 
    color: #fff; 
    font-size: 14px; 
    font-weight: 500; 
    text-align: center; 
    padding: 12px 0; 
    transition: all 0.3s; 
}

.header__actions-lang .dropdown__content-item a:hover { 
    background-color: rgba(255,255,255,0.05); 
    color: #00d26a; 
}
/* 7. БУРГЕР И МОБИЛЬНОЕ МЕНЮ */
.header__toggle { 
  flex: 0 0 auto;
  margin-left: 20px; /* Отступ от блока действий */
  cursor: pointer; width: 30px; display: none; align-items: center; justify-content: center; z-index: 20;
}
.header__toggle-wrap { width: 30px; height: 20px; display: block; position: relative; }
.header__toggle-inner, .header__toggle-inner::before, .header__toggle-inner::after { position: absolute; width: 30px; height: 3px; border-radius: 3px; background-color: #fff; transition: all 0.3s ease; }
.header__toggle-inner { top: 50%; left: 0; margin-top: -1.5px; }
.header__toggle-inner::before { content: ""; top: -8px; }
.header__toggle-inner::after { content: ""; bottom: -8px; }

.header__toggle.active .header__toggle-inner { background-color: transparent; }
.header__toggle.active .header__toggle-inner::before { top: 0; transform: rotate(45deg); }
.header__toggle.active .header__toggle-inner::after { bottom: 0; transform: rotate(-45deg); }

/* Само меню-аккордеон */
.header__mobile { 
  display: block; width: 100%; background: #191d32; 
  max-height: 0; overflow: hidden; transition: max-height 0.4s ease-in-out; 
}
.header__mobile.active { 
  max-height: 80vh; border-top: 1px solid rgba(255,255,255,0.05); overflow-y: auto; 
}
.header__mobile .header__nav { display: block; padding: 15px 20px; border: none; }
.header__mobile .menu.flex { flex-direction: column; align-items: flex-start; gap: 0; }
.header__mobile .menu.flex > li { width: 100%; border-bottom: 1px solid rgba(255,255,255,0.05); }
.header__mobile .menu.flex > li > a { display: block; padding: 15px 0; font-size: 16px; font-weight: 500; white-space: normal; }

.header__mobile .sidebar__socials { padding: 20px; background: rgba(0,0,0,0.15); display: none; }
.header__mobile .sidebar__socials h3 { color: #fff; font-size: 14px; margin-bottom: 15px; opacity: 0.7;}
.header__mobile .sidebar__socials-list { display: flex; gap: 10px; }
.header__mobile .sidebar__socials-items img { width: 30px; height: 30px; filter: invert(1); opacity: 0.7; }

/* --- 8. АДАПТИВНОСТЬ --- */
@media (max-width: 1280px) { 
  .header__container { height: 60px; } 
  .header.scrolled .header__container { height: 60px; }
  .header__nav { display: none; } /* Скрываем меню на ПК для планшетов */
  .header__toggle { display: flex; } /* Показываем бургер */
  .header__actions-search .search-block { left: 100px; right: 100px; }
  .header__mobile .sidebar__socials { display: block; }
}
/* =========================================
   УБИЙЦА ЗАЛИПАНИЙ НА МОБИЛЬНЫХ (HOVER FIX) + АККОРДЕОН KTF
   ========================================= */

@media (max-width: 1024px) {
    /* 1. ЖЕСТКО ОТКЛЮЧАЕМ HOVER НА ТЕЛЕФОНАХ */
    .header__actions-lang:hover .dropdown__content,
    .menu-item-has-children:hover .sub-menu {
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
    }
    
    .header__actions-lang:hover > a svg,
    .menu-item-has-children:hover > a::after {
        transform: none;
    }

    /* 2. РАЗРЕШАЕМ ОТКРЫТИЕ ТОЛЬКО ПО КЛИКУ (Через класс .active от JS) */
    .header__actions-lang.active .dropdown__content {
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
    
    .header__actions-lang.active > a svg {
        transform: rotate(180deg) !important;
    }

    /* =========================================
       3. ДИЗАЙН МОБИЛЬНОЙ ГАРМОШКИ (КАК У KTF)
       ========================================= */
    
    /* Убираем жирную зеленую линию ПК-версии */
    .header__mobile .menu.flex > li > a::before { 
        display: none !important; 
    }

    /* Заставляем Ссылку и Подменю идти строго друг под другом */
    .header__mobile .menu-item-has-children {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        width: 100% !important;
    }
    
    /* Раздвигаем Текст и Плюсик строго в одну линию по краям */
    .header__mobile .menu-item-has-children > a { 
        display: flex !important; 
        flex-direction: row !important;
        justify-content: space-between !important; 
        align-items: center !important;
        width: 100% !important; 
    }
    
    /* Рисуем аккуратный ПЛЮСИК (+) справа */
    .header__mobile .menu-item-has-children > a::after {
        content: '+' !important;
        display: inline-flex !important; /* Исправляет падение на новую строку */
        border: none !important;
        font-size: 22px !important; /* Сделали поменьше и аккуратнее */
        font-weight: 400 !important;
        color: #fff !important;
        transform: none !important;
        opacity: 1 !important;
        margin-left: 10px !important;
        line-height: 1 !important;
    }
    
    /* Рисуем зеленый МИНУСИК (-) при открытии */
    .header__mobile .menu-item-has-children.active > a::after {
        content: '-' !important;
        font-size: 28px !important;
        color: #00d26a !important;
        line-height: 1 !important;
    }

    /* Само выпадающее подменю (Выезжает ровно вниз!) */
    .header__mobile .sub-menu {
        position: relative !important; /* Строго под ссылкой, а не абсолютом сбоку */
        top: auto !important;
        left: 0 !important; /* Убили центрирование от ПК-версии */
        transform: none !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        width: 100% !important;
        min-width: 100% !important;
        padding: 0 0 0 15px !important; /* Лесенка (отступ слева) */
        margin: 0 !important;
        
        /* Скрытое состояние */
        max-height: 0;
        overflow: hidden;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        transition: max-height 0.4s ease-in-out, opacity 0.3s ease !important;
    }

    /* Открытое состояние (Аккордеон поехал вниз) */
    .header__mobile .menu-item-has-children.active .sub-menu {
        max-height: 600px;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        margin-top: 5px !important;
        margin-bottom: 10px !important;
    }

    /* Дизайн внутренних ссылок подменю */
    .header__mobile .sub-menu li { 
        width: 100% !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important; 
    }
    .header__mobile .sub-menu li:last-child { 
        border-bottom: none !important; 
    }
    .header__mobile .sub-menu li a { 
        padding: 10px 0 !important; 
        font-size: 14px !important; 
        color: rgba(255, 255, 255, 0.7) !important; 
        text-transform: none !important; 
        display: block !important;
    }
    .header__mobile .sub-menu li a:hover { 
        color: #00d26a !important; 
        background: transparent !important; 
    }
    /* Прячем старую лупу поиска в верхней панели */
    .header__actions-search {
        display: none !important;
    }

    /* Разрешаем шапке растягиваться */
    .header__container {
        height: auto !important;
        min-height: 60px; 
        flex-wrap: wrap !important;
        align-content: flex-start !important;
    }

    /* === МАГИЯ ЦЕНТРИРОВАНИЯ === */
    .header__logo,
    .header__actions,
    .header__toggle {
        height: 60px !important; 
    }

    /* 3. Мобильное меню: на весь экран и толкает контент */
    .header__mobile {
        position: static !important; /* Встраиваем в поток документа! (ВАЖНО) */
        
        /* Растягиваем на весь экран, компенсируя padding в 20px у контейнера */
        width: calc(100% + 40px) !important; 
        margin-left: -20px !important;
        margin-right: -20px !important;
        padding: 0 20px !important; /* Возвращаем отступы для текста внутри */
        
        box-sizing: border-box !important;
        transform: none !important;
        box-shadow: none !important;
        
        /* Плавное разворачивание */
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease-in-out;
    }

    /* Состояние открытого меню */
    .header__mobile.active {
        max-height: 1200px !important; /* Большой запас для меню + поиска */
        padding-bottom: 30px !important;
        border-top: 1px solid rgba(255,255,255,0.05);
    }

    /* 4. Стили для нового поиска внутри меню */
    .mobile-search {
        margin: 20px 0 10px 0;
        width: 100%;
    }
    .mobile-search form {
        display: flex;
        align-items: center;
        border-bottom: 1px solid rgba(255,255,255,0.2);
        padding-bottom: 5px;
        transition: border-color 0.3s;
    }
    .mobile-search form:focus-within {
        border-bottom-color: #00d26a;
    }
    .mobile-search input {
        width: 100%;
        background: transparent;
        border: none;
        color: #fff;
        font-size: 16px;
        padding: 10px 5px;
        outline: none;
    }
    .mobile-search input::placeholder {
        color: rgba(255,255,255,0.4);
    }
    .mobile-search button {
        background: transparent;
        border: none;
        color: #fff;
        cursor: pointer;
        padding: 5px;
    }
    .mobile-search button svg {
        width: 20px;
        height: 20px;
        fill: #fff;
    }
}



@media (max-width: 768px) {
  .header__actions { gap: 15px; }
  .header__actions-search .search-block { left: 0; right: 50px; padding: 0 15px; }
}

@media (max-width: 576px) {
  .header__logo { max-width: 120px; }
  .header__logo a { min-width: 90px; }
  .header__live-btn { padding: 6px 12px; font-size: 13px; gap: 6px;}
  .header__toggle { margin-left: 15px; }
}


/* =========================================
   FOOTER (Подвал - Premium)
   ========================================= */
.footer {
  background-color: #191d32; /* Возвращаем глубокий фирменный сине-черный */
  color: #a0a5b1; /* Мягкий серый для читаемости */
  padding: 45px 20px;
  font-size: 14px;
  position: relative;
}

/* Элегантная градиентная линия сверху (Синий -> Зеленый) */
.footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #314cba 0%, #009b4d 100%);
}

.footer__container {
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center; /* Центрируем всё по вертикали */
  flex-wrap: wrap;
  gap: 30px;
}

.footer__logo img {
  max-width: 150px;
  height: auto;
  transition: opacity 0.3s ease;
}

.footer__logo:hover img {
  opacity: 0.8;
}

.footer__info {
  flex: 1; /* Занимает всё свободное пространство по центру */
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 50px; /* Отступы от логотипа и правой колонки */
  border-left: 1px solid rgba(255, 255, 255, 0.05); /* Тончайший разделитель */
  line-height: 1.5;
}

.footer__info p {
  margin: 0;
}

.footer__info a {
  color: #ffffff; /* Ссылки делаем белыми */
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.footer__info a:hover {
  color: #009b4d; /* Зеленый акцент при наведении */
}

.footer__copyright {
  color: #ffffff;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 8px !important;
  letter-spacing: 0.5px;
}

.footer__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 20px;
}

.socials-list {
  display: flex;
  gap: 12px;
}

/* Оформляем иконки в аккуратные кружочки */
.social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  transition: all 0.3s ease;
}

.social-icon img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  filter: brightness(0) invert(1); 
}

.social-icon:hover {
  background-color: #314cba;
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(49, 76, 186, 0.4);
}

/* Премиальная кнопка */
.footer__btn {
  background-color: #314cba;
  color: #ffffff;
  border: none;
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.footer__btn:hover {
  background-color: #112767;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(17, 39, 103, 0.4);
}

/* Адаптив */
@media (max-width: 1024px) {
  .footer__container {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }
  .footer__info {
    padding: 20px 0;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }
  .footer__right {
    align-items: center;
  }
}