@font-face {
    font-family: 'GraphikLCG';
    src: local('GraphikLCG-Regular'), local('Graphik LCG Regular');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'GraphikLCG';
    src: local('GraphikLCG-Medium'), local('Graphik LCG Medium');
    font-weight: 500;
    font-style: normal;
}

:root {
    --green: #09b33c;
    --red: #FF4103;
    --blue: #0088ff;
    --primary: #FF4103;
    /* Основной цвет теперь оранжевый */
    --text-gray: #666;
    --bg: #ffffff;
    --white: #ffffff;
    --border: #eee;
    --gray-light: #f2f2f2;
    --gray-text: #989898;
    --nav-icon: #4E4E4E;
    --camera-icon: #B5B5B5;
}

body {
    margin: 0;
    font-family: 'GraphikLCG', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 400;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    position: relative;
    /* Отключаем pull-to-refresh полностью */
    overscroll-behavior: none;
}

header {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #eee;
}

#backBtn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: none;
    border: none;
    font-size: 16px;
    color: var(--primary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

#backBtn:hover {
    background: rgba(255, 65, 3, 0.1);
}

#backBtn svg {
    flex-shrink: 0;
}

.header-title {
    flex: 1;
    width: 204px;
    height: 40px;
    flex-shrink: 0;
    color: #B5B5B5;
    font-family: 'GraphikLCG', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    font-style: normal;
    font-weight: 500;
    line-height: 19px;
    display: flex;
    align-items: center;
}

/* Status message next to logo */
.search-status {
    margin-left: 15px;
    color: #B5B5B5;
    font-family: 'GraphikLCG', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 19px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Контейнер логотипа */
.logo-section {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px 45px;
    background: #fff;
    transition: all 0.3s ease;
}

.logo-section.search-active {
    display: none;
}

.logo-container {
    cursor: pointer;
    transition: all 0.3s ease;
}

.logo-container:hover {
    transform: scale(1.05);
}

.logo-container img {
    display: block;
    height: 60px;
    width: auto;
    transition: all 0.3s ease;
}

#content {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    padding-bottom: 100px;
    /* Отступ для фиксированной навигации с учетом padding */
    background: #ffffff;
    transition: all 0.3s ease;
    position: relative;
    /* Фиксация на мобильных - полностью запретить overscroll (pull-to-refresh) */
    overscroll-behavior-y: none;
    overscroll-behavior-x: none;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y pinch-zoom;
}

body.search-active #content {
    display: block !important;
}

/* Показываем контент для всех вкладок кроме welcome */
body:not(.welcome-page) #content {
    display: block !important;
}

.card {
    background: #fff;
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    gap: 12px;
    transition: all 0.2s ease;
    border: 1px solid #f0f0f0;
    position: relative;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.card img {
    width: 96px;
    height: 96px;
    border-radius: 12px;
    object-fit: cover;
    background: #f5f5f5;
    border: 1px solid #eee;
    flex-shrink: 0;
}

.info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 6px;
    display: flex;
    align-items: flex-start;
    line-height: 1.4;
    padding-right: 28px;
    /* место под фиксированный бейдж */
}

.price {
    font-size: 24px;
    font-weight: 700;
    color: var(--green);
    margin-right: 8px;
    margin-top: 2px;
}

.old-price {
    font-size: 16px;
    color: #999;
    text-decoration: line-through;
    margin-right: 6px;
}

.discount {
    font-size: 16px;
    color: #fff;
    background: var(--red);
    border-radius: 6px;
    padding: 2px 6px;
}

.rating {
    margin-top: 6px;
    font-size: 15px;
    color: var(--text-gray);
    display: flex;
    align-items: center;
    gap: 4px;
}

.rating .star {
    color: #facc15;
}

.no-reviews {
    margin-top: 6px;
    font-size: 14px;
    color: #999;
    font-style: italic;
}

.match {
    margin-top: 4px;
    font-size: 14px;
    color: var(--primary);
}

