/* ==========================================================================
   Плагин «Фильтры каталога»: панель над списком аниме (animefilter/panel.tpl)
   Цвета и радиусы — токены из style.css
   ========================================================================== */

.af{position:relative;margin:0 0 22px;display:flex;flex-direction:column;gap:12px}
.af__toggle,.af__sheet-head,.af__sheet-foot{display:none}

.af__panel{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.af__groups{display:flex;flex-wrap:wrap;gap:8px;flex:1 1 auto;min-width:0}

/* Кнопка-выпадашка */
.af-dd{position:relative}
.af-dd__btn{display:inline-flex;align-items:center;gap:6px;height:40px;padding:0 12px 0 16px;border-radius:999px;background:var(--surface);border:1px solid var(--line);color:var(--text);font:600 14px/1 var(--font-body);cursor:pointer;list-style:none;user-select:none;white-space:nowrap;transition:border-color .2s,background .2s}
.af-dd__btn::-webkit-details-marker{display:none}
.af-dd__btn::marker{content:''}
.af-dd__btn .icon{width:16px;height:16px;color:var(--muted);transition:transform .2s}
.af-dd__btn:hover{border-color:var(--accent)}
.af-dd[open]>.af-dd__btn{border-color:var(--accent);background:var(--raise)}
.af-dd[open]>.af-dd__btn .icon{transform:rotate(180deg)}
.af-dd__n{display:inline-grid;place-items:center;min-width:20px;height:20px;padding:0 6px;border-radius:999px;background:var(--accent);color:#fff;font-size:12px;font-weight:700}
.af-dd__n:empty{display:none}

.af-dd__menu{position:absolute;left:0;top:calc(100% + 8px);z-index:60;width:max-content;min-width:220px;max-width:min(320px,calc(100vw - 32px));max-height:min(420px,70vh);overflow:auto;padding:10px;background:var(--surface);border:1px solid var(--line);border-radius:var(--r-card);box-shadow:var(--shadow-menu);overscroll-behavior:contain}
.af-dd--wide .af-dd__menu{width:min(640px,calc(100vw - 32px));max-width:none}
.af-dd__hint{margin-top:8px;color:var(--muted);font-size:12px}

/* Список вариантов */
.af-list{display:flex;flex-direction:column;gap:2px}
.af-list--cols{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:2px 10px}
.af-list--pills{flex-direction:row;flex-wrap:wrap;gap:6px}
.af-dd__menu .af-list--pills{flex-wrap:nowrap}
.af-opt{display:flex;align-items:center;gap:10px;min-height:36px;padding:6px 10px;border-radius:var(--r-ui);cursor:pointer;font-size:14px;color:var(--text);line-height:1.25}
.af-opt:hover{background:var(--raise)}
.af-opt input{appearance:none;-webkit-appearance:none;flex:none;width:18px;height:18px;margin:0;border:1.5px solid var(--line);border-radius:5px;background:var(--surface-sunk);display:grid;place-items:center;cursor:pointer;transition:background .15s,border-color .15s}
.af-opt input[type=radio]{border-radius:50%}
.af-opt input::after{content:'';width:9px;height:5px;border:2px solid #fff;border-top:0;border-right:0;transform:rotate(-45deg) translate(1px,-1px);opacity:0}
.af-opt input[type=radio]::after{width:8px;height:8px;border:0;border-radius:50%;background:#fff;transform:none}
.af-opt input:checked{background:var(--accent);border-color:var(--accent)}
.af-opt input:checked::after{opacity:1}
.af-opt input:focus-visible{outline:2px solid var(--accent-2);outline-offset:2px}
.af-opt input:checked+span{font-weight:700}
.af-opt[hidden]{display:none}
.af-opt--pill{padding:0}
.af-opt--pill input{position:absolute;opacity:0;width:1px;height:1px}
.af-opt--pill span{display:inline-block;padding:8px 16px;border-radius:999px;background:var(--surface-sunk);border:1px solid var(--line);font-weight:600}
.af-opt--pill:hover{background:none}
.af-opt--pill:hover span{border-color:var(--accent)}
.af-opt--pill input:checked+span{background:var(--accent);border-color:var(--accent);color:#fff}
.af-opt--pill input:focus-visible+span{outline:2px solid var(--accent-2);outline-offset:2px}

/* Поиск жанра */
.af-find{position:relative;display:block;margin-bottom:8px}
.af-find .icon{position:absolute;left:12px;top:50%;width:16px;height:16px;margin-top:-8px;color:var(--muted)}
.page .af-find input,.af-find input{width:100%;min-height:38px;height:38px;padding:0 12px 0 36px;border-radius:999px;background:var(--surface-sunk);border:1px solid var(--line);color:var(--text);font:500 14px var(--font-body)}

/* Годы */
.af-years{display:flex;align-items:center;gap:8px;min-width:240px}
.af-years label{flex:1}
.af-years__dash{color:var(--muted)}
.page .af-years select,.af-years select{min-height:40px;padding:6px 10px}
.af-quick{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}
.af-quick:empty{display:none}
.af-quick button{padding:6px 12px;border-radius:999px;border:1px solid var(--line);background:var(--surface-sunk);color:var(--text);font:600 13px var(--font-body);cursor:pointer}
.af-quick button:hover{border-color:var(--accent)}

/* Сортировка */
.af-sort{display:inline-flex;align-items:center;gap:8px;margin-left:auto;color:var(--muted);font-size:14px;white-space:nowrap}
.page .af-sort select,.af-sort select{width:auto;min-height:40px;height:40px;padding:0 34px 0 14px;border-radius:999px;background:var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%239C97B8' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 12px center;border:1px solid var(--line);color:var(--text);font:600 14px var(--font-body);appearance:none;-webkit-appearance:none;cursor:pointer}

/* Выбранное */
.af__state{display:flex;flex-wrap:wrap;align-items:center;gap:8px;min-height:32px}
.af__count{color:var(--muted);font-size:14px;margin-right:4px}
.af__count:empty{display:none}
.af__count b{color:var(--text)}
.af__chips{display:contents}
.af-chip{display:inline-flex;align-items:center;gap:6px;padding:5px 8px 5px 12px;border-radius:999px;background:var(--accent-soft);border:1px solid rgba(255,79,123,.4);color:var(--text);font:600 13px/1.2 var(--font-body);cursor:pointer}
.af-chip span[aria-hidden]{display:grid;place-items:center;width:18px;height:18px;border-radius:50%;font-size:15px;line-height:1;color:var(--accent)}
.af-chip:hover{border-color:var(--accent)}
.af__reset{font-size:13px;font-weight:600;color:var(--accent-2)}

/* Загрузка */
#dle-content{transition:opacity .2s}
#dle-content.af-loading{opacity:.45;pointer-events:none}

/* Пусто */
.af-empty{grid-column:1/-1;padding:48px 20px;text-align:center;background:var(--surface);border:1px dashed var(--line);border-radius:var(--r-card)}
.af-empty__title{font:700 18px/1.3 var(--font-head);margin-bottom:8px}
.af-empty__text{color:var(--muted);margin-bottom:18px}

/* ---------- Телефон: кнопка «Фильтры» и шторка снизу ---------- */
@media (max-width:860px){
	.af__toggle{display:inline-flex;align-self:flex-start;align-items:center;gap:8px;height:42px;padding:0 18px;border-radius:999px;background:var(--surface);border:1px solid var(--line);color:var(--text);font:700 14px var(--font-body);cursor:pointer}
	.af__toggle .icon{width:18px;height:18px}
	.af__badge{display:inline-grid;place-items:center;min-width:20px;height:20px;padding:0 6px;border-radius:999px;background:var(--accent);color:#fff;font-size:12px}
	.af__badge:empty{display:none}

	.af__panel{position:fixed;left:0;right:0;bottom:0;z-index:120;max-height:88vh;display:flex;flex-direction:column;flex-wrap:nowrap;align-items:stretch;gap:0;padding:0;background:var(--surface);border-radius:18px 18px 0 0;border-top:1px solid var(--line);box-shadow:0 -20px 60px rgba(0,0,0,.6);transform:translateY(105%);visibility:hidden;transition:transform .25s ease,visibility 0s .25s}
	.af.is-open .af__panel{transform:none;visibility:visible;transition:transform .25s ease}
	.af.is-open::before{content:'';position:fixed;inset:0;z-index:119;background:rgba(10,8,20,.6)}
	.af__sheet-head{display:flex;align-items:center;justify-content:space-between;padding:14px 16px 10px;border-bottom:1px solid var(--line)}
	.af__sheet-title{font:700 17px var(--font-head)}
	.af__close{display:grid;place-items:center;width:40px;height:40px;border:0;border-radius:50%;background:var(--raise);cursor:pointer}
	.af__groups{flex:1 1 auto;flex-direction:column;flex-wrap:nowrap;gap:0;overflow:auto;padding:4px 16px;overscroll-behavior:contain}
	.af-dd{border-bottom:1px solid var(--line)}
	.af-dd__btn{display:flex;width:100%;height:52px;padding:0;border:0;border-radius:0;background:none;font-size:15px}
	.af-dd__btn .icon{margin-left:auto}
	.af-dd__n{order:2}
	.af-dd[open]>.af-dd__btn{background:none}
	.af-dd__menu,.af-dd--wide .af-dd__menu{position:static;width:auto;min-width:0;max-width:none;max-height:none;overflow:visible;padding:0 0 12px;background:none;border:0;box-shadow:none}
	.af-list--cols{grid-template-columns:repeat(2,minmax(0,1fr))}
	.af-dd__menu .af-list--pills{flex-wrap:wrap}
	.af-sort{margin:0;padding:12px 16px;border-top:1px solid var(--line);justify-content:space-between}
	.af__sheet-foot{display:flex;gap:10px;padding:12px 16px calc(12px + env(safe-area-inset-bottom));border-top:1px solid var(--line)}
	.af__sheet-foot .btn{flex:1}
	html.af-lock{overflow:hidden}
}

@media (prefers-reduced-motion:reduce){
	.af__panel,#dle-content{transition:none!important}
}
