/**
 * Chapman Store - Search Styles
 * Стили для улучшенного поиска
 */

/* Подсветка результатов поиска */
.search-highlight {
    background-color: #ffeb3b;
    color: #000;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
}

/* Анимация для поля поиска */
.search-box input:focus,
.filter-form input:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    border-color: #6366f1;
    transition: all 0.3s ease;
}

/* Сообщение об ошибке валидации */
.invalid-feedback {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #dc3545;
}

.is-invalid {
    border-color: #dc3545 !important;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* Индикатор загрузки */
.search-loading {
    position: relative;
}

.search-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 10px;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Стили для страницы результатов поиска */
.search-results-header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    padding: 2rem 0;
    margin-bottom: 2rem;
    border-radius: 8px;
}

.search-results-header h2 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 600;
}

.search-results-count {
    font-size: 1rem;
    opacity: 0.9;
    margin-top: 0.5rem;
}

/* Стили для breadcrumb на странице поиска */
.breadcrumb-one-content__desc strong {
    color: #6366f1;
    font-weight: 600;
}

/* Дополнительные отступы для страницы результатов поиска */
.all-product .products-container {
    margin-top: 0;
}

/* Убираем лишние отступы когда сайдбар скрыт */
.col-xl-12.col-lg-12 .products-container {
    padding: 0;
}

/* Пустой результат поиска */
.empty-search-result {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-search-result i {
    font-size: 4rem;
    color: #ccc;
    margin-bottom: 1rem;
}

.empty-search-result h3 {
    color: #666;
    margin-bottom: 1rem;
}

.empty-search-result p {
    color: #999;
}

/* Подсказка о горячих клавишах */
.search-hotkey-hint {
    position: relative;
}

.search-hotkey-hint::after {
    content: attr(data-hotkey);
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: #999;
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.search-hotkey-hint:not(:focus)::after {
    opacity: 0.7;
}

@media (max-width: 768px) {
    .search-hotkey-hint::after {
        display: none;
    }
}

/* Улучшенная кнопка поиска */
.btn-search {
    position: relative;
    overflow: hidden;
}

.btn-search:hover {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

.btn-search:active {
    transform: scale(0.95);
}

/* Анимация для иконки поиска */
.search-icon-animation {
    animation: searchPulse 2s ease-in-out infinite;
}

@keyframes searchPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Автодополнение поиска (для будущего расширения) */
.search-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

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

.search-autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

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

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

.search-autocomplete-item .match {
    font-weight: 600;
    color: #6366f1;
}

/* Категория в автодополнении */
.search-autocomplete-category {
    font-size: 0.75rem;
    color: #999;
    margin-left: 0.5rem;
}

/* История поиска (dropdown) */
.search-history-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    animation: slideDown 0.2s ease;
}

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

.search-history-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    font-weight: 600;
    font-size: 14px;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-history-header i {
    font-size: 16px;
}

.search-history-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #333;
}

.search-history-item:hover {
    background-color: #f8f9fa;
    padding-left: 20px;
}

.search-history-item i {
    color: #999;
    font-size: 14px;
    min-width: 16px;
}

.search-history-item span {
    flex: 1;
    font-size: 14px;
}

.search-history-item:last-of-type {
    border-bottom: 1px solid #e0e0e0;
}

.search-history-clear {
    padding: 12px 16px;
    text-align: center;
    color: #dc3545;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 0 0 8px 8px;
}

.search-history-clear:hover {
    background-color: #fff5f5;
    color: #c82333;
}

.search-history-clear i {
    font-size: 14px;
}

/* История поиска */
.search-history {
    margin-top: 1rem;
}

.search-history-title {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.search-history-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.search-history-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: #f5f5f5;
    border-radius: 16px;
    font-size: 0.875rem;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-history-item:hover {
    background: #e0e0e0;
    color: #333;
}

.search-history-item i {
    font-size: 0.75rem;
}

.search-history-clear {
    color: #999;
    font-size: 0.75rem;
    cursor: pointer;
    margin-left: 0.5rem;
}

.search-history-clear:hover {
    color: #dc3545;
}

/* Улучшенный дизайн для мобильных */
@media (max-width: 576px) {
    .search-box {
        margin-bottom: 1rem;
    }
    
    .search-results-header {
        padding: 1.5rem 1rem;
    }
    
    .search-results-header h2 {
        font-size: 1.5rem;
    }
    
    .empty-search-result {
        padding: 3rem 1rem;
    }
}

/* Адаптация для тёмной темы (опционально) */
@media (prefers-color-scheme: dark) {
    .search-highlight {
        background-color: #ffc107;
        color: #000;
    }
    
    .search-autocomplete {
        background: #2a2a2a;
        border-color: #444;
    }
    
    .search-autocomplete-item {
        border-color: #444;
        color: #eee;
    }
    
    .search-autocomplete-item:hover {
        background-color: #333;
    }
}
