/* ============================================
   ФИЛЬТРЫ ИНВЕНТАРЯ — панель категорий + сайдбар.
   Общий стиль для inventory.html / create-offer.html / create-supertrade.html.
   Перенесено из inventory.html (было только там) — единая точка правды.
   ============================================ */

/* ===== ТУЛБАР: ПОИСК + ПЛОТНОСТЬ СЕТКИ + СОРТИРОВКА ===== */
.toolbar {
    display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
    background: #141414; border: 1px solid #232323; border-radius: 16px; padding: 6px 8px;
}
.toolbar__search-wrap { position: relative; flex: 1; min-width: 200px; display: flex; align-items: center; }
.toolbar__search-icon { position: absolute; left: 10px; color: #666; pointer-events: none; }
.toolbar__search {
    width: 100%; background: transparent; border: none;
    padding: 8px 10px 8px 32px; color: #E8E8E8; font-size: 0.85rem; font-family: inherit;
}
.toolbar__search:focus { outline: none; }
.toolbar__search::placeholder { color: #666; }
.toolbar__divider { width: 1px; align-self: stretch; margin: 6px 0; background: #262626; flex-shrink: 0; }
.toolbar__actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.grid-density-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; background: #1A1A1A; border: none; border-radius: 8px;
    color: #999; cursor: pointer; transition: all 0.15s;
}
.grid-density-btn:hover { color: #E8E8E8; background: #232323; }
.grid-density-btn svg { width: 17px; height: 17px; }

.sort-price-btn {
    display: flex; align-items: center; gap: 6px;
    background: #1A1A1A; border: none; padding: 8px 12px; border-radius: 8px;
    color: #999; cursor: pointer; transition: color 0.15s, background 0.15s;
    font-size: 0.85rem; font-family: inherit; font-weight: 600; white-space: nowrap;
}
.sort-price-btn:hover { color: #E8E8E8; background: #232323; }
.sort-price-btn svg {
    transition: transform 0.3s ease; width: 16px; height: 16px;
    fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round;
}
.sort-price-btn.desc svg { transform: rotate(0deg); }
.sort-price-btn.asc svg { transform: rotate(180deg); }
.sort-price-btn.active { color: #00E599; background: #1A1A1A; border: none; }

/* ===== РЯД КАТЕГОРИЙ ===== */
.category-bar {
    display: flex; align-items: flex-start; gap: 0; flex-wrap: wrap; position: relative;
    margin-bottom: 16px;
    background: #141414; border: 1px solid #232323; border-radius: 16px; padding: 4px 5px;
}
.category-btn-wrap { position: relative; }
.category-btn {
    display: inline-flex; align-items: center; gap: 2px;
    background: transparent; border: 1px solid transparent; border-radius: 12px;
    padding: 5px 1px; color: #999; font-size: 0.74rem; font-weight: 500;
    cursor: pointer; transition: border-color 0.18s, color 0.18s, background 0.18s, box-shadow 0.18s;
    font-family: inherit; white-space: nowrap;
}
.category-btn:hover { border-color: #2A2A2A; color: #E8E8E8; background: #1B1B1B; }
.category-btn.open { border-color: #00E599; color: #00E599; box-shadow: 0 0 0 1px #00E599; background: #1B1B1B; }
.category-chevron { opacity: 0.6; flex-shrink: 0; transition: transform 0.18s; }
.category-btn.open .category-chevron { transform: rotate(180deg); opacity: 1; }
.category-btn.chip {
    border-color: #00E599; color: #00E599; padding-right: 10px;
    background: linear-gradient(135deg, rgba(0, 229, 153, 0.16), rgba(0, 229, 153, 0.05));
    box-shadow: 0 0 16px rgba(0, 229, 153, 0.12);
    animation: chipIn 0.18s ease;
}
@keyframes chipIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
.category-icon-badge {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 32px; flex-shrink: 0; border-radius: 8px;
    background: transparent;
}
.category-icon--svg { width: 37px; height: 23px; flex-shrink: 0; color: #00E599; }
.category-icon--img {
    position: absolute; inset: 0; margin: auto;
    width: 36px; height: 28px; object-fit: contain; flex-shrink: 0;
}
.chip-remove {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; border-radius: 50%; margin-left: 2px;
    font-size: 0.85rem; line-height: 1; opacity: 0.75; transition: all 0.15s;
}
.chip-remove:hover { opacity: 1; background: rgba(255, 51, 85, 0.18); color: #FF3355; }
.clear-all-btn {
    display: inline-flex; align-items: center; gap: 4px;
    background: rgba(255, 138, 0, 0.1); border: 1px solid rgba(255, 138, 0, 0.5); color: #FF8A00;
    border-radius: 12px; padding: 8px 13px; font-size: 0.8rem; font-weight: 600;
    cursor: pointer; font-family: inherit; white-space: nowrap; transition: all 0.18s;
}
.clear-all-btn:hover { background: rgba(255, 138, 0, 0.18); border-color: #FF8A00; }

.category-dropdown {
    position: absolute; top: calc(100% + 10px); left: 0; z-index: 60;
    background: #161616; border: 1px solid #2A2A2A; border-radius: 16px;
    padding: 8px 0; width: 250px; max-height: 340px; overflow-y: auto;
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(0, 229, 153, 0.08);
    animation: dropdownIn 0.16s ease;
    scrollbar-width: thin; scrollbar-color: rgba(0, 229, 153, 0.45) transparent;
}
.category-dropdown::-webkit-scrollbar { width: 5px; }
.category-dropdown::-webkit-scrollbar-track { background: transparent; }
.category-dropdown::-webkit-scrollbar-thumb { background: rgba(0, 229, 153, 0.45); border-radius: 4px; }
.category-dropdown::-webkit-scrollbar-thumb:hover { background: rgba(0, 229, 153, 0.75); }
@keyframes dropdownIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.category-dropdown__item {
    display: flex; align-items: center; gap: 10px; padding: 8px 16px;
    font-size: 0.82rem; color: #CCC; cursor: pointer; user-select: none;
    transition: background 0.15s ease, color 0.15s ease;
}
.category-dropdown__item:hover { background: rgba(255, 255, 255, 0.045); color: #E8E8E8; }
.category-dropdown__item.select-all { font-weight: 600; color: #E8E8E8; border-bottom: 1px solid #262626; padding-bottom: 10px; margin-bottom: 4px; }
.model-icon { width: 36px; height: 28px; object-fit: contain; flex-shrink: 0; }
.other-icon-badge { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 16px; flex-shrink: 0; }
.other-icon-badge svg { width: 18px; height: 14px; color: #00E599; }
.other-icon-badge img { position: absolute; inset: 0; margin: auto; width: 20px; height: 15px; object-fit: contain; }

/* ===== КАСТОМНЫЕ ЧЕКБОКСЫ (везде в фильтрах) ===== */
/* order + margin-left:auto — чекбокс визуально последним, у правого края;
   в DOM остаётся первым внутри <label>, семантика/доступность не меняются. */
.category-dropdown__item input[type="checkbox"] {
    appearance: none; -webkit-appearance: none; position: relative;
    width: 16px; height: 16px; border-radius: 5px; flex-shrink: 0;
    background: #0F0F0F; border: 1.5px solid #383838; cursor: pointer;
    transition: all 0.15s; margin: 0 0 0 auto; order: 2;
}
.category-dropdown__item input[type="checkbox"]:hover { border-color: #00E599; }
.category-dropdown__item input[type="checkbox"]:checked {
    background: #00E599; border-color: #00E599;
}
.category-dropdown__item input[type="checkbox"]:checked::after {
    content: ''; position: absolute; left: 5px; top: 1px; width: 4px; height: 8px;
    border: solid #0A0A0A; border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* Строки сайдбара — круглый индикатор вместо квадратного чекбокса (плоский список, как в референсе) */
.sidebar-checkbox input[type="checkbox"] {
    appearance: none; -webkit-appearance: none; position: relative;
    width: 15px; height: 15px; border-radius: 50%; flex-shrink: 0;
    background: transparent; border: 1.5px solid #3A3A3A; cursor: pointer;
    transition: all 0.15s; margin: 0 0 0 auto;
}
.sidebar-checkbox input[type="checkbox"]:hover { border-color: #00E599; }
.sidebar-checkbox input[type="checkbox"]:checked {
    background: #00E599; border-color: #00E599;
}
.sidebar-checkbox input[type="checkbox"]:checked::after {
    content: ''; position: absolute; left: 4.5px; top: 1px; width: 3.5px; height: 7px;
    border: solid #0A0A0A; border-width: 0 1.6px 1.6px 0; transform: rotate(45deg);
}

/* ===== ОБЁРТКА: САЙДБАР + СЕТКА ===== */
.inventory-layout { display: flex; align-items: flex-start; gap: 20px; }
/* Без своего max-height/скролла — сайдбар растёт на полную высоту контента
   (как и .items-column), длинные раскрытые секции скроллятся сами (см.
   .sidebar-section[data-section="stickers"/"charms"] ниже), страница скроллится целиком. */
.filters-sidebar {
    width: 252px; flex-shrink: 0; display: flex; flex-direction: column;
}
.items-column { flex: 1; min-width: 0; }

/* Заголовок — теперь первая строка внутри той же карточки (sidebar-sections-group),
   не отдельный плавающий блок над ней; border-bottom тот же приём, что отделяет
   друг от друга сами секции-аккордеоны ниже. */
.filters-sidebar__title {
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 15px; border-bottom: 1px solid #232323;
}
.filters-sidebar__title span { font-size: 1.05rem; font-weight: 700; color: #F2F2F2; }
.sidebar-reset-link {
    background: none; border: none; color: #666; font-size: 0.74rem; font-weight: 600;
    cursor: pointer; font-family: inherit; padding: 4px 6px; border-radius: 6px; transition: all 0.15s;
}
.sidebar-reset-link:hover { color: #FF3355; background: rgba(255, 51, 85, 0.08); }

.sidebar-sections-group {
    margin-bottom: 10px; flex-shrink: 0;
    background: #141414; border: 1px solid #232323; border-radius: 16px; overflow: hidden;
}
.sidebar-section { transition: background 0.2s; }
.sidebar-section:not(:last-child) { border-bottom: 1px solid #232323; }
.sidebar-section:has(.sidebar-checkbox input:checked) { background: rgba(0, 229, 153, 0.03); }
.sidebar-section__header {
    width: 100%; display: flex; align-items: center; justify-content: space-between;
    background: transparent; border: none; padding: 13px 15px; color: #E8E8E8;
    font-size: 0.83rem; font-weight: 700; cursor: pointer; font-family: inherit;
    letter-spacing: 0.2px;
}
.sidebar-section__label { text-transform: uppercase; font-size: 0.76rem; letter-spacing: 0.6px; color: #B8B8B8; }
.section-badge {
    display: inline-flex; align-items: center; justify-content: center; min-width: 17px; height: 17px;
    padding: 0 4px; border-radius: 9px; background: #00E599; color: #0A0A0A;
    font-size: 0.66rem; font-weight: 800; margin-left: 2px; vertical-align: middle;
}
.sidebar-section__chevron { color: #666; transition: transform 0.25s ease; display: inline-flex; }
.sidebar-section.open .sidebar-section__chevron { transform: rotate(180deg); color: #00E599; }
/* Плавная высота через grid-template-rows 0fr→1fr — не требует измерения высоты в JS. */
.sidebar-section__body-wrap {
    display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.25s ease;
}
.sidebar-section.open .sidebar-section__body-wrap { grid-template-rows: 1fr; }
.sidebar-section__body { overflow: hidden; min-height: 0; padding: 0 15px; }
.sidebar-section.open .sidebar-section__body { padding: 0 15px 14px; }

/* Наклейки/брелки — списки могут быть длинными (десятки уникальных имён),
   поэтому вместо бесконечного роста секции ограничиваем высоту и даём
   внутренний скролл — тот же тонкий зелёный скролл, что у .category-dropdown. */
.sidebar-section[data-section="stickers"].open .sidebar-section__body,
.sidebar-section[data-section="charms"].open .sidebar-section__body {
    max-height: 520px; overflow-y: auto;
    scrollbar-width: thin; scrollbar-color: rgba(0, 229, 153, 0.45) transparent;
}
.sidebar-section[data-section="stickers"] .sidebar-section__body::-webkit-scrollbar,
.sidebar-section[data-section="charms"] .sidebar-section__body::-webkit-scrollbar { width: 5px; }
.sidebar-section[data-section="stickers"] .sidebar-section__body::-webkit-scrollbar-track,
.sidebar-section[data-section="charms"] .sidebar-section__body::-webkit-scrollbar-track { background: transparent; }
.sidebar-section[data-section="stickers"] .sidebar-section__body::-webkit-scrollbar-thumb,
.sidebar-section[data-section="charms"] .sidebar-section__body::-webkit-scrollbar-thumb { background: rgba(0, 229, 153, 0.45); border-radius: 4px; }
.sidebar-section[data-section="stickers"] .sidebar-section__body::-webkit-scrollbar-thumb:hover,
.sidebar-section[data-section="charms"] .sidebar-section__body::-webkit-scrollbar-thumb:hover { background: rgba(0, 229, 153, 0.75); }

.rarity-group-label { font-size: 0.66rem; color: #666; letter-spacing: 0.6px; margin: 12px 0 6px; text-transform: uppercase; font-weight: 700; }
.rarity-group-label:first-child { margin-top: 0; }
.sidebar-checkbox {
    display: flex; align-items: center; gap: 9px; padding: 6px 0;
    font-size: 0.8rem; color: #C4C4C4; cursor: pointer; user-select: none; transition: color 0.15s;
}
.sidebar-checkbox:hover { color: #F0F0F0; }
.rarity-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.price-range-inputs { display: flex; gap: 8px; }
.price-range-inputs input {
    width: 50%; background: #0C0C0C; border: 1px solid #2A2A2A; border-radius: 10px;
    padding: 8px 11px; color: #E8E8E8; font-size: 0.78rem; font-family: inherit; transition: border-color 0.15s;
}
.price-range-inputs input:focus { outline: none; border-color: #00E599; box-shadow: 0 0 0 3px rgba(0, 229, 153, 0.1); }
.price-range-inputs input::placeholder { color: #555; }

/* ===== ТУМБЛЕРЫ (секция "Дополнительно") — тот же паттерн, что в settings.html ===== */
.toggle-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 7px 0; font-size: 0.8rem; color: #C4C4C4; cursor: pointer; user-select: none;
}
.toggle-switch { position: relative; display: inline-block; width: 38px; height: 21px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-switch .slider {
    position: absolute; cursor: pointer; inset: 0; background: #2A2A2A;
    border-radius: 34px; transition: background 0.2s;
}
.toggle-switch .slider::before {
    content: ''; position: absolute; height: 15px; width: 15px; left: 3px; top: 3px;
    background: #E8E8E8; border-radius: 50%; transition: transform 0.2s;
}
.toggle-switch input:checked + .slider { background: #00E599; }
.toggle-switch input:checked + .slider::before { transform: translateX(17px); background: #0A0A0A; }

.float-slider-wrap { position: relative; height: 20px; margin-bottom: 10px; }
.float-slider-track {
    position: absolute; top: 8px; left: 0; width: 100%; height: 4px;
    background: #262626; border-radius: 4px;
}
.float-slider-fill {
    position: absolute; top: 8px; height: 4px; border-radius: 4px;
    background: linear-gradient(90deg, #00E599, #00ffaa); box-shadow: 0 0 10px rgba(0, 229, 153, 0.5);
}
.float-slider-wrap input[type="range"] {
    position: absolute; top: 6px; left: 0; width: 100%; height: 8px; margin: 0;
    -webkit-appearance: none; appearance: none; background: transparent; pointer-events: none;
}
.float-slider-wrap input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: transparent; }
.float-slider-wrap input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; pointer-events: auto; width: 15px; height: 15px; border-radius: 50%;
    background: #fff; border: 3px solid #00E599; margin-top: -5.5px; cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); transition: transform 0.15s;
}
.float-slider-wrap input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
.float-slider-wrap input[type="range"]::-moz-range-thumb {
    pointer-events: auto; width: 15px; height: 15px; border-radius: 50%;
    background: #fff; border: 3px solid #00E599; cursor: pointer; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.float-slider-wrap input[type="range"]::-moz-range-track { height: 4px; background: transparent; border: none; }

.reset-filters-btn {
    background: #141414; border: 1px solid #2A2A2A; color: #888;
    border-radius: 14px; padding: 12px; font-size: 0.78rem; font-weight: 700;
    letter-spacing: 0.5px; cursor: pointer; font-family: inherit; transition: all 0.18s;
    flex-shrink: 0;
}
.reset-filters-btn:hover { border-color: #FF3355; color: #FF3355; background: rgba(255, 51, 85, 0.06); }

@media (max-width: 900px) {
    .inventory-layout { flex-direction: column; }
    .filters-sidebar { width: 100%; }
    /* На узких экранах панель типов не переносится по строкам (что съедало
       бы высоту), а скроллится в один ряд — привычный мобильный паттерн
       для полос категорий. */
    .category-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
    .category-bar::-webkit-scrollbar { height: 5px; }
    .category-bar::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
    .category-btn-wrap { flex-shrink: 0; }
}