.fav-icon {
    font-size: 20px;
    cursor: pointer;
    user-select: none;
    transition: transform 0.2s;
    padding: 2px;
    border-radius: 8px;
    margin-left: 4px;
    flex-shrink: 0;
}

.fav-icon:hover {
    transform: scale(1.1);
    background: rgba(255, 0, 100, 0.05);
}

.card-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: auto;
    padding-top: 8px;
}

.similar-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.similar-btn:hover {
    background: #E53A02;
    transform: scale(1.05);
}

/* Back button styles */
.back-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: transparent;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    justify-content: center;
}

.back-button:hover {
    background: #f5f5f5;
    border-color: #bbb;
    transform: scale(1.02);
}

.back-button svg {
    flex-shrink: 0;
}

/* Fixed filters container */
.fixed-filters {
    position: sticky;
    top: 0;
    background: white;
    z-index: 50;
    padding: 0 12px 15px;
    margin: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

body.search-active .fixed-filters {
    position: sticky;
    top: 0;
}

/* Filter dropdown styles */
.filter-dropdown {
    position: relative;
    margin-top: 0;
    margin-bottom: 0;
}

.filter-button {
    width: 100%;
    padding: 12px 20px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.filter-button:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(255, 65, 3, 0.1);
}

.filter-button.active {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-button svg {
    width: 20px;
    height: 20px;
    transition: opacity 0.2s ease;
}

/* Верхняя панель фильтров и переключателя вида */
.filters-top-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.filters-top-bar .filter-dropdown {
    flex: 1 1 auto;
}

.view-toggle {
    display: inline-flex;
    align-items: center;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    flex-shrink: 0;
}

.view-toggle .view-btn {
    border: none;
    background: transparent;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: all 0.2s ease;
}

.view-toggle .view-btn:hover {
    background: rgba(255, 65, 3, 0.06);
}

.view-toggle .view-btn.active {
    background: var(--primary);
    color: #fff;
}

.filter-button.active svg {
    opacity: 0.7;
}

.filter-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    z-index: 100;
    display: none;
}

.filter-options.show {
    display: block;
}

.filter-option {
    padding: 14px 20px;
    font-size: 16px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-option:last-child {
    border-bottom: none;
}

.filter-option:hover {
    background: #f8f8f8;
}

.filter-option.active {
    background: #fff5f5;
    color: var(--primary);
    font-weight: 500;
}

.filter-option.active::after {
    content: '✓';
    margin-left: auto;
    color: var(--primary);
}

/* Sort dropdown options */
.sort-option {
    padding: 14px 20px;
    font-size: 16px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-option:last-child {
    border-bottom: none;
}

.sort-option:hover {
    background: #f8f8f8;
}

.sort-option.active {
    background: #fff5f5;
    color: var(--primary);
    font-weight: 500;
}

.sort-option.active::after {
    content: '✓';
    margin-left: auto;
    color: var(--primary);
}

/* Filter options dropdown */
.filter-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    z-index: 100;
    display: block;
}

.filter-options.show {
    display: block;
}

.badge {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    background: var(--primary);
    border-radius: 6px;
    padding: 3px 8px;
    margin-left: auto;
    flex-shrink: 0;
}

/* tabs */
nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: #fff;
    padding: 12px 25px 40px;
    border-top: 1px solid #f0f0f0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

nav button {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--nav-icon);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
    position: relative;
}

nav button svg {
    width: 32px;
    height: 32px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

nav button.active {
    color: var(--primary);
}

nav button:hover {
    transform: scale(1.1);
}

/* search container */
#searchContainer {
    padding: 20px 15px 15px;
    background: #fff;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
}

body.search-active #searchContainer {
    padding-top: 20px;
}

/* Отступ сверху для страниц поиска по запросам и избранного */
body:not(.welcome-page) #content {
    padding-top: 0;
}

/* Отступ только для fixed-filters */
body:not(.welcome-page) .fixed-filters {
    margin-top: -10px;
}

