/* ===================== */
/* ПРОФЕССИОНАЛЬНАЯ СИСТЕМА ПОИСКА */
/* ===================== */

/* Контейнер формы поиска */
#search-form-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

/* Форма поиска */
#search-form {
    position: relative !important;
    display: block !important;
    width: 100% !important;
}

/* Поле ввода поиска */
.search-input {
    width: 100% !important;
    padding: 16px 70px 16px 20px !important; /* Добавляем место для кнопки справа */
    border-radius: 16px !important;
    border: 2px solid #e2e8f0 !important;
    background-color: #f8fafc !important;
    font-size: 18px !important;
    color: #1e293b !important;
    outline: none !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.03) !important;
    transition: all 0.3s ease !important;
    height: 60px !important;
    box-sizing: border-box !important;
    text-align: left !important;
    display: block !important;
    margin: 0 !important;
}

.search-input::placeholder {
    color: #94a3b8;
    transition: color 0.2s ease;
}

.dark-mode .search-input {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15) !important;
}

.dark-mode .search-input::placeholder {
    color: #64748b;
}

.search-input:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15), 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
    transform: translateY(-1px) !important;
}

.dark-mode .search-input:focus {
    border-color: #60a5fa !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25), 0 0 0 3px rgba(96, 165, 250, 0.2) !important;
}

/* Кнопка поиска */
.search-button {
    position: absolute !important;
    right: 8px !important;
    top: 8px !important;
    bottom: 8px !important;
    background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
    color: white !important;
    border: none !important;
    border-radius: 12px !important;
    width: 44px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2) !important;
    z-index: 10 !important;
    margin: auto 0 !important;
}

.search-button:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
    transform: scale(1.05) !important;
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3) !important;
}

.search-button:active {
    transform: scale(0.95) !important;
    box-shadow: 0 1px 2px rgba(59, 130, 246, 0.2) !important;
}

.search-button i {
    font-size: 16px !important;
}

.search-button:disabled {
    background: #94a3b8 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

.dark-mode .search-button:disabled {
    background: #475569 !important;
}

/* Контейнер результатов поиска */
#results {
    margin-top: 30px;
    padding: 0;
}

/* Карточка результата поиска */
.search-result-card {
    display: flex;
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 2px solid #e2e8f0;
    margin-bottom: 20px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, box-shadow;
    position: relative;
}

.search-result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: #3b82f6;
}

.search-result-card.in-stock {
    border-left: 4px solid #10b981;
}

.search-result-card.out-of-stock {
    border-left: 4px solid #ef4444;
    opacity: 0.85;
}

.dark-mode .search-result-card {
    background-color: #1e293b;
    border-color: #334155;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.dark-mode .search-result-card:hover {
    border-color: #60a5fa;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

/* Контейнер изображения с улучшениями */
.result-image-container {
    width: 200px;
    min-height: 100%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    position: relative;
    overflow: hidden;
}

.dark-mode .result-image-container {
    background: linear-gradient(135deg, #0f172a, #1e293b);
}

.result-image {
    width: 100%;
    height: 100%;
    min-height: 180px;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
    border-radius: 4px;
}

.search-result-card:hover .result-image {
    transform: scale(1.05);
}

.no-image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    text-align: center;
    padding: 20px;
    height: 180px;
}

.no-image-placeholder i {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.no-image-placeholder span {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.6;
}

/* Бейдж "Оригинал" с улучшенным дизайном */
.original-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Бейдж с логотипом бренда - увеличенный */
.brand-logo-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.95);
    padding: 12px;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    z-index: 10;
}

.brand-logo-badge:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.brand-logo-badge img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    display: block;
    border-radius: 6px;
}

.dark-mode .brand-logo-badge {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(51, 65, 85, 0.8);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Контент карточки с улучшенной структурой */
.result-content {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 200px;
}

/* Заголовок с артикулом и ценой */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 20px;
}

.result-part-number {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #3b82f6;
    font-weight: 700;
    font-size: 17px;
    font-family: 'Ubuntu Mono', monospace;
}

.result-part-number i {
    color: #94a3b8;
    font-size: 15px;
}

.result-price {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #059669;
    font-weight: 700;
    font-size: 17px;
    white-space: nowrap;
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.1), rgba(16, 185, 129, 0.1));
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(5, 150, 105, 0.2);
}

.result-price i {
    font-size: 14px;
}

