:root {
    --tg-theme-bg-color: #ffffff;
    --tg-theme-text-color: #1a1a1a;
    --tg-theme-hint-color: #8b8b8b;
    --tg-theme-link-color: #00b956;
    --tg-theme-button-color: #00b956;
    --tg-theme-button-text-color: #ffffff;
    --tg-theme-secondary-bg-color: #f7f7f7;

    /* Зеленая палитра для натуральности и пользы */
    --primary-color: var(--tg-theme-button-color, #00b956);
    --primary-light: #1cc464;
    --primary-dark: #009945;

    /* Дополнительные цвета */
    --success-color: #00b956;
    --warning-color: #ff9500;
    --error-color: #ff3b30;
    --info-color: #00b956;

    /* Натуральные акцентные цвета */
    --accent-green: #00b956;
    --accent-lime: #32d74b;
    --accent-mint: #00c896;
    --accent-forest: #2d7016;

    /* Текстовые цвета */
    --text-color: var(--tg-theme-text-color, #1a1a1a);
    --text-secondary: var(--tg-theme-hint-color, #8b8b8b);
    --text-light: #b3b3b3;
    --text-muted: #d1d1d1;

    /* Фоновые цвета */
    --bg-color: var(--tg-theme-bg-color, #ffffff);
    --card-bg: #ffffff;
    --surface-bg: var(--tg-theme-secondary-bg-color, #f7f7f7);
    --hover-bg: #f0f8f3;
    --active-bg: #e8f5ea;

    /* Границы */
    --border-color: #e8e8e8;
    --border-color-light: #f0f0f0;
    --border-color-medium: #d1d1d1;

    /* Радиусы */
    --border-radius: 12px;
    --border-radius-small: 8px;
    --border-radius-large: 16px;
    --border-radius-xl: 20px;

    /* Мягкие тени с зеленоватым оттенком */
    --shadow-light: 0 1px 3px rgba(0, 185, 86, 0.08);
    --shadow-medium: 0 2px 8px rgba(0, 185, 86, 0.1);
    --shadow-strong: 0 4px 16px rgba(0, 185, 86, 0.12);
    --shadow-card: 0 1px 4px rgba(0, 185, 86, 0.06);

    /* Анимации */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease-out;

    /* Safe area для мобильных */
    --safe-area-inset-left: env(safe-area-inset-left, 0px);
    --safe-area-inset-right: env(safe-area-inset-right, 0px);
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-inset-top: env(safe-area-inset-top, 0px);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: #ffffff !important;
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.4;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    min-height: 100vh;
    padding-bottom: 70px;
    /* Высота футера + запас */
}

.catalog-container {
    max-width: 100%;
    margin: 0 auto;
    background: #ffffff !important;
    min-height: unset;
    /* убираем, чтобы не было двойного скролла */
    padding-left: var(--safe-area-inset-left);
    padding-right: var(--safe-area-inset-right);
    padding-bottom: calc(20px + var(--safe-area-inset-bottom));
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    transition: var(--transition);
}

.btn-outline {
    background: white;
    color: #00b956;
    border-color: white;
}

.btn-outline:hover {
    background: rgba(0, 185, 86, 0.06);
    color: white;
}

/* Шапка */
.catalog-header>a,
.catalog-header>.btn {
    flex-shrink: 0;
    /* Запрещаем сжимание кнопок */
    white-space: nowrap;
    /* Текст не переносится */
}

.clear-search-btn {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    margin-left: -25px;
    color: #aaa;
    position: relative;
    top: 2px;
}

.clear-search-btn:hover {
    color: #000;
}

.catalog-header {
    text-align: center;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: #00b956 !important;
    border-radius: 0;
    /* Убираем округление по умолчанию */
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid #009945;
    padding-top: calc(8px + var(--safe-area-inset-top));
}

.cart-icon,
.cart-icon-alt,
.orders-icon,
.favorites-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #00b956;
    border-radius: 50%;
    padding: 8px;
    width: 40px;
    height: 40px;
}

.cart-icon svg,
.cart-icon-alt svg,
.orders-icon svg,
.favorites-icon svg {
    width: 24px;
    height: 24px;
    stroke: white;
    fill: none;
    stroke-width: 2;
}

/* Стили для избранного, чтобы совпадало с корзиной и заказами */
.favorites-icon {
    position: relative;
    /* необходимо для правильного позиционирования счётчика */
    background: linear-gradient(135deg, var(--primary-color), var(--accent-lime));
    box-shadow: 0 2px 8px rgba(0, 185, 86, 0.3);
}

.favorites-icon:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    box-shadow: 0 4px 12px rgba(0, 185, 86, 0.4);
    transform: translateY(-1px);
}

.favorites-icon svg {
    stroke: white;
    fill: none;
}

/* Единый стиль для счётчиков корзины и избранного */
.cart-counter,
.favorites-counter {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--error-color);
    color: white;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid var(--bg-color);
}

/* Счётчик в футере (кнопка "Корзина" внизу) */
.footer-button .cart-counter {
    position: static;
    margin-left: 4px;
    background: #ff3b30;
    color: #fff;
    border-radius: 12px;
    padding: 2px 8px;
    min-width: auto;
    height: auto;
    border: none;
}

.header-left {
    min-width: 0;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 8px;
    grid-column: 1 / 2;
    grid-row: 1 / span 2;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: nowrap;
    grid-column: 2 / 3;
    grid-row: 1 / 2;
}

.page-title {
    margin: 0;
    font-size: 20px;
    color: var(--text-color);
}

.search-container {
    flex: 1;
    position: relative;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-large);
    font-size: 16px;
    background: var(--surface-bg);
    color: var(--text-color);
    transition: var(--transition);
    outline: none;
}

.search-input:focus {
    border-color: var(--primary-color);
    background: var(--bg-color);
    box-shadow: 0 0 0 3px rgba(0, 185, 86, 0.1);
}

.search-input::placeholder {
    color: var(--text-secondary);
    font-size: 15px;
}

.search-icon-left {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    stroke: var(--text-secondary);
    fill: none;
    stroke-width: 2;
    z-index: 1;
}

.clear-search-btn {
    position: absolute;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.clear-search-btn:hover {
    background: var(--hover-bg);
}

.clear-search-btn svg {
    width: 14px;
    height: 14px;
    stroke: var(--text-secondary);
    fill: none;
    stroke-width: 2;
}

.search-btn {
    display: none;
}

/* Корзина */
.cart-icon {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-lime));
    border-radius: var(--border-radius);
    text-decoration: none;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 185, 86, 0.3);
}

