/* ==========================================================================
   MODERN PREDICTIVE SEARCH STYLES
   Enhanced with contemporary design patterns and micro-interactions
   ========================================================================== */

/* Main Search Container */
.search-container {
    position: relative;
    width: 100%;
    max-width: 700px;
    margin: 30px auto;
    padding: 0 20px;
}

/* Search Wrapper with Modern Glassmorphism */
.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(148, 163, 184, 0.1);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.1),
        0 1px 3px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.search-wrapper:focus-within {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 
        0 0 0 4px rgba(59, 130, 246, 0.1),
        0 8px 32px rgba(59, 130, 246, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Search Input with Enhanced Typography */
.search-box {
    flex: 1;
    padding: 18px 24px;
    border: none;
    background: transparent;
    color: #f1f5f9;
    font-size: 16px;
    font-weight: 500;
    outline: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: 0.025em;
    transition: all 0.3s ease;
}

.search-box::placeholder {
    color: #64748b;
    font-weight: 400;
    transition: all 0.3s ease;
}

.search-wrapper:focus-within .search-box::placeholder {
    color: #475569;
    transform: translateX(4px);
}

/* Search Icon with Subtle Animation */
.search-icon {
    padding: 12px 20px;
    color: #64748b;
    pointer-events: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-wrapper:focus-within .search-icon {
    color: #3b82f6;
    transform: scale(1.1);
}

/* Clear Button with Hover Effects */
.search-clear-btn {
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 12px;
    margin-right: 8px;
}

.search-clear-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    transform: scale(1.1);
}

.search-clear-btn.visible {
    display: flex;
    animation: fadeInScale 0.3s ease;
}

/* Predictive Results Dropdown with Enhanced Styling */
.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 16px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.2),
        0 8px 16px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

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

/* Individual Search Result Items */
.search-result-item {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.05);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

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

.search-result-item:hover {
    background: rgba(59, 130, 246, 0.1);
    transform: translateX(4px);
}

.search-result-item.highlighted {
    background: rgba(59, 130, 246, 0.15);
    transform: translateX(4px);
}

.search-result-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
    margin-top: 2px;
}

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

.search-result-title {
    font-size: 15px;
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 4px;
    line-height: 1.3;
}

.search-result-description {
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-result-type {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 8px;
    display: inline-block;
}

/* No Results State */
.search-no-results {
    padding: 40px 20px;
    text-align: center;
    color: #64748b;
}

.search-no-results-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.search-no-results-text {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
    color: #94a3b8;
}

.search-no-results-subtext {
    font-size: 14px;
    color: #64748b;
    line-height: 1.5;
}

/* Search Highlighting */
.search-highlight {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    font-weight: 600;
    border-radius: 4px;
    padding: 2px 4px;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.1);
}

/* Quick Actions Section */
.search-quick-actions {
    padding: 16px 20px;
    background: rgba(30, 41, 59, 0.5);
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.search-quick-action {
    padding: 8px 16px;
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 20px;
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-quick-action:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.3);
    color: #60a5fa;
    transform: translateY(-1px);
}

/* Loading State */
.search-loading {
    padding: 24px;
    text-align: center;
    color: #64748b;
}

.search-loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(148, 163, 184, 0.2);
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
}

.search-loading-text {
    font-size: 14px;
    color: #94a3b8;
    font-weight: 500;
}

/* ==========================================================================
   FILTER TAGS - Modern Pill Design
   ========================================================================== */

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 25px 0 40px 0;
    justify-content: center;
    padding: 0 20px;
}

.filter-tag {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(10px);
    color: #94a3b8;
    padding: 12px 24px;
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.filter-tag::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.filter-tag:hover::before {
    left: 100%;
}

.filter-tag:hover,
.filter-tag.active {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #ffffff;
    border-color: #3b82f6;
    box-shadow: 
        0 8px 20px rgba(59, 130, 246, 0.3),
        0 4px 8px rgba(59, 130, 246, 0.2);
    transform: translateY(-2px);
}

/* ==========================================================================
   ANIMATIONS & KEYFRAMES
   ========================================================================== */

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 768px) {
    .search-container {
        padding: 0 16px;
        margin: 20px auto;
    }
    
    .search-wrapper {
        border-radius: 16px;
    }
    
    .search-box {
        padding: 16px 20px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .search-icon {
        padding: 12px 16px;
    }
    
    .search-results {
        max-height: 300px;
        border-radius: 12px;
    }
    
    .filter-tags {
        gap: 8px;
        padding: 0 16px;
    }
    
    .filter-tag {
        padding: 10px 18px;
        font-size: 13px;
    }
    
    .search-result-item {
        padding: 14px 16px;
    }
    
    .search-result-icon {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .search-container {
        margin: 16px auto;
    }
    
    .search-wrapper {
        border-radius: 12px;
    }
    
    .search-box {
        padding: 14px 16px;
    }
    
    .filter-tags {
        gap: 6px;
        margin: 20px 0 30px 0;
    }
    
    .filter-tag {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    .search-quick-actions {
        gap: 6px;
    }
    
    .search-quick-action {
        padding: 6px 12px;
        font-size: 11px;
    }
}

/* ==========================================================================
   ACCESSIBILITY & FOCUS STATES
   ========================================================================== */

.search-wrapper:focus-within {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.filter-tag:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.search-result-item:focus {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .search-wrapper,
    .search-box,
    .search-results,
    .filter-tag,
    .search-result-item {
        transition: none;
    }
    
    .search-loading-spinner {
        animation: none;
    }
    
    .filter-tag::before {
        display: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .search-wrapper {
        border-color: #ffffff;
    }
    
    .search-box {
        color: #ffffff;
    }
    
    .search-results {
        border-color: #ffffff;
    }
    
    .filter-tag {
        border-color: #ffffff;
    }
}