@charset "UTF-8";

/*
 * Шапка сайта и её элементы
 *
 * Файл выделен из общего style.css: правило для одной зоны ответственности.
 */

header {
    min-height: 8vh;
    padding: 0 4%;
    border-bottom: white 1px solid;
}

.main-header {
    position: fixed; 
    top: 0;
    left: 0;
    width: 100%;
    height: 80px; /* Высота шапки */
    z-index: 1000; 
    
    /* УБИРАЕМ черный фон, шапка теперь прозрачная. 
       Нам нужен только градиент под ней */
    background: transparent; 
    border: none;
}

.header-fade {
    position: fixed;
    top: 0; 
    left: 0;
    width: 100%;
    height: 230px;
    z-index: 999; 
    pointer-events: none; 
    
    /* ЭФФЕКТ SCRIM: Идеально гладкая кривая затухания без единого видимого стыка */
    background: linear-gradient(to bottom,
        rgba(0, 0, 0, 1.00) 0%,
        rgba(0, 0, 0, 0.98) 15%,
        rgba(0, 0, 0, 0.93) 28%,
        rgba(0, 0, 0, 0.85) 40%,
        rgba(0, 0, 0, 0.74) 52%,
        rgba(0, 0, 0, 0.61) 63%,
        rgba(0, 0, 0, 0.47) 73%,
        rgba(0, 0, 0, 0.33) 82%,
        rgba(0, 0, 0, 0.20) 90%,
        rgba(0, 0, 0, 0.09) 96%,
        rgba(0, 0, 0, 0.00) 100%
    );
}

/* На внутренних страницах контент начинается сразу под шапкой — фейд короче */
.header-fade--short {
    height: 110px;
}

.header-container {
    /* Убрали max-width, теперь он растягивается на всю ширину экрана */
    margin: 0 auto;
    padding: 0 4%; /* Отступы по бокам 4%, чтобы прилипало к краям */
    height: 100%; 
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* --- ЛОГОТИП --- */
.header-logo {
    font-size: 26px;
    font-weight: 900;
    color: #ffffff;
    text-decoration: none;
    letter-spacing: -1px;
    display: flex;
    align-items: center;
    text-transform: lowercase;
}

.header-logo span {
    color: #cc1d1d;
}

/* --- НАВИГАЦИЯ --- */
.header-nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #a5a5a5;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: color 0.2s ease;
    position: relative;
    padding: 10px 0;
}

/* base.css задаёт color: white всем элементам — иконке возвращаем цвет ссылки */
.nav-link svg,
.nav-link svg * {
    color: inherit;
}

.nav-link svg {
    flex-shrink: 0;
    opacity: 0.85;
}

.nav-link:hover svg,
.nav-link.active svg {
    opacity: 1;
}

.nav-link:hover {
    color: #ffffff;
}

.nav-link.active {
    color: #ffffff;
    font-weight: 700;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #cc1d1d;
    border-radius: 2px;
}

/* --- ПОИСК И ВХОД --- */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-form {
    position: relative;
    display: flex;
    align-items: center;

    /* Поле и выпадающий список — одна палитра и одна ширина */
    --search-surface: #101012;
    --search-outline: rgba(255, 255, 255, 0.08);
    --search-radius: 14px;
    /*
     * Развёрнутое поле занимает свободное место в шапке и не задевает меню.
     * 760px — логотип, меню, кнопка «Войти» и отступы.
     */
    --search-expanded-width: clamp(220px, calc(100vw - 760px), 560px);
    /* Список подсказок шире поля: он раскрывается поверх меню, как обычный дропдаун */
    --search-panel-width: min(560px, calc(100vw - 32px));
}

.search-input {
    background-color: var(--search-surface);
    border: 1px solid var(--search-outline);
    color: white;
    padding: 10px 40px 10px 16px; 
    border-radius: var(--search-radius);
    font-size: 14px;
    width: 220px;
    outline: none;
    transition: width 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
    font-family: inherit;
}

.search-input::placeholder {
    color: #8b8b90;
}

/* По фокусу поле разворачивается до ширины списка подсказок */
.search-input:focus {
    border-color: rgba(255, 255, 255, 0.16);
    width: var(--search-expanded-width);
}

.search-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.2s;
}

.search-input:focus + .search-btn,
.search-btn:hover {
    color: #ffffff;
}

/*===================================================================================================================
    Подсказки поиска
===================================================================================================================*/
.search-results {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: var(--search-panel-width);
    max-width: calc(100vw - 32px);
    max-height: 70vh;
    overflow-y: auto;
    padding: 6px;
    border-radius: var(--search-radius);
    border: 1px solid var(--search-outline);
    background-color: var(--search-surface);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
    z-index: 1100;
    /* Своя полоса прокрутки вместо белой системной */
}