/* Price filter styles */
.price-filter {
    background: white;
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #f0f0f0;
    margin-top: 10px;
    margin-bottom: 12px;
    overflow: hidden;
    max-height: 600px;
    transition: max-height 0.25s ease, opacity 0.25s ease, transform 0.25s ease, margin 0.25s ease, padding 0.25s ease, border-width 0.25s ease;
}

.price-filter.collapsed {
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    max-height: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-width: 0 !important;
}

.price-inputs {
    display: flex;
    gap: 8px;
    margin: 0 0 16px 0;
}

.price-inputs .input-group {
    flex: 1 1 0;
    min-width: 0;
    position: relative;
}

.price-inputs label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
    font-weight: 500;
}

.price-inputs input[type="number"] {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 16px;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.price-inputs input[type="number"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 65, 3, 0.1);
}

.price-inputs span {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: #999;
    pointer-events: none;
    white-space: nowrap;
    margin-top: 10px;
}

.slider-container {
    position: relative;
    height: 35px;
    margin: 0;
}

.slider-track {
    position: absolute;
    width: 100%;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    top: 15px;
}

.slider-range {
    position: absolute;
    height: 4px;
    background: var(--primary);
    border-radius: 2px;
    top: 15px;
}

.range-input {
    position: absolute;
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    top: 7px;
    height: 20px;
    outline: none;
}

.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--white);
    border: 2px solid var(--primary);
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.range-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--white);
    border: 2px solid var(--primary);
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    border: 0;
}

/* Filter sections styles */
.filter-section {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.filter-section:last-child {
    border-bottom: none;
}

.filter-section-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
    padding: 0 20px;
    font-family: 'GraphikLCG', -apple-system, BlinkMacSystemFont, sans-serif;
}

.marketplace-option {
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.marketplace-option:hover {
    background-color: #f8f8f8;
}

.marketplace-option input[type="checkbox"], 
.marketplace-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.marketplace-option label {
    font-size: 16px;
    color: #333;
    cursor: pointer;
    flex: 1;
}

.marketplace-icon-small {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid #eee;
    object-fit: cover;
}

/* Скрываем лого на всех страницах кроме главной */
body:not(.welcome-page) .logo-section {
    display: none !important;
}

/* search bar */
#searchBar {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    height: 63px;
    margin: 0 auto;
    padding: 0;
    background: var(--gray-light);
    border-radius: 50px;
    flex-shrink: 0;
}

.marketplace-icons {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 0;
    z-index: 2;
}

.marketplace-icon {
    width: 31px;
    height: 31px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    transition: all 0.2s ease;
    border: 1px solid #e0e0e0;
    position: relative;
    flex-shrink: 0;
    cursor: pointer;
}

/* Наложение иконок теперь управляется через inline стили */

/* Fallback стили для иконок если изображения не загрузились */
.marketplace-icon:first-child::before {
    content: 'O';
    font-size: 16px;
    font-weight: bold;
    color: #005bff;
    display: none;
}

.marketplace-icon:nth-child(2)::before {
    content: 'W';
    font-size: 16px;
    font-weight: bold;
    color: #e10072;
    display: none;
}

.marketplace-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Показываем буквы если изображения не загрузились */
.marketplace-icon.no-image::before {
    display: block !important;
}

.marketplace-icon[data-marketplace="ozon"].no-image::before {
    content: 'O';
    color: #005bff;
}

.marketplace-icon[data-marketplace="wildberries"].no-image::before {
    content: 'WB';
    color: #e10072;
    font-size: 12px;
}

.marketplace-icon:hover {
    transform: scale(1.05);
}

.marketplace-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#searchSubtitle {
    margin-top: 45px;
    margin-bottom: 45px;
    font-family: 'GraphikLCG', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 18px;
    font-weight: 400;
    line-height: 28px;
    color: var(--gray-text);
    text-align: center;
}

