/* Стили для счетчика корзины - позиция снизу справа как у донора */
.cart-count {
    position: absolute;
    bottom: -8px;
    right: -8px;
    background-color: #ef4444;
    border-radius: 50%;
    height: 2.5vh;
    width: 2.5vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5vh;
    font-weight: 600;
    min-width: 2.5vh;
    min-height: 2.5vh;
    font-family: 'Rubik-Medium', sans-serif;
}

@media (max-width: 1024px) {
    .cart-count {
        right: 1.3vh;
        bottom: 11vh;
        top: auto;
    }
}

/* Скрытие счетчика если корзина пуста */
.cart-count:empty,
.cart-count[data-count="0"] {
    display: none;
}

/* Стили для карточек категорий - серый фон как у донора */
.category-card {
    background-color: #f2f2f2;
    border-radius: 1vh;
    transition: all 0.2s ease-in-out;
}

.category-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

/* Кликабельное название товара */
.product-title-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.product-title-link:hover {
    color: var(--color-blue);
}

/* Стили для выпадающего поиска */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 1vh;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 0.5vh;
    display: none;
}

.search-dropdown::-webkit-scrollbar {
    width: 6px;
}

.search-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.search-dropdown::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.search-dropdown::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.search-item {
    display: flex;
    align-items: center;
    padding: 1vh 1.5vh;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.search-item:last-child {
    border-bottom: none;
}

.search-item:hover {
    background-color: #f8f9fa;
}

.search-item-image {
    width: 50px;
    height: 50px;
    object-fit: contain;
    margin-right: 1.5vh;
    border-radius: 0.5vh;
    background: #f5f5f5;
}

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

.search-item-title {
    font-size: 1.8vh;
    font-weight: 500;
    color: #333;
    margin-bottom: 0.3vh;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-item-sku {
    font-size: 1.4vh;
    color: #888;
    display: block;
    margin-bottom: 0.3vh;
}

.search-item-price {
    font-size: 1.6vh;
    font-weight: 600;
    color: var(--color-blue, #0066cc);
}

.search-loading,
.search-no-results,
.search-error {
    padding: 2vh;
    text-align: center;
    color: #666;
    font-size: 1.6vh;
}

.search-error {
    color: #dc3545;
}

/* Стили для кликабельных названий в корзине */
.cart-item-name-link {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

.cart-item-name-link:hover {
    color: var(--color-blue, #0066cc);
}

.cart-item-name-link:hover .cart-item-name {
    color: var(--color-blue, #0066cc);
}

/* Стили для страницы результатов поиска */
.search-results-page {
    padding: 3vh 5vh;
    max-width: 1400px;
    margin: 0 auto;
}

.search-results-title {
    font-size: 3vh;
    font-weight: 600;
    margin-bottom: 3vh;
    color: #333;
}

.search-results-count {
    font-size: 2vh;
    color: #666;
    margin-bottom: 2vh;
}

.search-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2vh;
}

.search-result-item {
    background: white;
    border-radius: 1vh;
    padding: 2vh;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
}

.search-result-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.search-result-image {
    width: 100%;
    height: 150px;
    object-fit: contain;
    margin-bottom: 1.5vh;
}

.search-result-title {
    font-size: 1.8vh;
    font-weight: 500;
    margin-bottom: 1vh;
    color: #333;
}

.search-result-title a {
    color: inherit;
    text-decoration: none;
}

.search-result-title a:hover {
    color: var(--color-blue, #0066cc);
}

.search-result-sku {
    font-size: 1.4vh;
    color: #888;
    margin-bottom: 1vh;
}

.search-result-price {
    font-size: 2vh;
    font-weight: 600;
    color: var(--color-blue, #0066cc);
    margin-bottom: 1.5vh;
}

.search-result-btn {
    display: block;
    width: 100%;
    padding: 1vh 2vh;
    background: var(--color-blue, #0066cc);
    color: white;
    text-align: center;
    border-radius: 0.5vh;
    text-decoration: none;
    font-size: 1.6vh;
    transition: background 0.2s ease;
}

.search-result-btn:hover {
    background: var(--color-dark-blue, #0052a3);
    color: white;
}

/* ИСПРАВЛЕНИЕ: Кнопка "Добавить в корзину" - увеличиваем z-index для правильного клика */
.add_to_cart_button,
.ajax_add_to_cart {
    position: relative;
    z-index: 10;
}

/* ИСПРАВЛЕНИЕ: Поиск на мобильных устройствах - скрыт по умолчанию, открывается по клику */
@media (max-width: 1024px) {
    /* Контейнер поиска на мобильных */
    .mobile-search-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        background: var(--color-dark-gray, #2a2a2a);
        padding: 1vh 2vh;
        z-index: 100;
        display: none;
        flex-direction: column;
        gap: 1vh;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }
    
    .mobile-search-container.active {
        display: flex;
    }
    
    /* Поле поиска на мобильных - скрыто по умолчанию */
    #productTitleSearch {
        display: none !important;
    }
    
    /* Показываем поле поиска когда контейнер активен */
    .mobile-search-container #productTitleSearch,
    .search-input-visible {
        display: block !important;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        font-size: 16px !important; /* Предотвращает зум на iOS */
        width: 100% !important;
        max-width: 100% !important;
    }
    
    #searchButton {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    .search-dropdown {
        max-height: 60vh;
        left: 0;
        right: 0;
        width: 100%;
    }
    
    /* Кнопка закрытия поиска на мобильных */
    .mobile-search-close {
        align-self: flex-end;
        color: white;
        font-size: 2.5vh;
        cursor: pointer;
        padding: 0.5vh 1vh;
    }
    
    /* ИСПРАВЛЕНИЕ: Размеры иконок на мобильных - точно как на сайте-доноре foton61.ru */
    /* Иконка поиска - одинаковый размер с иконкой корзины */
    #searchButton {
        padding-top: 1.7vh !important;
        padding-bottom: 1.7vh !important;
        padding-left: 1.44vh !important;
        padding-right: 1.44vh !important;
    }
    
    #searchButton img {
        width: 2.7vh !important;
        height: auto !important;
    }
    
    /* Иконка модели - одинаковый размер */
    #modelsButton {
        padding-top: 1.9vh !important;
        padding-bottom: 1.9vh !important;
        padding-left: 1.44vh !important;
        padding-right: 1.44vh !important;
    }
    
    #modelsButton img {
        width: 2.7vh !important;
        height: auto !important;
    }
    
    /* Иконка корзины - одинаковый размер */
    #cartButton {
        padding-top: 1.2vh !important;
        padding-bottom: 1.2vh !important;
        padding-left: 1.44vh !important;
        padding-right: 1.44vh !important;
        height: auto !important;
    }
    
    #cartButton img {
        width: 2.7vh !important;
        height: auto !important;
    }
}

/* На десктопе поиск всегда виден */
@media (min-width: 1025px) {
    #productTitleSearch {
        display: block !important;
    }
    
    /* Десктопные размеры иконок */
    #searchButton img,
    #modelsButton img,
    #cartButton img {
        width: 30px !important;
        height: auto !important;
    }
}

header {
	height: 78vh !important;
}

.icon-hover img {
    transition: filter 0.2s ease;
}
.icon-hover:hover img {
    filter: brightness(0.75);
}
