/**
 * 19 Kodu - Search UI Styles
 * Modern, responsive, accessible search interface styles
 */

/* Search Box Container */
.search-box-wrapper {
    position: relative;
    max-width: 400px;
    width: 100%;
}

/* Search Input */
.search-input {
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.search-input:focus {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1), 0 1px 3px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.search-input::placeholder {
    color: #9ca3af;
    transition: color 0.2s ease;
}

.search-input:focus::placeholder {
    color: #d1d5db;
}

/* Dark mode input adjustments */
.dark .search-input {
    background-color: #1f2937;
    border-color: #374151;
    color: #f9fafb;
}

.dark .search-input:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2), 0 1px 3px rgba(0, 0, 0, 0.3);
    border-color: #6366f1;
}

/* Search Dropdown */
.search-dropdown {
    backdrop-filter: blur(8px);
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    animation: searchDropdownSlide 0.15s ease-out;
    border-radius: 0.75rem;
}

@keyframes searchDropdownSlide {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dark .search-dropdown {
    background-color: #1f2937;
    border-color: #374151;
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.3),
        0 10px 10px -5px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* Search Results */
.search-results {
    max-height: 20rem;
    overflow-y: auto;
}

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

.search-results::-webkit-scrollbar-track {
    background: transparent;
}

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

.dark .search-results::-webkit-scrollbar-thumb {
    background: #4b5563;
}

/* Search Result Item */
.search-result-item {
    transition: all 0.15s ease;
    border-radius: 0.5rem;
    border: 1px solid transparent;
}

.search-result-item:hover,
.search-result-item.selected {
    background-color: #f8fafc;
    border-color: #e2e8f0;
    transform: translateX(2px);
}

.dark .search-result-item:hover,
.dark .search-result-item.selected {
    background-color: #374151;
    border-color: #4b5563;
}

.search-result-item.selected {
    background-color: #eef2ff;
    border-color: #c7d2fe;
}

.dark .search-result-item.selected {
    background-color: #312e81;
    border-color: #6366f1;
}

/* Search Result Title */
.search-result-title {
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25;
    margin-bottom: 0.25rem;
}

/* Search Result Preview */
.search-result-preview {
    font-size: 0.8125rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Category Headers */
.search-category {
    margin-bottom: 0.75rem;
}

.search-category:last-child {
    margin-bottom: 0;
}

.search-category-header {
    padding: 0.25rem 0.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #f3f4f6;
}

.dark .search-category-header {
    border-bottom-color: #374151;
}

/* Search Highlighting */
.search-highlight {
    background-color: #fef3c7;
    color: #92400e;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-weight: 700;
    border: 1px solid #fcd34d;
}

.dark .search-highlight {
    background-color: #451a03;
    color: #fbbf24;
    border: 1px solid #f59e0b;
    font-weight: 700;
}

/* Loading State */
.search-loading {
    padding: 1.5rem 1rem;
}

.search-loading svg {
    width: 1rem;
    height: 1rem;
}

/* No Results State */
.search-no-results {
    padding: 2rem 1rem;
}

.search-no-results i {
    width: 2rem;
    height: 2rem;
    margin: 0 auto 0.5rem;
    opacity: 0.5;
}

/* More Results Indicator */
.search-more-results {
    background-color: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.dark .search-more-results {
    background-color: #111827;
    border-top-color: #374151;
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .search-box-wrapper {
        max-width: 100%;
    }
    
    .search-dropdown {
        left: -0.5rem;
        right: -0.5rem;
        max-height: 70vh;
    }
    
    .search-result-item {
        padding: 0.75rem;
    }
    
    .search-results {
        max-height: 16rem;
    }
}

/* Tablet Responsive */
@media (min-width: 641px) and (max-width: 1024px) {
    .search-box-wrapper {
        max-width: 350px;
    }
}

/* Desktop Enhancements */
@media (min-width: 1025px) {
    .search-dropdown {
        border-radius: 0.875rem;
    }
    
    .search-result-item:hover {
        transform: translateX(3px);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    }
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
    .search-input,
    .search-result-item,
    .search-dropdown {
        transition: none;
        animation: none;
        transform: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .search-input {
        border-width: 2px;
    }
    
    .search-result-item.selected {
        border-width: 2px;
        border-color: #4f46e5;
    }
    
    .search-highlight {
        border: 1px solid #92400e;
    }
}

/* Focus Management */
.search-input:focus-visible {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

.search-result-item:focus-visible {
    outline: 2px solid #4f46e5;
    outline-offset: -2px;
}

/* Print Styles */
@media print {
    .search-box-wrapper,
    .search-dropdown {
        display: none;
    }
}