/* ==========================================
   КАТАЛОГ АНИМЕ — дополнения поверх style_fanfics.css
   ========================================== */

/* ========== Герой-баннер каталога аниме ========== */
.anime-hero {
    position: relative;
    padding: 54px 40px 42px;
    height: 320px;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    background:
        /* Затемнение должно бесшовно уходить в фон страницы.
           Цвет #d0e12 — ровно body из style_base.css. Раньше тут стоял
           #111111, из-за чего внизу баннера оставалась светлая полоса. */
        linear-gradient(180deg, rgba(13, 14, 18, .10) 0%, rgba(13, 14, 18, .72) 62%, rgba(13, 14, 18, .96) 86%, #0d0e12 100%),
        url('/static/images/anime-hero.avif') center/cover no-repeat;
    overflow: hidden;
}

.anime-hero-inner {
    max-width: 1600px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
    position: relative;
    text-align: left;
    margin-left: 60px;
}

.anime-hero-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 77, 109, .14);
    border: 1px solid rgba(255, 77, 109, .5);
    color: #ff8fa3;
}

.anime-hero-icon svg {
    width: 18px;
    height: 18px;
}

.anime-hero-text h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    color: #fff;
    line-height: 1.1;
}

.anime-hero-text p {
    margin: 4px 0 0;
    font-size: 13px;
    color: #b98a94;
}

/* Расширенная полоска поиска 1:1 как в каталоге манги */
.anime-page .anime-search,
.anime-page .mg-search,
.anime-page .fanfic-search-bar {
    gap: 10px;
    flex: 1.6;
    min-width: 380px;
    position: relative;
    display: flex;
    align-items: center;
    background: #1d1e24;
    border: 1px solid #2c2e36;
    border-radius: 14px;
    padding: 0 18px;
    height: 50px;
    transition: border-color .25s ease, box-shadow .25s ease, background .25s ease;
}

.anime-page .anime-search:focus-within,
.anime-page .mg-search:focus-within,
.anime-page .fanfic-search-bar:focus-within {
    border-color: rgba(255, 77, 109, .65) !important;
    box-shadow: 0 0 0 4px rgba(255, 77, 109, .12) !important;
    background: #20212a !important;
}

.anime-page .anime-search svg,
.anime-page .mg-search svg,
.anime-page .fanfic-search-bar svg {
    width: 18px;
    height: 18px;
    color: #7a7d87;
    flex-shrink: 0;
    transition: color .25s;
}

.anime-page .anime-search:focus-within svg,
.anime-page .mg-search:focus-within svg,
.anime-page .fanfic-search-bar:focus-within svg {
    color: #ff4d6d !important;
}

.anime-page .anime-search input,
.anime-page .mg-search input,
.anime-page .fanfic-search-bar input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    height: 100%;
    padding: 0;
    font-size: 15px;
    font-family: 'MyCustomFont';
}

.anime-page .anime-search input::placeholder,
.anime-page .mg-search input::placeholder,
.anime-page .fanfic-search-bar input::placeholder {
    color: #5d6068;
}

.anime-page .anime-search .search-clear,
.anime-page .mg-search .search-clear,
.anime-page .fanfic-search-bar .search-clear {
    background: none;
    border: none;
    color: #7a7d87;
    cursor: pointer;
    font-size: 15px;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .15s, transform .15s;
}

.anime-page .anime-search .search-clear:hover,
.anime-page .mg-search .search-clear:hover,
.anime-page .fanfic-search-bar .search-clear:hover {
    color: #ff4d6d !important;
    transform: scale(1.15);
}

/* Адаптив — высота баннера и поиск как в манге */
@media (max-width: 900px) {
    .anime-hero {
        height: 240px;
        padding: 34px 20px 30px;
    }

    .anime-hero-inner {
        margin-left: 16px;
        gap: 12px;
    }

    .anime-hero-icon {
        width: 32px;
        height: 32px;
        border-radius: 8px;
    }

    .anime-hero-icon svg {
        width: 16px;
        height: 16px;
    }

    .anime-hero-text h1 {
        font-size: 20px;
    }

    .anime-hero-text p {
        font-size: 12px;
    }

    .anime-page .fanfic-search-bar {
        min-width: 100%;
        flex: 1 1 100%;
    }
}

