/* ═══════════════════════════════════════════════════════════════════
   catalog.css — популярные, фильтры, сетка, карточки, поиск, хештеги.
   ═══════════════════════════════════════════════════════════════════ */

/* ═══════════════ CATALOG PAGE HEADER ═══════════════ */
.catalog-page-header {
    margin-bottom: 32px;
}
.catalog-page-header .section-title {
    margin-bottom: 0;
    font-size: var(--text-3xl);
}
.catalog-page-subtitle {
    color: var(--text-muted);
    font-size: var(--text-base);
    margin-top: 8px;
    margin-bottom: 0;
    line-height: 1.5;
}

/* ═══════════════ SUBCATEGORY CHIPS ═══════════════ */
.subcategory-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    align-items: center;
}
.subcategory-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}
.subcategory-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(var(--accent-rgb), 0.06);
}
.subcategory-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--white-on-accent);
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.25);
}
.subcategory-chip--back {
    border-style: dashed;
    color: var(--text-main);
}
.subcategory-chip--back svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}
.subcategory-chip--back:hover {
    border-style: solid;
    border-color: var(--text-main);
    color: var(--text-main);
    background: var(--button-hover-lighten);
}

/* ═══════════════ POPULAR SLIDER ═══════════════ */
.popular-slider-section { padding-bottom: 40px; position: relative; }
.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
}
.section-title {
    font-size: var(--text-2xl);
    margin-bottom: 0;
    text-align: left;
}
.slider-nav { display: flex; gap: 10px; }
.slider-arrow-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
}
.slider-arrow-btn:hover { background: var(--bg-surface); border-color: var(--text-main); }
.slider-arrow-btn svg { width: 18px; height: 18px; }
.slider-container { overflow: hidden; margin: 0 -40px; padding: 0 40px; }
.slider-track {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    padding-bottom: 20px;
    scroll-padding-left: 40px;
    cursor: grab;
}
.slider-track::-webkit-scrollbar { display: none; }
.slider-track.active { cursor: grabbing; scroll-snap-type: none; scroll-behavior: auto; }
.slider-track .product-card { min-width: 240px; max-width: 240px; scroll-snap-align: start; }

/* ═══════════════ CATALOG LAYOUT ═══════════════ */
.catalog-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 32px;
    align-items: start;
}

.catalog-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-surface-glass);
    backdrop-filter: blur(16px);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    position: sticky;
    top: 90px;
    z-index: 90;
    box-shadow: var(--shadow-catalog-desktop);
    max-height: calc(100vh - 110px);
    overflow-y: auto;
}
.catalog-controls::-webkit-scrollbar { width: 4px; }
.catalog-controls::-webkit-scrollbar-track { background: transparent; }
.catalog-controls::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.catalog-controls::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.filters-title {
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0;
}

/* ═══════════════ SORT ═══════════════ */
.sort-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 14px;
    margin-top: 4px;
    border-top: 1px solid var(--border);
}
.sort-label {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.sort-select {
    width: 100%;
    padding: 10px 36px 10px 14px;
    background-color: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239A9A9A' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    transition: border-color 0.2s ease;
}
.sort-select:hover { border-color: var(--text-muted); }
.sort-select:focus { border-color: var(--accent); }
.sort-select option { background: var(--bg-surface); color: var(--text-main); }

/* ═══════════════ SIDEBAR SEARCH ═══════════════ */
.search-wrapper-sidebar {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: 4px;
}
.search-wrapper-sidebar svg {
    position: absolute;
    left: 12px;
    width: 15px;
    height: 15px;
    stroke: var(--text-muted);
    fill: none;
    z-index: 1;
}
.search-input-sidebar {
    width: 100%;
    padding: 9px 16px 9px 38px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    outline: none;
    transition: var(--transition);
}
.search-input-sidebar:focus { border-color: var(--accent); }

.btn-reset-filters {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 16px;
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-family: var(--font-body);
    transition: var(--transition);
    margin-bottom: 4px;
}
.btn-reset-filters:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(var(--accent-rgb), 0.08);
}
.btn-reset-filters svg { width: 14px; height: 14px; }

.controls-top-row { display: flex; flex-direction: column; gap: 15px; }

/* ═══════════════ PRICE ═══════════════ */
.price-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.price-presets button {
    padding: 5px 12px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-family: var(--font-body);
    cursor: pointer;
    transition: var(--transition);
}
.price-presets button:hover { border-color: var(--text-main); color: var(--text-main); }

.price-filter {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    overflow: hidden;
    flex-wrap: nowrap;
}
.price-filter .price-label,
.price-filter .price-dash,
.price-filter .price-currency {
    flex-shrink: 0;
    font-size: var(--text-sm);
    color: var(--text-muted);
    white-space: nowrap;
    user-select: none;
}
.price-input {
    min-width: 0;
    flex: 1 1 0;
    width: auto;
    max-width: 56px;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    outline: none;
    text-align: center;
    padding: 0;
    -moz-appearance: textfield;
    appearance: textfield;
}
.price-input::-webkit-outer-spin-button,
.price-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.price-input::placeholder { color: var(--placeholder-color); font-weight: var(--fw-regular); font-size: 13px; }