/* Название запчасти с улучшенной типографикой */
.result-name {
    font-size: 19px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 12px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dark-mode .result-name {
    color: #f1f5f9;
}

/* Описание с ограничением высоты */
.result-description {
    font-size: 14px;
    color: #64748b;
    margin: 0 0 16px 0;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dark-mode .result-description {
    color: #94a3b8;
}

/* Информация о бренде с логотипом */
.result-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #64748b;
    font-size: 15px;
    margin-bottom: 16px;
    padding: 8px 12px;
    background-color: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.result-brand i {
    color: #94a3b8;
    font-size: 14px;
}

.result-brand-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 4px;
}

.result-weight {
    color: #94a3b8;
    font-size: 13px;
    font-weight: 500;
}

.dark-mode .result-brand {
    color: #94a3b8;
    background-color: #334155;
    border-color: #475569;
}

/* Улучшенная информация о наличии */
.result-stock-info {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.8), rgba(241, 245, 249, 0.8));
    border: 1px solid #e2e8f0;
}

.result-in-stock {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #059669;
    font-size: 15px;
    font-weight: 600;
}

.result-in-stock i {
    font-size: 14px;
    color: #10b981;
}

.result-out-of-stock {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #dc2626;
    font-size: 15px;
    font-weight: 600;
}

.result-out-of-stock i {
    font-size: 14px;
    color: #ef4444;
}

.warehouses-info {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #64748b;
    font-size: 14px;
    cursor: help;
    padding: 4px 8px;
    background-color: rgba(148, 163, 184, 0.1);
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.warehouses-info:hover {
    background-color: rgba(148, 163, 184, 0.2);
}

.warehouses-info i {
    font-size: 13px;
}

.dark-mode .result-stock-info {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.6), rgba(51, 65, 85, 0.6));
    border-color: #475569;
}

/* Улучшенная метаинформация с иконками */
.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.result-has-diagram,
.result-models,
.result-specs,
.result-units,
.result-categories {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 12px;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.result-has-diagram:hover,
.result-models:hover,
.result-specs:hover,
.result-units:hover,
.result-categories:hover {
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    transform: translateY(-1px);
}

.result-has-diagram i {
    color: #8b5cf6;
    font-size: 12px;
}

.result-models i {
    color: #f59e0b;
    font-size: 12px;
}

.result-specs i {
    color: #06b6d4;
    font-size: 12px;
}

.result-units i {
    color: #84cc16;
    font-size: 12px;
}

.result-categories i {
    color: #ec4899;
    font-size: 12px;
}

.dark-mode .result-has-diagram,
.dark-mode .result-models,
.dark-mode .result-specs,
.dark-mode .result-units,
.dark-mode .result-categories {
    background: linear-gradient(135deg, #334155, #475569);
    border-color: #475569;
    color: #94a3b8;
}

/* Информация о совместимости */
.result-compatibility {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(99, 102, 241, 0.05));
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.result-compatibility-title {
    font-size: 13px;
    font-weight: 600;
    color: #3b82f6;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.result-compatibility-title i {
    font-size: 12px;
}

.result-compatibility-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-compatibility-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.result-compatibility-section-title {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 4px;
}

.result-compatibility-section-title i {
    font-size: 11px;
}

.result-compatibility-units,
.result-compatibility-models,
.result-compatibility-categories {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 13px;
    color: #64748b;
    line-height: 1.4;
    margin-left: 16px;
}

.dark-mode .result-compatibility {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(99, 102, 241, 0.1));
    border-color: rgba(96, 165, 250, 0.3);
}

.dark-mode .result-compatibility-title {
    color: #60a5fa;
}

.dark-mode .result-compatibility-section-title {
    color: #94a3b8;
}

.dark-mode .result-compatibility-units,
.dark-mode .result-compatibility-models,
.dark-mode .result-compatibility-categories {
    color: #94a3b8;
}

/* Улучшенные действия */
.result-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: auto;
}

.result-view-details {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #3b82f6;
    text-decoration: none;
    font-weight: 600;
    padding: 12px 20px;
    border: 2px solid #3b82f6;
    border-radius: 12px;
    transition: all 0.2s ease;
    font-size: 14px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(99, 102, 241, 0.05));
}

.result-view-details:hover {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.result-view-details i {
    font-size: 13px;
}

.result-add-to-cart {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.result-add-to-cart:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.result-add-to-cart i {
    font-size: 13px;
}

/* Подсветка поискового запроса */
.highlight {
    background: linear-gradient(135deg, #fef3c7, #fed7aa);
    color: #92400e;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 600;
}

.dark-mode .highlight {
    background: linear-gradient(135deg, #451a03, #78350f);
    color: #fbbf24;
}

/* Кнопка "Показать ещё" */
.load-more-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 30px 0;
    width: 100%;
}

.load-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2);
}

.load-more-btn:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(59, 130, 246, 0.3);
}

.load-more-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.load-more-btn i {
    font-size: 14px;
}

/* Индикатор загрузки */
.loading-indicator {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 40px 0;
    gap: 16px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: #64748b;
    font-size: 16px;
    font-weight: 500;
}

.dark-mode .loading-spinner {
    border-color: #334155;
    border-top-color: #60a5fa;
}

