/* Enhanced Search Bar Styles */
.enhanced-search-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

/* Remove all ugly browser default outlines and borders */
.enhanced-search-container *,
.enhanced-search-container *:focus,
.enhanced-search-container *:focus-visible,
.enhanced-search-container *:active {
    outline: none !important;
    border-color: inherit !important;
}

.enhanced-search-container input,
.enhanced-search-container button {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.enhanced-search-box {
    position: relative;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 25px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.enhanced-search-box:hover {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    transform: translateY(-1px);
}

.enhanced-search-box.focused {
    border-color: rgba(229, 9, 20, 0.6);
    box-shadow: 0 0 0 2px rgba(229, 9, 20, 0.15), 0 8px 32px rgba(0, 0, 0, 0.3);
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.search-input-container {
    display: flex;
    align-items: center;
    padding: 0 20px;
    position: relative;
}

.enhanced-search-input {
    width: 100%;
    padding: 15px 15px 15px 45px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 16px;
    font-weight: 400;
    outline: none;
    transition: all 0.3s ease;
}

.enhanced-search-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
    font-weight: 300;
}

.search-icon {
    position: absolute;
    left: 15px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 18px;
    transition: all 0.3s ease;
    z-index: 2;
}

.enhanced-search-box.focused .search-icon {
    color: #e50914;
    transform: scale(1.1);
}

.search-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
}

.search-clear-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s ease;
    opacity: 0;
    transform: scale(0.8);
}

.search-clear-btn.visible {
    opacity: 1;
    transform: scale(1);
}

.search-clear-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.search-filters-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
    outline: none;
}

.search-filters-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.search-filters-btn.active {
    background: linear-gradient(135deg, #e50914 0%, #b91c1c 100%);
    border-color: #e50914;
    color: #fff;
    box-shadow: 0 0 0 2px rgba(229, 9, 20, 0.2), 0 4px 12px rgba(229, 9, 20, 0.3);
}

/* Search Suggestions Dropdown */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: none;
    border-radius: 0 0 20px 20px;
    backdrop-filter: blur(20px);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.search-suggestions.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.suggestions-header {
    padding: 15px 20px 10px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.suggestion-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.suggestion-item:hover,
.suggestion-item.selected {
    background: rgba(229, 9, 20, 0.1);
    border-left: 3px solid #e50914;
}

.suggestion-poster {
    width: 40px;
    height: 60px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    margin-right: 15px;
    overflow: hidden;
    flex-shrink: 0;
}

.suggestion-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.suggestion-content {
    flex: 1;
    min-width: 0;
}

.suggestion-title {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.suggestion-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.suggestion-year {
    font-weight: 500;
}

.suggestion-rating {
    display: flex;
    align-items: center;
    gap: 4px;
}

.suggestion-type {
    background: rgba(229, 9, 20, 0.2);
    color: #e50914;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.6);
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top: 2px solid #e50914;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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

.no-results {
    padding: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
}

.no-results-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.3;
}

/* Search Filters Panel */
.search-filters-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(15, 15, 15, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0 0 20px 20px;
    padding: 20px;
    backdrop-filter: blur(20px);
    z-index: 999;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.search-filters-panel.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-label {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-option {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
    padding: 6px 12px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.filter-option:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.filter-option.active {
    background: #e50914;
    border-color: #e50914;
    color: #fff;
}

/* Quick Search Section */
.quick-search {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.quick-search-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
}

.quick-search-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-search-item {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
    padding: 6px 12px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.quick-search-item:hover {
    background: rgba(229, 9, 20, 0.2);
    color: #e50914;
}

/* Keyboard Shortcuts Hint */
.search-shortcuts {
    position: absolute;
    bottom: 10px;
    right: 15px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.enhanced-search-box.focused .search-shortcuts {
    opacity: 1;
}

.kbd {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    padding: 2px 6px;
    margin: 0 2px;
    font-size: 10px;
}

/* Global Loading Overlay */
#searchLoadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 4000;
    backdrop-filter: blur(8px);
}

#searchLoadingOverlay.visible {
    display: flex;
}

#searchLoadingOverlay .loading-overlay-content {
    text-align: center;
    color: #fff;
    font-family: 'Space Grotesk', 'Inter', sans-serif;
}

#searchLoadingOverlay .loading-message {
    margin-top: 20px;
    font-size: 18px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
}

.loading-spinner.large {
    width: 60px;
    height: 60px;
    border-width: 4px;
    border-color: rgba(255, 255, 255, 0.2);
    border-top-color: #e50914;
    margin: 0 auto;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .enhanced-search-container {
        max-width: 100%;
    }
    
    .enhanced-search-input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px 12px 12px 40px;
    }
    
    .search-filters-btn {
        display: none; /* Hide filters on mobile to save space */
    }
    
    .suggestion-poster {
        width: 35px;
        height: 50px;
        margin-right: 12px;
    }
    
    .suggestion-title {
        font-size: 13px;
    }
    
    .suggestion-meta {
        font-size: 11px;
    }
    
    .search-shortcuts {
        display: none;
    }
}

/* Animation for search results */
.suggestion-item {
    animation: slideInUp 0.3s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

.suggestion-item:nth-child(1) { animation-delay: 0.1s; }
.suggestion-item:nth-child(2) { animation-delay: 0.15s; }
.suggestion-item:nth-child(3) { animation-delay: 0.2s; }
.suggestion-item:nth-child(4) { animation-delay: 0.25s; }
.suggestion-item:nth-child(5) { animation-delay: 0.3s; }

@keyframes slideInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Focus ring for accessibility - Remove ugly outlines */
.enhanced-search-input:focus,
.enhanced-search-input:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

.search-filters-btn:focus,
.search-filters-btn:focus-visible {
    outline: none !important;
}

.suggestion-item:focus,
.suggestion-item:focus-visible {
    outline: none !important;
    background: rgba(229, 9, 20, 0.15) !important;
    border-left: 3px solid #e50914 !important;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .enhanced-search-box {
        border-color: #fff;
        background: rgba(0, 0, 0, 0.8);
    }
    
    .enhanced-search-input::placeholder {
        color: #ccc;
    }
    
    .search-suggestions {
        background: #000;
        border-color: #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .enhanced-search-box,
    .search-suggestions,
    .suggestion-item {
        transition: none;
    }
    
    .loading-spinner {
        animation: none;
    }
}