.cart-icon:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    box-shadow: 0 4px 12px rgba(0, 185, 86, 0.4);
    transform: translateY(-1px);
}

.cart-icon svg {
    width: 20px;
    height: 20px;
    stroke: white;
    fill: none;
    stroke-width: 2;
}

/* Мои заказы (копия Корзины для корректной работы счетчика */
.cart-icon-alt {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-lime));
    border-radius: var(--border-radius);
    text-decoration: none;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 185, 86, 0.3);
}

.cart-icon-alt:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    box-shadow: 0 4px 12px rgba(0, 185, 86, 0.4);
    transform: translateY(-1px);
}

.cart-icon-alt svg {
    width: 20px;
    height: 20px;
    stroke: white;
    fill: none;
    stroke-width: 2;
}

/* Стиль для кнопки "Мои заказы" */
.orders-icon {
    background: linear-gradient(135deg, #00c896, #32d74b) !important;
}

.orders-icon:hover {
    background: linear-gradient(135deg, #00b886, #2bc63a) !important;
}

/* Фильтры */
.filters-container {
    padding: 12px 16px 8px 16px;
    background: #ffffff !important;
    border-bottom: 1px solid var(--border-color-light);
}

.category-filters {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-top: 2px;
    padding-bottom: 4px;
    margin-bottom: 8px;
}

.category-filters::-webkit-scrollbar {
    display: none;
}

.official-representative {
    text-align: center;
    justify-content: center;
    /* Центрирование по горизонтали (главная ось) */
    align-items: center;
    /* Центрирование по вертикали (поперечная ось) */
    padding: 12px 16px;
    background: linear-gradient(135deg, #f0f8f3, #e8f5ea);
    border-bottom: 1px solid var(--border-color-light);
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.category-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--surface-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-large);
    text-decoration: none;
    color: var(--text-color);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: var(--transition);
    min-width: fit-content;
}

.category-pill:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0, 185, 86, 0.15);
}

