/* app/static/css/style.css
   ver 7.0 (Optimized, Light/Dark Theme, HEX colors, Standardized Units)
*/

/* === ТЕМЫ (Темная по умолчанию) === */
:root {
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --bg-card: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --accent: #4fc3f7;
    --accent-hover: #29b6f6;
    /* текст поверх акцентной заливки (в светлой теме меняется на #fff) */
    --accent-contrast: #000000;
    --success: #66bb6a;
    --warning: #ffa726;
    --error: #ef5350;
    --border: #404040;
    --shadow: 0 2px 8px #0000004d;
    /* рамка вокруг контейнера на широких экранах (body.is-desktop) */
    --bg-frame: #0b0b0b;
}

/* Светлая тема — принудительно (data-theme="light").
   Раньше было: `:root[data-theme="light"], @media (prefers-color-scheme: light) { ... }`
   — список селекторов с @media внутри невалиден, парсер выбрасывал
     всё правило целиком, и светлая тема не применялась никогда. */
:root[data-theme="light"] {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --accent: #007aff;
    --accent-hover: #005bb5;
    --accent-contrast: #ffffff;
    --success: #34c759;
    --warning: #f59e0b;
    --error: #ff3b30;
    --border: #e5e5ea;
    --shadow: 0 2px 8px #0000001a;
    --bg-frame: #e9e9ee;
}

/* Светлая тема — из настроек системы (когда явно не выбрана тёмная) */
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --bg-primary: #f5f5f7;
        --bg-secondary: #ffffff;
        --bg-card: #ffffff;
        --text-primary: #1d1d1f;
        --text-secondary: #86868b;
        --accent: #007aff;
        --accent-hover: #005bb5;
        --accent-contrast: #ffffff;
        --success: #34c759;
        --warning: #f59e0b;
        --error: #ff3b30;
        --border: #e5e5ea;
        --shadow: 0 2px 8px #0000001a;
        --bg-frame: #e9e9ee;
    }
}

/* === БАЗОВЫЕ СТИЛИ === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
    height: var(--tg-viewport-stable-height, 100vh);
    font-size: 1rem;
}

body.is-desktop {
    /* рамка вокруг контейнера 960px — цвет берётся из темы */
    background: var(--bg-frame);
}

/* === ШАПКА === */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3.25rem;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.75rem;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.logo {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--accent);
    display: none;
}