/* ═══════════════ FILTER GROUPS ═══════════════ */
.filter-section { padding-top: 12px; border-top: 1px solid var(--border); }
.filter-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    color: var(--text-main);
    cursor: pointer;
    padding: 9px 0;
    user-select: none;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.filter-group-header svg {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
    color: var(--text-muted);
}
.filter-group-header.active svg { transform: rotate(180deg); }
.filter-group-content {
    display: none;
    flex-direction: column;
    gap: 10px;
    padding-top: 8px;
}
.filter-group-content.active { display: flex; animation: fadeIn 0.3s ease; }

.filter-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--text-muted);
    transition: color 0.2s;
    padding: 3px 0;
    line-height: 1.5;
}
.filter-checkbox:hover { color: var(--text-main); }
.filter-checkbox input[type="checkbox"] { display: none; }
.checkmark {
    width: 19px;
    height: 19px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-top: 1px;
}
.filter-checkbox input:checked + .checkmark { background: var(--accent); border-color: var(--accent); }
.filter-checkbox input:checked + .checkmark::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid var(--checkmark-color);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}
.filter-checkbox input:checked ~ span { color: var(--text-main); }
.subcategories {
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-left: 20px;
    padding-left: 12px;
    border-left: 1px solid var(--border);
}

.color-checkbox { display: flex; align-items: center; gap: 11px; }
.color-swatch {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid transparent;
    transition: all 0.2s;
    position: relative;
    margin-top: 1px;
}
.filter-checkbox input:checked + .color-swatch {
    border-color: var(--text-main);
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(var(--text-main-rgb, 255,255,255), 0.2);
}
.filter-checkbox input:checked + .color-swatch::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 5px;
    height: 9px;
    border: solid var(--text-main);
    border-width: 0 2px 2px 0;
    filter: drop-shadow(0 0 1px rgba(0,0,0,0.5));
}

/* ═══════════════ PRODUCT GRID ═══════════════ */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 32px 24px;
}

/* Мобильные фильтры — база (показ в responsive.css) */
.mobile-filter-btn { display: none; }
.mobile-filter-overlay { display: none; }
.mobile-filter-close { display: none; }
.mobile-filter-apply { display: none; }

/* ═══════════════ PRODUCT CARD ═══════════════ */
.product-card {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    background: transparent;
    border-radius: 12px;
    padding: 0;
    transition: transform 0.3s ease;
    position: relative;
    border: none;
    contain: layout style;
}
.product-card:hover { transform: translateY(-4px); }

.badge-popular {
    position: absolute;
    top: 12px;
    left: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: var(--white-on-accent);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    box-shadow: 0 4px 16px rgba(var(--accent-rgb), 0.35);
    z-index: 10;
    overflow: hidden;
}

.badge-popular::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: badge-shimmer-card 3s infinite;
}
@keyframes badge-shimmer-card {
    100% { left: 200%; }
}

.product-img-wrapper {
    position: relative;
    height: 220px;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 12px;
    background: var(--bg-surface);
}
.product-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease, opacity 0.4s ease;
}
.product-card:hover .product-img-wrapper img { transform: scale(1.05); }