.category-pill.active {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-lime));
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 185, 86, 0.3);
}

.pill-icon {
    font-size: 14px;
    line-height: 1;
}

.sort-pills {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 4px;
}

.sort-pills::-webkit-scrollbar {
    display: none;
}

.sort-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--surface-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-large);
    text-decoration: none;
    color: var(--text-color);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: var(--transition);
    min-width: fit-content;
}

.sort-pill:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 185, 86, 0.15);
}

.sort-pill.active {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-lime));
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 185, 86, 0.3);
}

/* Информация о поиске */
.search-info {
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--surface-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.search-results {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.search-emoji {
    font-size: 14px;
}

.search-text {
    font-weight: 500;
    color: var(--text-color);
    font-size: 14px;
}

.category-emoji {
    font-size: 14px;
}

.category-text {
    font-weight: 500;
    color: var(--text-color);
    font-size: 14px;
}

.search-count {
    font-size: 13px;
    color: var(--text-secondary);
}

.clear-search {
    padding: 4px 8px;
    background: var(--error-color);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius-small);
    font-size: 12px;
    font-weight: 500;
    transition: var(--transition-fast);
}

.clear-search:hover {
    background: #e6332a;
}

/* Сетка товаров */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 12px 16px;
    background: #ffffff !important;
}

.product-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-large);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-card);
    position: relative;
    min-width: 180px;
    /* увеличено для контроля */
}

.product-card.small {
    width: 200px;
    /* увеличено с 160px */
    min-width: 200px;
}

.product-card:hover {
    box-shadow: 0 4px 20px rgba(0, 185, 86, 0.15);
    border-color: rgba(0, 185, 86, 0.3);
    transform: translateY(-3px);
}

.product-link {
    text-decoration: none;
    color: inherit;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-image-container {
    position: relative;
    width: 100%;
    height: 240px;
    overflow: hidden;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.product-card.small .product-image-container {
    height: 160px;
    /* увеличено */
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: var(--transition);
    padding: 8px;
}

.product-card:hover .product-image {
    transform: scale(1.02);
}

.favorite-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 185, 86, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 185, 86, 0.1);
}

.favorite-btn:hover {
    background: rgba(0, 185, 86, 0.1);
    border-color: var(--primary-color);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 185, 86, 0.2);
}

.favorite-btn svg {
    stroke: var(--primary-color);
    fill: none;
    stroke-width: 2;
    transition: var(--transition);
}

.favorite-btn:hover svg {
    stroke: var(--primary-dark);
    fill: var(--accent-lime);
}

.stock-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 8px;
    border-radius: var(--border-radius);
    font-size: 11px;
    font-weight: 500;
    color: white;
    z-index: 2;
    backdrop-filter: blur(4px);
}

.badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    z-index: 2;
}

