/**
 * Search Component Styles
 * 
 * Styles for the AJAX search dropdown and mobile search interface.
 * Uses CSS custom properties from theme configuration.
 */

/* ============================================================================
   SEARCH DROPDOWN - Desktop Modal Style
   ============================================================================ */

.search-dropdown {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 700px;
    max-width: 90vw;
    max-height: 80vh;
    background: var(--search-bg, #ffffff);
    border-radius: 8px;
    box-shadow: 0 12px 40px var(--search-shadow, rgba(0, 0, 0, 0.2));
    z-index: 2000;
    overflow: hidden;
    border: 1px solid var(--search-border, #dbdbdb);
}

.search-dropdown-content {
    max-height: 420px;
    overflow-y: auto;
}

.search-dropdown-footer {
    padding: 10px;
    background: var(--search-footer-bg, #f5f5f5);
    border-top: 1px solid var(--search-border, #dbdbdb);
}

/* ============================================================================
   SEARCH RESULT ITEMS
   ============================================================================ */

.search-result {
    padding: 12px 16px;
    border-bottom: 1px solid var(--search-result-border, #f0f0f0);
    cursor: pointer;
    transition: background-color 0.15s ease;
    display: block;
    text-decoration: none;
}

.search-result:hover,
.search-result.is-active {
    background-color: var(--search-result-hover, #f8f9fa);
}

.search-result-title {
    font-weight: 600;
    color: var(--text-primary, #363636);
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.search-result-snippet {
    font-size: 0.85rem;
    color: var(--text-secondary, #666666);
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ============================================================================
   SEARCH HIGHLIGHT
   ============================================================================ */

.search-highlight {
    background-color: var(--search-highlight-bg, #fff3cd);
    color: var(--search-highlight-text, #856404);
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
}

/* ============================================================================
   SEARCH STATES
   ============================================================================ */

.search-no-results {
    padding: 24px;
    text-align: center;
    color: var(--search-no-results, #7a7a7a);
}

.search-loading {
    padding: 24px;
    text-align: center;
}

/* ============================================================================
   MOBILE STYLES (max-width: 1023px)
   ============================================================================ */

@media screen and (max-width: 1023px) {
    /* Mobile dropdown override */
    .search-dropdown {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        transform: translate(-50%, -50%) !important;
        width: 90vw !important;
        max-width: 400px !important;
        max-height: 60vh !important;
        margin: 0 !important;
    }
    
    /* Hide desktop search */
    .desktop-search {
        display: none !important;
    }
    
    /* Mobile search toggle button */
    .mobile-search-toggle {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        cursor: pointer;
        margin-left: auto;
        margin-right: 10px;
        background: transparent;
        border: none;
        padding: 8px;
    }
    
    .mobile-search-toggle .sprite-search,
    .mobile-search-toggle i {
        display: inline-block !important;
        width: 20px !important;
        height: 20px !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Navbar brand flex layout */
    .navbar-brand {
        display: flex;
        align-items: center;
    }
    
    /* Mobile search wrapper */
    .navbar-search-wrapper {
        display: none;
    }
    
    .navbar-search-wrapper.is-active {
        display: block;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--search-bg, #ffffff);
        padding: 15px;
        box-shadow: 0 4px 12px var(--shadow-color, rgba(0, 0, 0, 0.1));
        z-index: 1999;
    }
}

/* ============================================================================
   DESKTOP STYLES (min-width: 1024px)
   ============================================================================ */

@media screen and (min-width: 1024px) {
    .mobile-search-toggle {
        display: none !important;
    }
    
    .navbar-search-wrapper {
        display: none !important;
    }
}