.dark-mode .loading-text {
    color: #94a3b8;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Сообщение "Ничего не найдено" */
.no-results-message {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.no-results-message i {
    font-size: 64px;
    color: #94a3b8;
    margin-bottom: 20px;
}

.no-results-message h3 {
    color: #1e293b;
    margin-bottom: 12px;
    font-size: 24px;
}

.no-results-message p {
    margin-bottom: 30px;
    font-size: 16px;
}

.search-tips {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    margin: 0 auto;
}

.search-tip {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    padding: 12px;
    background-color: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.search-tip i {
    font-size: 16px !important;
    color: #fbbf24;
    flex-shrink: 0;
}

.search-tip p {
    margin: 0;
    font-size: 14px;
    color: #4b5563;
}

.dark-mode .no-results-message h3 {
    color: #f1f5f9;
}

.dark-mode .no-results-message {
    color: #94a3b8;
}

.dark-mode .search-tip {
    background-color: #1e293b;
    border-color: #334155;
}

.dark-mode .search-tip p {
    color: #d1d5db;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .search-input {
        font-size: 16px;
        height: 54px;
        padding: 14px 60px 14px 16px;
    }
    
    .search-button {
        width: 40px;
        height: 40px;
        right: 7px;
    }
    
    .search-button i {
        font-size: 14px;
    }
    
    .search-result-card {
        flex-direction: column;
        margin-bottom: 16px;
    }
    
    .result-image-container {
        width: 100%;
        min-height: 150px;
        max-height: 150px;
    }
    
    /* Адаптивные размеры логотипа бренда для мобильных */
    .brand-logo-badge {
        top: 12px;
        right: 12px;
        padding: 8px;
        border-radius: 12px;
    }
    
    .brand-logo-badge img {
        width: 36px;
        height: 36px;
    }
    
    .result-content {
        padding: 16px;
        min-height: auto;
    }
    
    .result-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .result-name {
        font-size: 17px;
    }
    
    .result-meta {
        gap: 8px;
    }
    
    .result-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .result-view-details,
    .result-add-to-cart {
        width: 100%;
        justify-content: center;
        padding: 10px 16px;
    }
    
    .search-tips {
        gap: 8px;
    }
    
    .search-tip {
        padding: 8px;
    }
}

@media (max-width: 576px) {
    .search-input {
        height: 50px;
        font-size: 15px;
        padding: 12px 55px 12px 14px;
    }
    
    .search-button {
        width: 36px;
        height: 36px;
        right: 7px;
    }
    
    .search-button i {
        font-size: 13px;
    }
    
    /* Еще меньшие размеры логотипа бренда для очень маленьких экранов */
    .brand-logo-badge {
        top: 8px;
        right: 8px;
        padding: 6px;
        border-radius: 10px;
    }
    
    .brand-logo-badge img {
        width: 30px;
        height: 30px;
    }
}

/* ===================== */
/* ВАЛИДАЦИЯ ПОЛЯ ПОИСКА */
/* ===================== */

/* Состояния валидации поля ввода */
.search-input.invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 4px 6px rgba(239, 68, 68, 0.1), 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
    background-color: #fef2f2 !important;
}

.search-input.valid {
    border-color: #10b981 !important;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.1), 0 0 0 3px rgba(16, 185, 129, 0.1) !important;
    background-color: #f0fdf4 !important;
}

.dark-mode .search-input.invalid {
    background-color: #1f1515 !important;
    border-color: #f87171 !important;
}

.dark-mode .search-input.valid {
    background-color: #141f1a !important;
    border-color: #34d399 !important;
}

/* Сообщение валидации */
.search-validation-message {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ef4444;
    font-size: 14px;
    font-weight: 500;
    margin-top: 8px;
    padding: 8px 12px;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    animation: validationSlideIn 0.3s ease-out;
}

.search-validation-message i {
    font-size: 16px;
    flex-shrink: 0;
}

.dark-mode .search-validation-message {
    background-color: #1f1515;
    border-color: #991b1b;
    color: #f87171;
}

@keyframes validationSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Обновляем стили для неактивной кнопки поиска */
.search-button:disabled {
    background: #94a3b8 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
    opacity: 0.6 !important;
}

.search-button:disabled:hover {
    background: #94a3b8 !important;
    transform: none !important;
    box-shadow: none !important;
}

.dark-mode .search-button:disabled {
    background: #475569 !important;
    opacity: 0.5 !important;
}

/* Анимация для плавного перехода состояний */
.search-input {
    transition: all 0.3s ease !important;
}

.search-button {
    transition: all 0.3s ease !important;
}

/* Адаптивность для валидации на мобильных */
@media (max-width: 768px) {
    .search-validation-message {
        font-size: 13px;
        padding: 6px 10px;
        margin-top: 6px;
    }
    
    .search-validation-message i {
        font-size: 14px;
    }
}