.badge-bestseller {
    background: linear-gradient(135deg, #ff9500, #ffb84d);
    box-shadow: 0 2px 8px rgba(255, 149, 0, .25);
}

.badge-super {
    background: linear-gradient(135deg, #f91155, #ff5c7a);
    box-shadow: 0 2px 8px rgba(249, 17, 85, .25);
}

/* Стекирование бейджей без наложения */
.product-image-container .badge {
    position: relative;
    top: auto;
    right: auto;
    margin: 0 6px 0 0;
}

.product-image-container {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.product-image-container .badges {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.low-stock {
    background: linear-gradient(135deg, var(--warning-color), #ffb84d);
    box-shadow: 0 2px 8px rgba(255, 149, 0, 0.3);
}

.out-of-stock {
    background: linear-gradient(135deg, var(--error-color), #ff6347);
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.3);
}

.clear-search-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #888;
}

.product-info {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.product-price {
    display: flex;
    align-items: baseline;
    gap: 2px;
    margin-bottom: 4px;
}

.price-value {
    font-weight: 700;
    font-size: 18px;
    color: #f91155;
    line-height: 1;
}

.currency {
    font-size: 16px;
    color: #f91155;
    font-weight: 700;
}

.product-title {
    font-size: 13px;
    font-weight: 400;
    line-height: 1.3;
    color: var(--text-color);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    margin-bottom: 4px;
    flex: 1;
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
}

/* Маленький серый текст для количества на складе */
.product-stock {
    font-size: 12px;
    color: var(--text-secondary);
}

.rating-stars {
    font-size: 12px;
    color: var(--text-color);
    font-weight: 500;
}

.rating-count {
    font-size: 11px;
    color: var(--text-secondary);
}

.product-actions {
    padding: 0 12px 12px;
    display: flex;
    gap: 8px;
}

.delivery-btn {
    flex: 1;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
}

.delivery-btn.primary {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-lime));
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 185, 86, 0.3);
}

.delivery-btn.primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 185, 86, 0.4);
}

.delivery-btn:disabled {
    background: var(--text-light);
    color: white;
    cursor: not-allowed;
    opacity: 0.7;
}

.delivery-btn svg {
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    flex-shrink: 0;
}

/* Эффект пульсации для добавленного товара */
.delivery-btn.added {
    background: linear-gradient(135deg, var(--success-color), var(--accent-lime)) !important;
    animation: pulse-green 0.4s ease-in-out;
}

@keyframes pulse-green {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(0, 185, 86, 0.3);
    }

    50% {
        transform: scale(1.02);
        box-shadow: 0 4px 16px rgba(0, 185, 86, 0.5);
    }
}

/* Пагинация */
.pagination {
    padding: 16px;
    display: flex;
    justify-content: center;
    background: #ffffff !important;
}

/* Карусели */
.carousel-section {
    padding: 22px 16px 26px 16px;
}

.carousel-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.carousel-header h3 {
    margin: 0;
    font-size: 22px;
    color: var(--text-color);
    font-weight: 700;
    text-align: center;
}

.carousel {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
}

/* Двухрядная карусель: элементы раскладываются в 2 строки по высоте */
.carousel-rows-2 {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    grid-template-rows: repeat(2, 1fr);
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
}

/* Однорядная карусель (для 1 товара): без нижнего отступа и без дополнительной высоты */
.carousel-rows-1 {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    grid-template-rows: 1fr;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 0;
}

/* Фиксируем высоту карточки для ровных рядов в маленьком варианте */
.carousel-rows-2 .product-card.small {
    width: 200px;
    /* синхронизировано */
    min-width: 200px;
}

/* Витрина всех товаров внизу */
.vitrine-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-auto-rows: auto;
    gap: 12px;
    padding: 12px 16px;
}

/* На широких экранах 3 ряда визуально достигаются высотой карточки; ограничим максимальную высоту блока */
@media (min-width: 1200px) {
    .vitrine-grid {
        grid-auto-flow: row;
    }
}

/* На маленьких экранах — 2 ряда (уменьшаем количество колонок) */
@media (max-width: 768px) {
    .vitrine-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 8px 12px;
    }
}

/* Поиск в шапке каталога */
.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    grid-row: 2;
    min-width: 0;
}

.search-input {
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #fff;
    outline: none;
    min-width: 220px;
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 185, 86, 0.1);
}

.search-button {
    height: 36px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid var(--primary-color);
    background: var(--primary-color);
    color: #fff;
    cursor: pointer;
}