@media (max-width: 768px) {
    .anime-hero {
        height: auto !important;
        min-height: 180px !important;
        padding: 20px 14px 18px !important;
    }

    .anime-hero-inner {
        margin-left: 0 !important;
        gap: 12px !important;
        width: 100% !important;
    }

    .anime-hero-icon {
        width: 32px !important;
        height: 32px !important;
        border-radius: 8px !important;
    }

    .anime-hero-icon svg {
        width: 16px !important;
        height: 16px !important;
    }

    .anime-hero-text h1 {
        font-size: 20px !important;
    }

    .anime-hero-text p {
        font-size: 12px !important;
        margin-top: 4px !important;
    }

    .anime-page {
        padding: 14px 12px 24px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .anime-page .fanfic-topbar-wrap {
        margin-bottom: 12px !important;
        width: 100% !important;
    }

    /* Топбар как в каталоге манги: строка с переносом, а не колонка.
       При flex-direction: column правило flex: 1 1 100% применяется к ВЫСОТЕ
       (flex-basis 100% от неопределённой высоты контейнера), и поисковая
       строка схлопывалась до 20px вместо 46px. */
    .anime-page .fanfic-topbar {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 8px !important;
        width: 100% !important;
    }

    .anime-page .anime-search,
    .anime-page .mg-search,
    .anime-page .fanfic-search-bar {
        min-width: 0 !important;
        width: 100% !important;
        flex: 1 1 100% !important;
        height: 46px !important;
        padding: 0 14px !important;
        border-radius: 14px !important;
    }

    .anime-page .fanfic-topbar-btns {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
        overflow-x: auto !important;
        padding-bottom: 4px !important;
        scrollbar-width: none !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .anime-page .fanfic-topbar-btns::-webkit-scrollbar {
        display: none !important;
    }

    .anime-page .topbar-btn {
        height: 38px !important;
        padding: 0 12px !important;
        font-size: 12px !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }

    .anime-page .catalog-view-switcher {
        height: 38px !important;
        flex-shrink: 0 !important;
    }

    .anime-page .rm-wrap,
    .anime-page #rm-trigger {
        height: 38px !important;
        flex-shrink: 0 !important;
    }
}

/* Панель с 8 колонками: компактнее + скролл, если не влезает */
.anime-page .fp-columns {
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
}

.anime-page .filters-panel {
    max-height: 74vh;
    overflow-y: auto;
}

.anime-page .filters-panel::-webkit-scrollbar {
    width: 6px;
}

.anime-page .filters-panel::-webkit-scrollbar-thumb {
    background: #3a3d46;
    border-radius: 3px;
}

.anime-page .ff-card {
    cursor: pointer;
}

/* Бейдж оценки */
.ff-score {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 8px;
    background: rgba(13, 14, 17, 0.90);
    border: 1px solid rgba(255, 255, 255, .08);
}

.ff-score svg {
    width: 12px;
    height: 12px;
}

.ff-score.high {
    color: #4ade80;
}

.ff-score.mid {
    color: #fbbf24;
}

.ff-score.low {
    color: #f87171;
}

.ff-score.none {
    color: #8b8e98;
}

/* Тип тайтла внизу постера */
.ff-type {
    position: absolute;
    left: 10px;
    bottom: 10px;
    z-index: 2;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: #ffd3db;
    background: rgba(13, 14, 17, 0.90);
    border: 1px solid rgba(255, 77, 109, .5);
    padding: 3px 9px;
    border-radius: 999px;
}

/* Кнопка 'Для вас' в топбаре (1:1 как в До и как в манге) */
#btn-recs {
    background: #1d1e24;
    border: 1px solid #2c2e36;
    color: #e6edf3;
}

#btn-recs svg {
    color: #00adb5;
    transition: transform .2s ease;
}

#btn-recs:hover {
    background: #23252d;
    border-color: #00adb5;
    color: #fff;
    box-shadow: 0 0 14px rgba(0, 173, 181, 0.25);
}

#btn-recs.active {
    background: #00adb5 !important;
    border-color: #00adb5 !important;
    color: #0d0e12 !important;
    font-weight: 800 !important;
    box-shadow: 0 0 18px rgba(0, 173, 181, 0.5) !important;
}

#btn-recs.active svg {
    color: #0d0e12 !important;
}


/* Recommendations badge and reason */
.ff-match {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(255, 46, 77, 0.92);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    z-index: 2;
    letter-spacing: 0.3px;
}
.ff-reason {
    color: var(--accent-color, #ff4d6d);
    font-size: 11px;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

