/* Контейнер */
.main-content .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}
/**
 * Стили страницы поиска V2
 */

/* === Страница поиска === */
.search-page {
    padding: 24px 0 48px;
}

/* Заголовок и форма */
.search-header {
    margin-bottom: 32px;
}

.search-title {
    font-size: 28px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 20px;
}

.search-form {
    max-width: 700px;
}

.search-form-inner {
    display: flex;
    gap: 12px;
    background: #fff;
    border: 2px solid #28a745;
    border-radius: 12px;
    padding: 6px;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    padding: 12px 16px;
    background: transparent;
}

.search-input::placeholder {
    color: #999;
}

.search-submit {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #28a745;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.search-submit:hover {
    background: #218838;
}

.search-submit svg {
    width: 20px;
    height: 20px;
}

/* Панель инструментов */
.search-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px 24px;
    padding: 16px 0;
    border-bottom: 1px solid #eee;
    margin-bottom: 24px;
}

.search-count {
    font-size: 15px;
    color: #666;
}

.search-count strong {
    color: #1a1a1a;
}

.search-sort {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-sort label {
    font-size: 14px;
    color: #666;
}

.search-sort select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
}

.search-stock-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    margin-left: auto;
}

.search-stock-filter input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Подсказка по ДВ */
.search-substance-hint {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: #e8f5e9;
    border-radius: 10px;
    margin-bottom: 24px;
    font-size: 14px;
    color: #2e7d32;
}

.search-substance-hint svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.search-substance-hint a {
    color: #1b5e20;
    font-weight: 600;
    text-decoration: none;
}

.search-substance-hint a:hover {
    text-decoration: underline;
}

/* Сетка товаров */
.search-products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

/* Карточка товара */
.product-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
}

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

.product-card.out-of-stock {
    opacity: 0.7;
}

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

.product-card-image {
    aspect-ratio: 1;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
}

.product-card-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-card-info {
    padding: 14px 16px;
}

.product-card-name {
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card-vendor {
    font-size: 12px;
    color: #888;
    margin-top: 6px;
}

.product-card-footer {
    padding: 14px 16px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.product-card-price {
    font-size: 18px;
    font-weight: 700;
    color: #28a745;
}

.product-card-buy {
    padding: 10px 16px;
    background: #28a745;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.product-card-buy:hover {
    background: #218838;
}

.product-card-unavailable {
    font-size: 13px;
    color: #999;
    text-align: center;
    width: 100%;
}

/* Пустые результаты */
.search-empty {
    text-align: center;
    padding: 48px 20px;
    max-width: 500px;
    margin: 0 auto;
}

.search-empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.search-empty h2 {
    font-size: 22px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 12px;
}

.search-empty p {
    font-size: 15px;
    color: #666;
    margin: 0 0 32px;
}

.search-empty-tips {
    text-align: left;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 24px;
}

.search-empty-tips h3 {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 12px;
}

.search-empty-tips ul {
    margin: 0;
    padding-left: 20px;
}

.search-empty-tips li {
    font-size: 14px;
    color: #666;
    margin-bottom: 6px;
}

.search-empty-btn {
    display: inline-block;
    padding: 14px 32px;
    background: #28a745;
    color: #fff;
    text-decoration: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.2s;
}

.search-empty-btn:hover {
    background: #218838;
}

/* Популярные запросы */
.search-popular {
    text-align: center;
    padding: 32px 0;
}

.search-popular h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 20px;
}

.search-popular-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.search-tag {
    display: inline-block;
    padding: 10px 20px;
    background: #f0f0f0;
    color: #333;
    text-decoration: none;
    border-radius: 20px;
    font-size: 14px;
    transition: background 0.2s, color 0.2s;
}

.search-tag:hover {
    background: #28a745;
    color: #fff;
}

/* Пагинация */
.search-pagination {
    margin-top: 40px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.pagination-numbers {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination a,
.pagination-current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.2s;
}

.pagination a {
    color: #333;
    background: #f5f5f5;
}

.pagination a:hover {
    background: #e0e0e0;
}

.pagination-current {
    background: #28a745;
    color: #fff;
    font-weight: 600;
}

.pagination-prev,
.pagination-next {
    font-weight: 500;
}

.pagination-dots {
    padding: 0 8px;
    color: #999;
}

/* === Автодополнение в header === */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    display: none;
}

.search-suggestions.active {
    display: block;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: #333;
    transition: background 0.15s;
    border-bottom: 1px solid #f5f5f5;
}

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

.suggestion-item:hover {
    background: #f8f9fa;
}

.suggestion-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
}

.suggestion-icon svg {
    width: 18px;
    height: 18px;
}

.suggestion-text {
    flex: 1;
    font-size: 14px;
}

.suggestion-count {
    font-size: 12px;
    color: #999;
}

.suggestion-type {
    font-size: 11px;
    color: #888;
    background: #f0f0f0;
    padding: 3px 8px;
    border-radius: 4px;
}

.suggestion-type.substance {
    background: #e3f2fd;
    color: #1976d2;
}

.suggestion-type.category {
    background: #fff3e0;
    color: #f57c00;
}

/* === Responsive === */
@media (max-width: 768px) {
    .search-title {
        font-size: 22px;
    }
    
    .search-form-inner {
        flex-direction: column;
        padding: 8px;
    }
    
    .search-submit {
        justify-content: center;
    }
    
    .search-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .search-stock-filter {
        margin-left: 0;
    }
    
    .search-products {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .product-card-info {
        padding: 10px 12px;
    }
    
    .product-card-name {
        font-size: 13px;
    }
    
    .product-card-footer {
        flex-direction: column;
        gap: 8px;
    }
    
    .product-card-buy {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .search-products {
        grid-template-columns: 1fr;
    }
}