/* Временный SVG-логотип в шапке (index.html, img/logo.svg) */
.header-logo {
    flex-shrink: 0;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

/* SVG-иконки из спрайта (icons.svg): кнопки шапки, сердечки, чипы */
.icon-btn svg,
.bell-btn svg {
    width: 1.375rem;
    height: 1.375rem;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.fav-toggle svg {
    width: 0.875rem;
    height: 0.875rem;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chip-icon {
    width: 0.875rem;
    height: 0.875rem;
    vertical-align: -0.1em;
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 1.5;
}

/* SVG внутри кнопок .btn (Избранное, Пред./След.) */
.btn svg {
    width: 1rem;
    height: 1rem;
    vertical-align: -0.125rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.icon-btn, .menu-toggle {
    background: none;
    border: none;
    font-size: 1.25em;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
    color: var(--text-primary);
}

.menu-toggle {
    color: var(--accent);
}

.icon-btn:hover {
    background: var(--bg-card);
}

/* Поисковая строка */
.search-bar {
    flex: 1;
    position: relative;
    display: flex;
    gap: 0.5rem;
}

.search-bar input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border-radius: 1.5rem;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
    margin-bottom: 0;
    -webkit-appearance: none;
}

.search-bar::before {
    content: '🔍';
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.875rem;
    pointer-events: none;
}

.search-clear {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--border);
    border: none;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.search-clear.visible { display: flex; }

/* Колокольчик */
.bell-btn {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: none;
    border: none;
    font-size: 1.25em;
    cursor: pointer;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    color: var(--text-primary);
}

.bell-dot {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    width: 0.5rem;
    height: 0.5rem;
    background: var(--error);
    border-radius: 50%;
}

/* === БОКОВОЕ МЕНЮ (Sidebar) === */
.sidebar {
    position: fixed;
    top: 3.25rem;
    left: 0;
    bottom: 3.5rem;
    width: 70vw;
    max-width: 320px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    z-index: 90;
    transform: translateX(-100%);
    /* visibility — гарантия скрытия при любом left:
       на широких экранах .sidebar получает left: calc(50% - 30rem),
       и translateX(-100%) сдвигал его всего на свою ширину —
       меню оставалось на виду сразу */
    visibility: hidden;
    transition: transform 0.3s ease, visibility 0.3s ease;
    overflow-y: auto;
    padding: 1rem 1rem 5rem 1rem;
}

@media (min-width: 37.5rem) { .sidebar { width: 50vw; } }
@media (min-width: 56.25rem) { .sidebar { width: 350px; } }

.sidebar.open {
    transform: translateX(0);
    visibility: visible;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: #00000080;
    z-index: 89;
    display: none;
}

.sidebar-overlay.open { display: block; }

.filter-section { margin-bottom: 1.25rem; }

.filter-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.filter-chip {
    padding: 0.5rem 0.75rem;
    border-radius: 1rem;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.75rem;
    border: 1px solid var(--border);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.2s;
}

.filter-chip.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* === КОНТЕНТНАЯ ОБЛАСТЬ === */
.content {
    margin-top: 3.25rem;
    padding: 0.75rem;
    padding-bottom: 4.25rem;
    height: calc(100vh - 3.25rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 56.25rem) { .content { padding: 1rem; } }

/* === НИЖНЯЯ НАВИГАЦИЯ === */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3.5rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

body.is-desktop .bottom-nav .nav-item {
    flex: 0 0 4.5rem;
    min-width: 4.5rem;
    padding-left: 0;
    padding-right: 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
    min-width: 3rem;
}

.nav-item.active { color: var(--accent); }
.nav-item .icon { font-size: 1.5rem; line-height: 1; }

/* SVG-иконки из спрайта (icons.svg) в нижнем меню */
.nav-item .icon svg {
    width: 1.5rem;
    height: 1.5rem;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-badge {
    position: absolute;
    top: 0;
    right: 2px;
    background: var(--error);
    color: #fff;
    font-size: 0.625rem;
    min-width: 1rem;
    height: 1rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    line-height: 1;
}

body.hide-nav .bottom-nav,
body.hide-nav .header { display: none; }
body.hide-nav .content { margin-top: 0; padding-bottom: 1rem; height: 100vh; }

/* === КАТЕГОРИИ === */
.cat-scroll {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding: 0.75rem 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}

.cat-scroll::-webkit-scrollbar { display: none; }
@media (min-width: 56rem) { .cat-scroll { padding: 0.75rem; gap: 0.875rem; } }

.cat-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    min-width: 5rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.cat-chip .cat-img {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-card);
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.cat-chip.active .cat-img { border-color: var(--accent); }

.cat-chip .cat-name {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    max-width: 5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cat-chip.active .cat-name { color: var(--accent); }

/* === СЕТКА ТОВАРОВ === */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    align-items: start;
}

@media (min-width: 37rem) { .product-grid { gap: 0.75rem; } }
@media (min-width: 56rem) { .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.product-card {
    background: var(--bg-card);
    border-radius: 0.75rem;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

/* --- Квадратная обертка для сетки (плиткой) --- */
.product-card .img-wrap {
    position: relative;
    width: 100%;
    padding-top: 100%;
    flex: 0 0 auto;
    overflow: hidden;
    background: var(--bg-secondary);
}

.product-card .img-wrap > img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.product-card:active .img-wrap > img { transform: scale(0.97); }

.product-card .info { padding: 0.5rem 0.75rem; }

.product-card .title {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.product-card .price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
}

.product-card .condition {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Лента — горизонтальная карточка */
.product-grid.list-view {
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.product-grid.list-view .product-card {
    display: flex;
    flex-direction: row;
}

/* --- Сброс квадрата для отображения списком (в строку) --- */
.product-grid.list-view .product-card .img-wrap {
    width: 6rem;
    min-width: 6rem;
    height: 6rem;
    padding-top: 0; /* Обязательно сбрасываем padding */
} /* ДОБАВЛЕНА ЗАКРЫВАЮЩАЯ СКОБКА, КОТОРОЙ НЕ ХВАТАЛО */

.product-grid.list-view .product-card .info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Иконки поверх карточки */
.fav-toggle {
    position: absolute;
    bottom: 0.25rem;
    right: 0.25rem;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: #00000080;
    border: none;
    font-size: 0.8125rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    color: #ffffff;
    transition: transform 0.2s, color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.fav-toggle.active { color: var(--error); transform: scale(1.1); }
.fav-toggle.undo { color: var(--accent); font-size: 1.125rem; }
.fav-toggle:hover { transform: scale(1.15); }

.product-cart-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    width: 1.75rem;
    height: 1.75rem;
    background: var(--success);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    z-index: 10;
    box-shadow: var(--shadow);
}

.product-cart-remove {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    width: 1.75rem;
    height: 1.75rem;
    background: var(--error);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    z-index: 10;
    box-shadow: var(--shadow);
}

/* === КНОПКИ === */
.btn {
    display: inline-block;
    padding: 0.75rem 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    text-align: center;
}

.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-buy { background: #ff9842; color: #000000; }
.btn-buy:hover { background: #e8893a; }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border); }
.btn-danger { background: var(--error); color: #ffffff; }
.btn-full { width: 100%; }

/* === ФОРМЫ === */
input, select, textarea {
    width: 100%;
    padding: 0.75rem 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* Статусы & Системные блоки */
.loading { text-align: center; padding: 2.5rem; color: var(--text-secondary); }
.empty { text-align: center; padding: 3.75rem 20px; color: var(--text-secondary); }
.empty-icon { font-size: 3rem; margin-bottom: 0.75rem; }

/* === ОБЩИЕ КОМПОНЕНТЫ ===
   Единые классы вместо инлайн-копий в tovaroved.html и шаблонах app.js. */
/* Заголовок вкладки/раздела */
.section-title { margin-bottom: 1rem; }
/* Поясняющий текст под заголовком */
.hint-text { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 0.75rem; }
/* Карточка-контейнер (настройки, блоки панели) */
.panel-card { background: var(--bg-card); border-radius: 0.75rem; padding: 1rem; margin-bottom: 0.75rem; }
/* Строка фильтров/кнопок */
.filter-bar { display: flex; gap: 0.375rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
/* Компактная заглушка «Загрузка/Нет данных» */
.empty-state { text-align: center; color: var(--text-secondary); padding: 1.25rem; font-size: 0.8125rem; }
/* Подпись внутри пустого состояния */
.empty-hint { color: var(--text-secondary); margin-top: 0.5rem; }
/* Кнопки в пустом состоянии: первая — с отступом, вторая — на всю ширину */
.empty .btn { margin-top: 1rem; }
.empty .btn + .btn { width: 100%; margin-top: 0.5rem; }
/* Уменьшенная кнопка */
.btn-sm { padding: 0.5rem 12px; font-size: 0.8125rem; }
/* Подсказки автопоиска (город в форме товара и в фильтре каталога) */
.pe-hints {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.375rem;
}
.pe-hints button {
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: 0.5rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    color: var(--text-primary);
    cursor: pointer;
}
.pe-hints button:hover { border-color: var(--accent); }
.pe-hints .pe-hint-note {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    align-self: center;
}
/* Заблокированные списки (до выбора города) */
select:disabled,
input:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
/* Компактное поле ввода (фильтры дат) */
.input-sm {
    padding: 0.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.8125rem;
}
/* Компактный селект (фильтр статусов) */
.select-sm {
    padding: 0.375rem 10px;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.75rem;
}
/* Заголовок h3 внутри карточки */
.panel-card h3 { font-size: 0.875rem; margin-bottom: 0.75rem; }
/* Кнопка-фильтр (панель: период, статус) */
.filter-btn {
    padding: 0.375rem 12px;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.75rem;
    cursor: pointer;
}
.filter-btn.active {
    background: var(--accent);
    color: var(--accent-contrast);
    font-weight: 600;
}
/* Карточка заказа в списке */
.order-card { cursor: pointer; margin-bottom: 0.5rem; }
/* Дата внутри карточки заказа */
.order-date { font-size: 0.75rem; color: var(--text-secondary); }
/* Форма профиля — сами поля наследуют глобальные input/select/textarea */
.form-label {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}
.form-row { display: flex; gap: 0.5rem; }
.form-row .form-group { flex: 1; min-width: 0; }

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}
.status-PENDING { background: var(--warning); color: #000000; }
.status-PAID { background: var(--accent); color: var(--accent-contrast); }
.status-SHIPPED { background: #7e57c2; color: #ffffff; }
.status-COMPLETED { background: var(--success); color: #000000; }
.status-CANCELLED { background: var(--error); color: #ffffff; }

/* === КОРЗИНА === */
.cart-item, .cart-item-row {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: 12px;
    margin-bottom: 0.5rem;
    align-items: center;
}

.cart-item img, .cart-item-row img {
    width: 5rem;
    height: 5rem;
    object-fit: cover;
    border-radius: 8px;
    background: var(--bg-secondary);
}

.cart-item .details, .cart-item-row .details { flex: 1; }
.cart-item .title, .cart-item-row .title { font-weight: 600; margin-bottom: 0.25rem; font-size: 0.875rem; }
.cart-item .controls, .cart-item-row .controls { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.5rem; }

.qty-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1.125rem;
    cursor: pointer;
}

.cart-total {
    padding: 1rem;
    background: var(--bg-card);
    border-radius: 12px;
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-total .amount { font-size: 1.5rem; font-weight: 700; color: var(--accent); }
.cart-icon-wrap { position: relative; display: inline-block; }
.cart-checkbox { width: 1.25rem; height: 1.25rem; accent-color: var(--accent); cursor: pointer; }

.cart-badge { 
    position: absolute; 
    top: -4px; 
    right: -4px; 
    background: var(--error); 
    color: #ffffff; 
    font-size: 0.75rem; 
    font-weight: 700; 
    min-width: 1.25rem; 
    height: 1.25rem; 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}

.cart-delete {
    background: none;
    border: none;
    font-size: 1.125rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    flex-shrink: 0;
    align-self: center;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.cart-delete:hover {
    background: #ef535026;
    color: var(--error);
}

/* === КАТАЛОГ & ФИЛЬТРЫ === */
.product-container { max-width: 90vw; margin: 0 auto; }
.catalog-layout { display: flex; gap: 1rem; }

.filter-sidebar {
    width: 14rem;
    flex-shrink: 0;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1rem;
    position: sticky;
    top: 4.5rem;
    max-height: calc(100vh - 5rem);
    overflow-y: auto;
}

.filter-sidebar h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    transition: background 0.2s;
}

.filter-item:hover { background: var(--bg-secondary); }
.filter-item.active { background: var(--accent); color: var(--accent-contrast); font-weight: 600; }

.filter-count {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    min-width: 1.5rem;
    text-align: center;
}

.filter-item.active .filter-count { background: #00000033; color: var(--accent-contrast); }
.catalog-main { flex: 1; min-width: 0; }

.catalog-toolbar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.catalog-toolbar select {
    padding: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.875rem;
}

@media (max-width: 48rem) {
    .catalog-layout { flex-direction: column; }
    .filter-sidebar { width: 100%; position: static; max-height: none; }
    .filter-sidebar .filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.25rem; }
    .filter-item { padding: 0.5rem 10px; font-size: 0.875rem; }
}

@media (min-width: 48rem) and (orientation: landscape) {
    .filter-sidebar { width: 13rem; }
    .filter-sidebar .filter-grid { display: flex; flex-direction: column; gap: 2px; }
}

/* === КАРУСЕЛЬ И ОПИСАНИЕ === */
.carousel {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
    background: var(--bg-secondary);
}

.carousel-img { width: 100%; height: 18rem; object-fit: cover; display: block; }
.carousel-btn { position: absolute; top: 50%; transform: translateY(-50%); background: #00000080; color: #ffffff; border: none; font-size: 1.25rem; padding: 0.5rem 12px; cursor: pointer; border-radius: 50%; }
.carousel-prev { left: 0.5rem; }
.carousel-next { right: 0.5rem; }

.carousel-zoom {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: #00000080;
    color: #ffffff;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.carousel-dots { position: absolute; bottom: 0.5rem; left: 50%; transform: translateX(-50%); display: flex; gap: 0.25rem; }
.dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: #ffffff66; cursor: pointer; }
.dot.active { background: var(--accent); }

.description { margin-top: 1rem; color: var(--text-secondary); line-height: 1.6; white-space: pre-wrap; font-size: 0.875rem; }

/* === ЛЕНТА (Feed) === */
.feed-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: 12px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.feed-item:hover { background: var(--bg-secondary); }
.feed-item.removing { opacity: 0.4; pointer-events: none; }

.feed-img {
    width: 6rem;
    height: 6rem;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-secondary);
    position: relative;
}

.feed-img img { width: 100%; height: 100%; object-fit: cover; }
.feed-info { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.feed-info .title { font-weight: 600; font-size: 0.875rem; margin-bottom: 0.25rem; }
.feed-info .price { font-size: 1rem; font-weight: 700; color: var(--accent); }
.feed-info .condition { font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.25rem; }

/* === КНОПКИ НАВИГАЦИИ === */
.scroll-top {
    position: fixed;
    bottom: 4.5rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: #4fc3f780;
    color: var(--accent);
    border: 2px solid var(--accent);
    font-size: 1.125rem;
    line-height: 1;
    cursor: pointer;
    display: none;
    z-index: 99;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    -webkit-tap-highlight-color: transparent;
}

.scroll-top.visible { display: flex; align-items: center; justify-content: center; text-align: center; }
.scroll-top:hover { background: #4fc3f799; }

/* Стрелки-кнопки: SVG из спрайта (icons.svg), currentColor наследуется */
.scroll-top svg,
.back-btn svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.back-btn {
    position: fixed;
    bottom: 6rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: #4fc3f780;
    color: var(--accent);
    border: 2px solid var(--accent);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    filter: drop-shadow(0 0 6px #4fc3f780);
    -webkit-tap-highlight-color: transparent;
}

.back-btn.visible { display: flex; }
.back-btn:hover { border-color: var(--accent-hover); filter: drop-shadow(0 0 8px #4fc3f799); }

.view-toggle {
    position: fixed;
    bottom: 5rem;
    right: 4rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    font-size: 1.125rem;
    cursor: pointer;
    z-index: 100;
    box-shadow: var(--shadow);
}

.footer {
    text-align: center;
    padding: 1.25rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
    border-top: 1px solid var(--border);
    margin-top: 1.5rem;
}

/* === LIGHTBOX === */
#lightbox-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: #000000f2;
    z-index: 9999;
    flex-direction: column;
    overscroll-behavior: none;
    touch-action: none;
    -ms-touch-action: none;
}

#lightbox-topbar {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.75rem;
    z-index: 10;
    transition: opacity 0.3s;
}

#lightbox-counter { color: #ffffff; font-size: 0.875rem; }
#lightbox-topbar-btns { display: flex; gap: 0.5rem; }

.lb-btn {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: #00000099;
    border: 1px solid #ffffff4d;
    font-size: 1.25em;
    cursor: pointer;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

#lightbox-scroll {
    position: relative;
    flex: 1;
    overflow: hidden;
    overscroll-behavior: none;
    text-align: center;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
}

#lightbox-scroll img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    touch-action: none;
    cursor: default;
}

body.is-mobile #lightbox-scroll img { will-change: transform; }
body.is-mobile #lightbox-scroll img.is-zoomed { cursor: grab; }
body.is-mobile #lightbox-scroll img.is-zoomed:active { cursor: grabbing; }

body.is-desktop #lightbox-scroll img { transform: none; cursor: default; will-change: auto; }
body.is-desktop #lightbox-scroll { overflow: hidden; }

#desktop-zoom-layer {
    display: none;
    position: absolute;
    z-index: 3;
    background-repeat: no-repeat;
    pointer-events: auto;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    overflow: hidden;
}

#lightbox-bottombar {
    position: absolute;
    bottom: 1.25rem;
    bottom: calc(1.25rem + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 999;
    padding: 0.5rem 16px;
    background: #00000099;
    border-radius: 30px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: opacity 0.3s;
}

#lightbox-scale { color: #ffffffb3; font-size: 0.75rem; min-width: 2rem; text-align: center; }

.lb-nav, .lb-action {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: #ffffff26;
    border: 1px solid #ffffff4d;
    font-size: 1.25em;
    cursor: pointer;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* SVG в кнопках лайтбокса и карусели (icons.svg) */
.lb-btn svg,
.lb-nav svg,
.lb-action svg,
.carousel-btn svg,
.carousel-zoom svg {
    width: 1.25rem;
    height: 1.25rem;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* === ПРОФИЛЬ === */
.profile-menu { padding: 0; }

.profile-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 16px;
    background: var(--bg-card);
    border-radius: 12px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s;
}

.profile-item:active { background: var(--border); }
.profile-item .item-icon { font-size: 1.25em; width: 1.5rem; text-align: center; }
.profile-item .item-arrow { margin-left: auto; color: var(--text-secondary); font-size: 1.125rem; }

.profile-avatar {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    margin: 0 auto 8px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: #ffffff;
}

.profile-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.fav-item-cart { border-color: var(--accent) !important; }

/* === ПЛАТФОРМЕННЫЕ И АДАПТИВНЫЕ СТИЛИ === */

/* Десктоп */
body.is-desktop .content {
    width: 100%;
    max-width: 60rem; /* 960px */
    margin: 0 auto;
    padding: 1rem;
}

/* Группируем шапку и подвал — они ведут себя одинаково */
body.is-desktop .header,
body.is-desktop .bottom-nav {
    width: 100%;
    max-width: 60rem; /* 960px */
    left: 50%;
    right: auto;
    transform: translateX(-50%);
}

/* Специфично для нижнего меню */
body.is-desktop .bottom-nav {
    justify-content: center;
    gap: 1.75rem;
}

/* Привязываем боковое меню к бургеру (по левому краю 960px контейнера) */
@media (min-width: 60rem) {
    body.is-desktop .sidebar {
        width: 350px;
        /* 50% экрана минус половина контейнера (30rem) */
        left: calc(50% - 30rem);
        border-radius: 0 0 12px 12px;
        border-left: 1px solid var(--border);
    }
}

/* Десктопные стили карточек списка */
body.is-desktop .product-grid { grid-auto-rows: max-content; align-items: start; }
body.is-desktop .product-grid.list-view { grid-template-columns: 1fr; gap: 0.75rem; }
body.is-desktop .product-grid.list-view .product-card { display: flex; flex-direction: row; min-height: 12rem; height: 12rem; }
body.is-desktop .product-grid.list-view .product-card .img-wrap { width: 12rem; min-width: 12rem; height: 12rem; padding-top: 0; flex: 0 0 12rem; }
body.is-desktop .product-grid.list-view .product-card .info { flex: 1; display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: 0.75rem 1rem; }
body.is-desktop .product-grid.list-view .product-card .title { height: auto; min-height: 0; margin-bottom: 0.5rem; font-size: 1rem; line-height: 1.3; -webkit-line-clamp: 2; }
body.is-desktop .product-grid.list-view .product-card .price { font-size: 1.25rem; font-weight: 700; color: var(--accent); }

/* Десктопные ховеры и детали */
body.is-desktop .product-card { align-self: start; height: auto; }
body.is-desktop .product-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
body.is-desktop .product-card .info { padding: 0.75rem; }
body.is-desktop .product-card .title { font-size: 0.875rem; height: 2.25rem; min-height: 2.25rem; }
body.is-desktop .product-card .price { font-size: 1rem; }
body.is-desktop .cat-chip:hover .cat-img { border-color: var(--accent); }
body.is-desktop .filter-chip:hover { background: var(--accent); color: #ffffff; }
body.is-desktop .nav-item:hover { color: var(--accent); }
body.is-desktop .profile-item:hover { background: var(--border); }

/* Мобильные устройства */
body.is-mobile .product-card .info { padding: 0.5rem; }
body.is-mobile .product-card .title { font-size: 0.875rem; -webkit-line-clamp: 2; }
body.is-mobile .product-card .price { font-size: 0.875rem; }
body.is-mobile .filter-chip { padding: 0.5rem 0.75rem; font-size: 0.875rem; }
body.is-mobile .cat-chip .cat-img { width: 3.5rem; height: 3.5rem; }
body.is-mobile .cat-chip .cat-name { font-size: 0.75rem; }

/* Скроллбары WebView2 */
body.is-desktop .content::-webkit-scrollbar { width: 0.5rem; }
body.is-desktop .content::-webkit-scrollbar-track { background: var(--bg-secondary); }
body.is-desktop .content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 0.25rem; }
body.is-mobile .content::-webkit-scrollbar { display: none; }

/* === АНИМАЦИИ === */
@keyframes flyToCart {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.5) translate(50px, -50px); opacity: 0.7; }
    100% { transform: scale(0) translate(100px, -100px); opacity: 0; }
}
.fly-to-cart { animation: flyToCart 0.5s ease-in forwards; }

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(20px); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0); }
    80% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}