#searchBar input {
    flex: 1 1 auto;
    padding: 0 60px 0 99px;
    font-family: 'GraphikLCG', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 17px;
    font-weight: 400;
    line-height: 20px;
    color: #333;
    background: transparent;
    border: none;
    outline: none;
    height: 100%;
    text-indent: 5px;
}

#searchBar input::placeholder {
    color: #989898;
    font-family: 'GraphikLCG', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 17px;
    font-weight: 400;
}

#searchBar input:focus {
    outline: none;
}

#photoBtn {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: transparent;
    color: var(--camera-icon);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
}

#photoBtn svg {
    width: 32px;
    height: 32px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

#photoBtn:hover {
    color: var(--red);
    transform: translateY(-50%) scale(1.1);
}

/* Адаптивность для мобильных устройств */
@media (max-width: 480px) {
    #searchBar {
        width: 100%;
    }

    .marketplace-icons {
        left: 12px;
        gap: 0;
    }

    .marketplace-icon {
        width: 28px;
        height: 28px;
    }

    /* Мобильное наложение управляется через inline стили */

    #photoBtn {
        right: 20px;
        width: 28px;
        height: 28px;
    }

    #searchBar input {
        padding-left: 86px;
        padding-right: 60px;
    }
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #888;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.empty-state .title {
    font-size: 20px;
    font-weight: 500;
    color: #666;
    margin-bottom: 12px;
    line-height: 1.4;
    font-family: 'GraphikLCG', -apple-system, BlinkMacSystemFont, sans-serif;
}

.empty-state .subtitle {
    font-size: 16px;
    color: #999;
    line-height: 1.4;
    margin-bottom: 24px;
}

/* Стили для главной страницы */
body.welcome-page {
    background: #ffffff;
}

body.welcome-page #content {
    display: none;
}

body.welcome-page #searchContainer {
    border-bottom: none;
}

/* Центрирование контента на главной странице */
body.welcome-page .welcome-content-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 430px;
    padding: 0 20px;
}

/* Стили для активного поиска */
body.search-active .logo-section {
    position: relative;
    height: auto;
    padding: 16px 20px;
}

body.search-active #searchContainer {
    margin-top: 0;
}

body.search-active .welcome-content-wrapper {
    position: static;
    transform: none;
    top: auto;
    left: auto;
}

.empty-state .icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.empty-state button {
    margin-top: 16px;
    padding: 12px 32px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.empty-state button:hover {
    background: #E53A02;
    transform: scale(1.05);
}

/* Стили для слайдеров */
.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--white);
    border: 2px solid var(--primary);
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.range-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--white);
    border: 2px solid var(--primary);
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    border: 0;
}

/* Фиксы для блоков "от / до" */
.price-filter .price-inputs>div {
    flex: 1 1 0;
    min-width: 0;
}

.price-filter input[type="number"] {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 16px;
}

.price-filter .price-inputs span {
    pointer-events: none;
    white-space: nowrap;
}

/* Активная кнопка сортировки */
.active-sort {
    background: var(--primary) !important;
    color: #fff !important;
    font-weight: 600;
}