.search-button:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* Адаптив для шапки каталога */
@media (max-width: 768px) {
    .catalog-header {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        row-gap: 8px;
    }

    .header-left {
        grid-column: 1 / -1;
        grid-row: 1 / 3;
    }

    .page-title {
        margin: 0;
        font-size: 18px;
    }

    .search-form {
        width: 100%;
    }

    .search-input {
        flex: 1;
        min-width: 0;
    }

    .header-right {
        grid-column: 2 / 3;
        grid-row: 1;
        gap: 6px;
    }

    .catalog-header .btn {
        padding: 8px 10px;
        font-size: 13px;
    }

    .carousel-rows-2 {
        grid-template-rows: repeat(1, 1fr)
    }
}

@media (max-width: 480px) {
    .catalog-header {
        grid-template-columns: 1fr auto;
        padding: 8px 6px;
        padding-left: calc(6px + var(--safe-area-inset-left));
        padding-right: calc(6px + var(--safe-area-inset-right));
        gap: 8px;
    }

    .page-title {
        font-size: 17px;
    }

    .search-input {
        height: 34px;
        font-size: 14px;
    }

    .search-button {
        height: 34px;
        padding: 0 10px;
        font-size: 14px;
    }

    .cart-icon,
    .cart-icon-alt {
        width: 36px;
        height: 36px;
    }

    .catalog-header .btn {
        padding: 7px 9px;
        font-size: 12px;
    }

    .carousel-rows-2 {
        grid-template-rows: repeat(1, 1fr)
    }
}

.carousel::-webkit-scrollbar {
    height: 8px;
}

.carousel::-webkit-scrollbar-thumb {
    background: #d9f3e3;
    border-radius: 999px;
}


.pagination-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    padding: 8px 16px;
    border-radius: var(--border-radius-large);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-light);
}

.page-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-color);
    border-radius: var(--border-radius);
    transition: var(--transition-fast);
    background: var(--surface-bg);
    border: 1px solid var(--border-color);
}

.page-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-btn span {
    font-size: 14px;
    line-height: 1;
}

.page-info {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 8px;
    font-weight: 500;
    font-size: 14px;
}

.current-page {
    color: var(--primary-color);
    font-weight: 600;
}

.page-separator {
    color: var(--text-secondary);
    font-size: 13px;
}

.total-pages {
    color: var(--text-secondary);
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 8px 12px;
    }

    .carousel-rows-2 {
        grid-template-rows: repeat(1, 1fr)
    }

    .product-card {
        font-size: 13px;
        min-width: 160px;
        /* чуть меньше на мобильных */
    }

    .product-card.small {
        width: 170px;
        min-width: 170px;
    }

    .product-info {
        padding: 10px;
        gap: 6px;
    }

    .product-title {
        font-size: 13px;
    }

    .price-value {
        font-size: 14px;
    }

    .add-to-cart {
        padding: 10px 12px;
        font-size: 13px;
    }

    .sort-pills {
        gap: 6px;
    }

    .sort-pill {
        padding: 6px 10px;
        font-size: 12px;
    }

    .pagination-inner {
        padding: 6px 12px;
        gap: 6px;
    }

    .page-btn {
        width: 32px;
        height: 32px;
    }

    .page-btn span {
        font-size: 12px;
    }

    /* Одинаковые размеры для кнопок корзины и заказов */
    .cart-icon,
    .cart-icon-alt {
        width: 40px;
        height: 40px;
    }

    .cart-icon svg,
    .cart-icon-alt svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 768px) {
    body {
        padding-bottom: 90px !important;
    }

    .faq-page {
        padding-bottom: 90px;
    }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
    .catalog-header {
        padding: 6px 12px;
        gap: 8px;
    }

    .search-input {
        padding: 8px 12px 8px 36px;
        font-size: 16px;
    }

    .cart-icon,
    .cart-icon-alt {
        width: 36px;
        height: 36px;
    }

    .cart-icon svg,
    .cart-icon-alt svg {
        width: 18px;
        height: 18px;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 12px;
    }

    .product-image-container {
        height: 200px;
    }

    .filters-container {
        padding: 6px 12px;
    }

    .search-info {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
        text-align: center;
    }

    .pagination {
        padding: 12px;
    }

    .product-card.small {
        width: 150px;
        min-width: 150px;
    }
}