.search-results::-webkit-scrollbar {
    width: 8px;
}

.search-results::-webkit-scrollbar-track {
    margin: 10px 0;
    background-color: transparent;
}

.search-results::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.22);
}

.search-results::-webkit-scrollbar-thumb:hover {
    background-color: rgba(204, 29, 29, 0.65);
}

.search-results[hidden] {
    display: none;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 10px;
}

.search-item:hover,
.search-item.is-active {
    background-color: rgba(255, 255, 255, 0.06);
}

.search-item-link {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    padding: 4px;
    border-radius: 8px;
    text-decoration: none;
}

/* Строка франшизы над обычной выдачей: это <button>, а не <a> — возвращаем виду ссылки */
.search-item--group .search-item-link {
    border: 0;
    background: none;
    color: inherit;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.search-item--group .search-item-link:hover .search-title {
    color: #ff6b6b;
}

.search-group-arrow {
    flex-shrink: 0;
    margin-right: 2px;
    font-size: 20px;
    line-height: 1;
    color: #8b8b90;
}

/* Разделитель между строкой франшизы и обычным списком */
.search-divider {
    height: 1px;
    margin: 4px 8px 8px;
    background-color: rgba(255, 255, 255, 0.12);
}

.search-poster {
    width: 40px;
    height: 56px;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 6px;
    background-color: #1b1b1e;
}

.search-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.search-title {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: 12px;
    color: #8b8b90;
}

/* Оценка — как звёздочка на карточках каталога */
.search-score {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
    font-weight: 700;
    color: #f5c518;
}

.search-score::before {
    content: '\2605';
    font-size: 10px;
}

.search-sub {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-watch {
    height: 30px;
    padding: 0 10px;
    gap: 6px;
    font-size: 12px;
    border-radius: 8px;
    flex-shrink: 0;
}

.search-watch .play-icon {
    font-size: 12px;
}

.search-fav {
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 8px;
    background: transparent;
    flex-shrink: 0;
}

.search-fav:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.search-more {
    width: 100%;
    margin-top: 4px;
    padding: 10px;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: none;
    color: #a5a5a5;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.search-more:hover {
    color: #ffffff;
}

.search-state {
    padding: 14px 10px;
    font-size: 13px;
    color: #8b8b90;
    text-align: center;
}

.btn-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background-color: #cc1d1d;
    color: #ffffff;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

/* base.css задаёт color: white всем элементам — иконке возвращаем наследование */
.btn-login svg,
.btn-login svg * {
    color: inherit;
}

.btn-login:hover {
    background-color: #e52e2e;
    transform: scale(1.05);
}

.btn-login:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/*===================================================================================================================
    Вход и регистрация
===================================================================================================================*/
.btn-login.is-authed {
    background-color: rgba(204, 29, 29, 0.18);
    color: #ff6b6b;
}

.btn-login.is-authed:hover {
    background-color: rgba(204, 29, 29, 0.32);
}

/*===================================================================================================================
    Панель «Жанры»
===================================================================================================================*/
.header-nav {
    position: relative;
}

.nav-link.is-open,
.nav-link[data-genres-link]:hover {
    color: #ffffff;
}

.genres-panel {
    position: absolute;
    top: calc(100% + 18px);
    left: 0;
    width: min(560px, calc(100vw - 32px));
    max-height: 70vh;
    overflow-y: auto;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background-color: #101012;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
    z-index: 1100;
}

.genres-panel-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Чип жанра: и в панели шапки, и на странице подборки */
.genre-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.04);
    color: #d5d5d7;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.genre-chip:hover {
    border-color: rgba(204, 29, 29, 0.42);
    background-color: rgba(204, 29, 29, 0.16);
    color: #ffffff;
}

.genre-chip.is-active {
    border-color: #cc1d1d;
    background-color: #cc1d1d;
    color: #ffffff;
    font-weight: 600;
}

.genre-chip-count {
    font-size: 11px;
    font-weight: 500;
    color: #8b8b90;
}

.genre-chip:hover .genre-chip-count,
.genre-chip.is-active .genre-chip-count {
    color: rgba(255, 255, 255, 0.75);
}