/* Стили для истории поисков */
.history-item {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.history-item:hover {
    background-color: #f8f8f8 !important;
}

.history-item>div {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Исправление переполнения в карточках товаров */
.card .title {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    max-width: 100%;
}

.card .info {
    min-width: 0;
    max-width: 100%;
}



/* Предотвращаем зум на мобильных */
input,
select,
textarea {
    font-size: 16px !important;
}

/* Анимации для карточек товаров */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes expandGrid {
    from {
        transform: scaleY(0.98);
    }

    to {
        transform: scaleY(1);
    }
}

.product-card {
    transition: all 0.3s ease-out;
    transform-origin: center top;
}

.product-card.new-item {
    animation: slideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Плавное расширение контейнера при добавлении новых элементов */
.products-grid {
    padding: 12px 15px;
    transition: all 0.4s ease-out;
    transform-origin: center top;
}

/* Плиточный вид */
.products-grid.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    padding: 12px;
    grid-auto-rows: max-content;
}

.products-grid.grid-view .card {
    display: flex;
    flex-direction: column;
    margin: 0;
    min-height: 280px;
}

.products-grid.grid-view .card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 12px;
}

.products-grid.grid-view .info {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.products-grid.grid-view .title {
    padding-right: 0;
    font-size: 15px;
}

.products-grid.grid-view .card-actions {
    margin-top: auto;
    padding-top: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

.products-grid.grid-view .similar-btn {
    max-width: 110px;
    font-size: 12px;
    padding: 8px 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.products-grid.grid-view .fav-icon {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    padding: 2px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Фиксируем бейдж маркетплейса в правом верхнем углу карточки */
.marketplace-badge {
    position: absolute;
    right: 12px;
    top: 12px;
    margin: 0 !important;
    z-index: 2;
}

.products-grid.expanding {
    animation: expandGrid 0.4s ease-out;
}

/* Card actions button styling */
.card-actions button {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.card-actions button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 65, 3, 0.3);
}

.card-actions button:active {
    transform: translateY(0);
}

.card-actions button svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Ozon searching state: grayscale icon + inner spinner */
.marketplace-icon[data-marketplace="ozon"].ozon-searching img {
    filter: grayscale(1);
    opacity: 0.75;
}

/* Avito searching state: same as Ozon */
.marketplace-icon[data-marketplace="avito"].avito-searching img {
    filter: grayscale(1);
    opacity: 0.75;
}

.marketplace-icon.progress::after {
    content: '';
    position: absolute;
    inset: 2px;
    /* внутренний край кружка */
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.85);
    border-top-color: transparent;
    animation: spin .8s linear infinite;
    pointer-events: none;
}

/* Серый оверлей поверх иконки во время поиска */
.marketplace-icon.progress::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.28);
    pointer-events: none;
}

/* Чуть сильнее затемняем белую иконку Avito */
.marketplace-icon[data-marketplace="avito"].progress::before {
    background: rgba(0, 0, 0, 0.42);
}

/* Любая иконка с активным прогрессом слегка тускнеет */
.marketplace-icon.progress img {
    filter: grayscale(1);
    opacity: 0.75;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Стили для кнопки возврата */
.back-to-results-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f0f0f0;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.back-to-results-btn:hover {
    background: #e0e0e0;
    transform: translateX(-2px);
}

.back-to-results-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Disabled marketplace icon */
.marketplace-icon.disabled img {
    filter: grayscale(1);
    opacity: 0.45;
}

/* Scroll-to-top floating button */
#scrollTopBtn {
    position: fixed;
    right: 18px;
    bottom: 88px;
    width: 48px;
    height: 48px;
    border-radius: 24px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(255, 65, 3, 0.35);
    border: none;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: all .25s ease;
    z-index: 9999;
}

#scrollTopBtn.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

#scrollTopBtn svg {
    width: 22px;
    height: 22px;
}

/* Smooth collapse for price range (без «дыры» в потоке) */
.price-filter {
    overflow: hidden;
    max-height: 600px;
    transition:
        max-height .25s ease,
        opacity .25s ease,
        transform .25s ease,
        margin .25s ease,
        padding .25s ease,
        border-width .25s ease;
}

.price-filter.collapsed {
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    max-height: 0;
    margin-top: 0;
    margin-bottom: 0;
    /* Переопределяем inline-стили контейнера, чтобы не оставалась пустая высота */
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-width: 0 !important;
}
/* Swipe back indicator */
.swipe-indicator {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 60px;
    background: rgba(255, 65, 3, 0.1);
    border-top-right-radius: 30px;
    border-bottom-right-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.swipe-indicator.active {
    opacity: 1;
}

.swipe-indicator svg {
    width: 24px;
    height: 24px;
    stroke: var(--primary);
    stroke-width: 2;
    fill: none;
}