.quick-add-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    height: 38px;
    width: 38px;
    border-radius: 50%;
    background: rgba(var(--accent-rgb), 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: var(--white-on-accent);
    box-shadow: 0 4px 14px var(--shadow-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    overflow: hidden;
    padding: 0;
}
.quick-add-btn svg { flex-shrink: 0; width: 17px; height: 17px; }
.quick-add-text { display: none; }
.quick-add-btn:hover {
    width: 110px;
    border-radius: var(--radius-pill);
    background: var(--accent);
    color: var(--white-on-accent);
    justify-content: flex-start;
    padding-left: 10px;
    box-shadow: 0 6px 20px rgba(var(--accent-rgb), 0.4);
}
.quick-add-btn:hover .quick-add-text {
    display: block;
    font-size: var(--text-xs);
    font-weight: 500;
    margin-left: 6px;
    white-space: nowrap;
}

.product-info { display: flex; flex-direction: column; padding: 0; }
.product-title {
    font-family: var(--font-heading);
    font-size: var(--text-base);
    font-weight: var(--fw-medium);
    margin-bottom: 6px;
    line-height: 1.3;
    color: var(--text-main);
    letter-spacing: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-price-block { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.price-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.current-price {
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: var(--fw-semibold);
    color: var(--text-main);
}
.old-price {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    color: var(--text-muted);
    text-decoration: line-through;
}

/* ═══════════════ SEARCH SUGGESTIONS ═══════════════ */
.search-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 40px var(--shadow-color);
    z-index: 250;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    max-height: 400px;
    overflow-y: auto;
}
.search-suggestions.active { opacity: 1; visibility: visible; transform: translateY(0); }

.search-suggestion {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
    text-decoration: none;
    color: inherit;
}
.search-suggestion:last-child { border-bottom: none; }
.search-suggestion:hover { background: var(--tag-bg); }
.search-suggestion.first { background: rgba(var(--accent-rgb), 0.06); }
.search-suggestion.first:hover { background: rgba(var(--accent-rgb), 0.12); }
.search-suggestion img {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-input);
}
.search-suggestion-body { flex: 1; min-width: 0; }
.search-suggestion-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.search-suggestion-price { font-size: 13px; color: var(--text-muted); margin-top: 2px; font-weight: 500; }
.search-suggestion-hint {
    font-size: 10px;
    padding: 4px 8px;
    background: var(--accent);
    color: var(--white-on-accent);
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
    white-space: nowrap;
}
.search-suggestion-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* ═══════════════ HASHTAGS (storefront) ═══════════════ */
.hashtag-filter-section {
    padding-top: 12px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

#catalog-hashtags-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 8px;
    align-items: flex-start;
}

.hashtag-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 7px 12px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    line-height: 1.2;
    white-space: nowrap;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.hashtag-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
    background: rgba(var(--accent-rgb), 0.06);
}
.hashtag-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--white-on-accent);
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
    transform: translateY(0);
}
.hashtag-chip-hash { color: var(--accent); font-weight: 700; opacity: 0.9; }
.hashtag-chip.active .hashtag-chip-hash { color: var(--white-on-accent); opacity: 1; }
.hashtag-chip-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    padding: 3px 7px;
    margin-left: 4px;
    min-width: 20px;
    height: 18px;
    border-radius: 100px;
    background: var(--tag-bg);
    color: var(--text-muted);
    transition: all 0.2s ease;
    font-variant-numeric: tabular-nums;
}
.hashtag-chip:hover .hashtag-chip-count { background: rgba(var(--accent-rgb), 0.15); color: var(--accent); }
.hashtag-chip.active .hashtag-chip-count { background: rgba(255, 255, 255, 0.22); color: var(--white-on-accent); }

.product-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.product-card-tag {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--tag-bg);
    padding: 2px 7px;
    border-radius: 4px;
    line-height: 1.3;
}

.pdp-hashtags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pdp-hashtag {
    display: inline-flex;
    align-items: center;
    padding: 5px 11px;
    background: var(--tag-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    line-height: 1;
}
.pdp-hashtag:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(var(--accent-rgb), 0.08);
}

/* ═══════════════ АДАПТИВ ДЛЯ ЗАГОЛОВКА КАТЕГОРИЙ ═══════════════ */
@media (max-width: 768px) {
    .catalog-page-header {
        margin-bottom: 24px;
    }
    .catalog-page-header .section-title {
        font-size: var(--text-2xl);
    }
    .subcategory-chips {
        margin-top: 16px;
        gap: 8px;
    }
    .subcategory-chip {
        padding: 7px 14px;
        font-size: 13px;
    }
}

/* ═══════════════ ANIMATION ═══════════════ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════ VIDEO IN PRODUCT CARD ═══════════════ */

.product-img-wrapper.has-video {
    background: var(--video-bg);
}

.product-card-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transform: scale(1.02);
    filter: blur(4px);
    transition:
        opacity 0.5s cubic-bezier(0.25, 1, 0.5, 1),
        transform 0.6s cubic-bezier(0.25, 1, 0.5, 1),
        filter 0.5s ease;
    pointer-events: none;
    will-change: opacity, transform, filter;
}
.product-card-video.is-ready {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
}

.product-card:hover .product-img-wrapper .product-card-video.is-ready {
    transform: scale(1.05);
}

@media (max-width: 992px) {
    .product-card-video {
        filter: none;
        transform: none;
        transition: opacity 0.4s ease;
    }
    .product-card-video.is-ready {
        transform: none;
    }
    .product-card:hover .product-img-wrapper .product-card-video.is-ready {
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .product-card-video {
        filter: none;
        transform: none;
        transition: none;
    }
    .product-card-video.is-ready {
        opacity: 1;
    }
}
/* ═══════════════ SKELETON КАТАЛОГА ═══════════════ */
.product-card-skeleton {
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.product-img-skeleton {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 16px;
    background-color: var(--skeleton-base);
    animation: skeleton-pulse 1.5s infinite ease-in-out;
}
.product-line-skeleton {
    height: 12px;
    border-radius: 6px;
    background-color: var(--skeleton-base);
    animation: skeleton-pulse 1.5s infinite ease-in-out;
}
.product-line-skeleton.short { width: 60%; }