.genres-panel-footer {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.genres-panel-all {
    font-size: 13px;
    color: #a5a5a5;
    text-decoration: none;
    transition: color 0.2s ease;
}

.genres-panel-all:hover {
    color: #ffffff;
}

.genres-panel-state {
    padding: 10px 4px;
    font-size: 13px;
    color: #8b8b90;
    text-align: center;
}

/*===================================================================================================================
    Пункт «Ещё» и его список разделов
===================================================================================================================*/
.nav-more {
    position: relative;
    display: flex;
    align-items: center;
}

/* Это <button>, а не <a>: обнуляем оформление, вид — как у пункта меню */
.nav-more-btn {
    border: 0;
    background: none;
    font-family: inherit;
    cursor: pointer;
}

/* base.css задаёт color: white каждому элементу — подписи возвращаем цвет пункта */
.nav-more-btn span {
    color: inherit;
}

.nav-more-btn svg,
.nav-more-btn svg * {
    color: inherit;
}

.nav-more-chevron {
    flex-shrink: 0;
    opacity: 0.85;
    transition: transform 0.2s ease;
}

.nav-more-btn:hover .nav-more-chevron,
.nav-more-btn.active .nav-more-chevron {
    opacity: 1;
}

.nav-more-btn[aria-expanded="true"] {
    color: #ffffff;
}

.nav-more-btn[aria-expanded="true"] .nav-more-chevron {
    transform: rotate(180deg);
}

.nav-more-panel {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    width: 220px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    background-color: #101012;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
    z-index: 1100;
}

.nav-more-panel[hidden] {
    display: none;
}

.nav-more-list {
    display: grid;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-more-link {
    display: block;
    padding: 10px 12px;
    border-radius: 9px;
    color: #d5d5d7;
    font-size: 14px;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.nav-more-link:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.nav-more-link.is-active {
    background-color: rgba(204, 29, 29, 0.16);
    color: #ff6b6b;
}

/* Те же разделы внутри мобильной панели-меню — на десктопе не нужны */
.header-more-inline {
    display: none;
}

/*===================================================================================================================
    Кнопка меню
===================================================================================================================*/
.header-burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 38px;
    height: 38px;
    padding: 0 9px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.header-burger:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.header-burger span {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background-color: #ffffff;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.header-burger[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.header-burger[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.header-burger[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/*===================================================================================================================
    Узкие экраны: пункты меню уезжают в выпадающую панель
===================================================================================================================*/
@media (max-width: 1024px) {
    .header-container {
        gap: 10px;
    }

    .header-logo {
        flex-shrink: 0;
    }

    /* Пунктов меню в строке больше нет — они живут в панели под шапкой */
    .header-nav {
        position: fixed;
        top: 74px;
        left: 4%;
        right: 4%;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        max-height: calc(100vh - 96px);
        overflow-y: auto;
        padding: 10px;
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 16px;
        background-color: #101012;
        box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
        z-index: 1090;
    }

    .main-header.is-menu-open .header-nav {
        display: flex;
    }

    .nav-link {
        padding: 12px 14px;
        border-radius: 10px;
        font-size: 15px;
    }

    .nav-link:hover {
        background-color: rgba(255, 255, 255, 0.06);
    }

    /* Подчёркивание активного пункта в панели смотрится лишним — подсвечиваем плашкой */
    .nav-link.active::after {
        display: none;
    }

    .nav-link.active {
        background-color: rgba(204, 29, 29, 0.16);
        color: #ff6b6b;
    }

    /* Жанры внутри панели раскрываются на месте, а не отдельным поповером */
    .genres-panel {
        position: static;
        width: auto;
        max-height: none;
        padding: 4px 0 8px;
        border: none;
        border-radius: 0;
        background-color: transparent;
        box-shadow: none;
        overflow: visible;
    }

    .header-burger {
        display: flex;
    }

    /* Поиск забирает свободное место между логотипом и кнопками */
    .header-actions {
        flex: 1;
        min-width: 0;
        justify-content: flex-end;
        gap: 8px;
    }

    .search-form {
        flex: 1;
        min-width: 0;
    }

    .search-input,
    .search-input:focus {
        width: 100%;
        min-width: 0;
    }

    /* Подсказки во всю ширину экрана: поле узкое, список должен остаться читаемым */
    .search-results {
        position: fixed;
        top: 74px;
        left: 4%;
        right: 4%;
        width: auto;
        max-width: none;
    }

    .btn-login {
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }

    /* Пункт «Ещё» на узких экранах уезжает в основную панель-меню */
    .nav-more {
        display: none;
    }

    .header-more-inline {
        display: block;
        margin-top: 4px;
        padding-top: 6px;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }

    .header-more-inline .nav-more-link {
        padding: 12px 14px;
        font-size: 15px;
    }
}

@media (max-width: 640px) {
    .header-logo {
        font-size: 22px;
    }

    /* На телефоне каждый пиксель на счету: поджимаем кнопку входа, поиск остаётся на месте */
    .btn-login {
        width: 34px;
        height: 34px;
    }

    /* В подсказках важнее название тайтла, чем кнопки — они и так открываются по клику */
    .search-results .search-watch,
    .search-results .search-fav {
        display: none;
    }
}