/* Широкие экраны */
@media (min-width: 1200px) {
    .catalog-container {
        max-width: 1200px;
    }

    .catalog-header {
        border-radius: 15px;
        /* Восстанавливаем округление на широких экранах */
    }

    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
        padding: 16px 24px;
    }

    .product-image-container {
        height: 200px;
    }
}

/* Отключаем темную тему полностью */
@media (prefers-color-scheme: dark) {
    :root {
        --tg-theme-bg-color: #ffffff !important;
        --tg-theme-text-color: #1a1a1a;
        --tg-theme-hint-color: #8b8b8b !important;
        --tg-theme-link-color: #00b956 !important;
        --tg-theme-button-color: #00b956 !important;
        --tg-theme-button-text-color: #ffffff !important;
        --tg-theme-secondary-bg-color: #f7f7f7 !important;

        --border-color: #e8e8e8 !important;
        --surface-bg: #f7f7f7 !important;
        --hover-bg: #f0f0f0 !important;
        --card-bg: #ffffff !important;
        --bg-color: #ffffff !important;
        --text-color: #1a1a1a;
    }

    body {
        background: #ffffff !important;
        color: #1a1a1a;
    }

    .currency {
        color: #f91155 !important;
    }

    .price-value {
        color: #f91155 !important;
    }

    .catalog-container {
        background: #ffffff !important;
    }

    .filters-container {
        background: #ffffff !important;
    }

    .products-grid {
        background: #ffffff !important;
    }

    .pagination {
        background: #ffffff !important;
    }
}

/* Анимация загрузки */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Плавные появления */
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Стили для футера */
.site-footer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    text-align: center;
    padding: 12px 0;
    box-shadow: 0 -2px 10px rgba(0, 185, 86, 0.05);
    z-index: 1000;
}


.footer-icons {
    display: flex;
    justify-content: center;
    gap: 24px;
    align-items: center;
}

.footer-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-lime));
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 185, 86, 0.3);
}

.footer-icon:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 185, 86, 0.4);
}


.footer-icon svg {
    stroke: white;
    fill: none;
}

.footer-icon svg[fill="currentColor"] {
    fill: white;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background-color: #fff;
    margin: 20% auto;
    padding: 24px;
    border-radius: 12px;
    width: 90%;
    max-width: 300px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    text-align: center;
    position: relative;
}


.modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.modal-close:hover {
    color: #333;
}

.modal-content h3 {
    margin: 0 0 16px 0;
    color: var(--primary-color);
    font-size: 18px;
    font-weight: 600;
}

.modal-content p {
    margin: 8px 0;
    color: var(--text-color);
}

.modal-content a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.modal-content a:hover {
    text-decoration: underline;
}

.icon-row {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
}

.icon-link {
    text-decoration: none;
    transition: transform 0.3s ease, color 0.3s ease;
}

.icon-link:hover {
    transform: scale(1.2);
    color: #388e3c;
    /* Темнее зелёный */
}

.footer-button {
    display: inline-block;
    padding: 12px 32px;
    background: linear-gradient(135deg, #4CAF50, #32d74b);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 500;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 185, 86, 0.12);
    transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
}

.footer-button:hover {
    background: linear-gradient(135deg, #43a047, #1cc464);
    box-shadow: 0 4px 16px rgba(0, 185, 86, 0.18);
    transform: translateY(-2px) scale(1.03);
}

.faq-container {
    max-width: 600px;
    margin: 32px auto 80px auto;
    padding: 24px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(0, 185, 86, 0.07);
}

.faq-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 24px;
    color: #4CAF50;
    font-weight: 700;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.faq-item {
    border-radius: 12px;
    box-shadow: 0 1px 6px rgba(0, 185, 86, 0.08);
    background: #f7f7f7;
    overflow: hidden;
}

.faq-toggle {
    width: 100%;
    background: linear-gradient(135deg, #4CAF50, #32d74b);
    color: #fff;
    border: none;
    outline: none;
    padding: 18px 20px;
    font-size: 1.1rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 12px 12px 0 0;
}

.faq-toggle.active,
.faq-toggle:hover {
    background: linear-gradient(135deg, #43a047, #1cc464);
}

.faq-content {
    background: #fff;
    color: #222;
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(.4, 0, .2, 1);
    font-size: 1rem;
    border-radius: 0 0 12px 12px;
}

.faq-content p {
    margin: 18px 0;
}

.faq-page {
    max-width: 540px;
    margin: 32px auto 90px auto;
    padding: 0 12px;
}

.faq-main-title {
    text-align: center;
    font-size: 2.1rem;
    margin-bottom: 28px;
    color: #4CAF50;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.faq-blocks {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.faq-block {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 185, 86, 0.08);
    overflow: hidden;
    border: 1px solid #e0e0e0;
    transition: box-shadow 0.2s;
}

.faq-block-toggle {
    width: 100%;
    background: linear-gradient(135deg, #f0fff4 60%, #e8f5ea 100%);
    color: #222;
    border: none;
    outline: none;
    padding: 20px 24px;
    font-size: 1.13rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 16px 16px 0 0;
    transition: background 0.2s;
    position: relative;
}

.faq-block-toggle.active,
.faq-block-toggle:hover {
    background: linear-gradient(135deg, #e8f5ea 60%, #d0f5e0 100%);
}

.faq-block-title {
    color: #4CAF50;
    font-weight: 600;
    font-size: 1.13rem;
    letter-spacing: 0.01em;
}

.faq-block-arrow {
    display: inline-block;
    width: 22px;
    height: 22px;
    margin-left: 12px;
    transition: transform 0.3s cubic-bezier(.4, 0, .2, 1);
    background: none;
    border: none;
    position: relative;
}

.faq-block-arrow::before {
    content: '';
    display: block;
    width: 12px;
    height: 12px;
    border-bottom: 2.5px solid #4CAF50;
    border-right: 2.5px solid #4CAF50;
    transform: rotate(45deg);
    position: absolute;
    left: 5px;
    top: 3px;
    transition: border-color 0.2s;
}

.faq-block-arrow.open {
    transform: rotate(135deg);
}

.faq-block-content {
    background: #fff;
    color: #222;
    padding: 0 24px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(.4, 0, .2, 1);
    font-size: 1rem;
    border-radius: 0 0 16px 16px;
    border-top: 1px solid #e0e0e0;
}

.faq-block-content.open {
    padding: 16px 24px 20px 24px;
}

.faq-block-inner {
    margin: 0;
    color: #222;
    font-size: 1rem;
    line-height: 1.6;
}

.faq-block-content a {
    color: #4CAF50;
    text-decoration: underline;
    transition: color 0.2s;
}

.faq-block-content a:hover {
    color: #388e3c;
}

/* Стили для контролов количества в карточках товаров */
.quantity-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f0f8f3;
    border-radius: 8px;
    padding: 4px;
    width: 100%;
}

.quantity-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: white;
    border-radius: 6px;
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 185, 86, 0.2);
}

.quantity-btn:hover {
    background: var(--primary-color);
    color: white;
}

.quantity-value {
    font-weight: 600;
    font-size: 16px;
    min-width: 24px;
    text-align: center;
}

/* Метка "В корзине" рядом с контролами количества */
.in-cart-label {
    font-size: 12px;
    color: var(--primary-color);
    background: rgba(0, 185, 86, 0.1);
    padding: 4px 8px;
    border-radius: 16px;
    margin-right: 4px;
    white-space: nowrap;
    font-weight: 500;
}

/* Адаптация для маленьких экранов */
@media (max-width: 480px) {
    .quantity-btn {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }

    .quantity-value {
        font-size: 14px;
    }

    .in-cart-label {
        font-size: 10px;
        padding: 2px 6px;
    }
}