/* Search Bar Styles */
.search-form {
    position: relative;
    z-index: 1050; /* Higher than Bootstrap modal */
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 1051; /* Even higher to ensure visibility */
    max-height: 400px;
    overflow-y: auto;
    display: none;
    width: 100%;
    min-width: 300px;

.search-suggestions.show {
    display: block;
}

.suggestion-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.suggestion-item:hover {
    background-color: #f8f9fa;
    color: inherit;
    text-decoration: none;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item.active {
    background-color: #e9f4ff;
}

.suggestion-content {
    flex: 1;
}

.suggestion-text {
    font-weight: 500;
    margin-bottom: 2px;
    color: #333;
}

.suggestion-subtitle {
    font-size: 0.85em;
    color: #666;
}

.suggestion-icon {
    margin-right: 12px;
    width: 20px;
    text-align: center;
    color: #d4af37;
}

.suggestion-type-product .suggestion-icon::before {
    content: '\f10b'; /* fa-mobile */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

.suggestion-type-brand .suggestion-icon::before {
    content: '\f02d'; /* fa-bookmark */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

.search-loading {
    padding: 12px 16px;
    text-align: center;
    color: #666;
    font-style: italic;
}

.search-no-results {
    padding: 12px 16px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* Dark mode support */
.dark-mode .search-suggestions {
    background: #2c2c2c;
    border-color: #444;
    color: #e0e0e0;
}

.dark-mode .suggestion-item {
    border-bottom-color: #444;
}

.dark-mode .suggestion-item:hover {
    background-color: #3a3a3a;
}

.dark-mode .suggestion-item.active {
    background-color: #1a3a5c;
}

.dark-mode .suggestion-text {
    color: #e0e0e0;
}

.dark-mode .suggestion-subtitle {
    color: #bbb;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .search-form {
        z-index: 1052; /* Even higher for mobile */
    }
    
    .search-suggestions {
        border-radius: 0 0 4px 4px;
        max-height: 70vh; /* Use viewport height for better mobile display */
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
        min-width: unset; /* Remove min-width constraint on mobile */
        left: -5px; /* Small offset to prevent edge cutting */
        right: -5px; /* Small offset to prevent edge cutting */
        border-left: 1px solid #ddd;
        border-right: 1px solid #ddd;
    }
    
    .suggestion-item {
        padding: 12px 16px; /* Larger padding for touch */
        min-height: 48px; /* Touch-friendly height */
        display: flex;
        align-items: center;
    }
    
    .suggestion-icon {
        margin-right: 12px;
        width: 20px;
        flex-shrink: 0; /* Prevent icon from shrinking */
    }
    
    .suggestion-content {
        flex: 1;
        min-width: 0; /* Allow text to truncate if needed */
    }
    
    .suggestion-text {
        font-size: 16px; /* Prevent zoom on iOS */
        line-height: 1.3;
        margin-bottom: 2px;
        word-wrap: break-word;
    }
    
    .suggestion-subtitle {
        font-size: 14px;
        line-height: 1.2;
        word-wrap: break-word;
    }
}

/* Search input enhancements */
.search-form .form-control:focus {
    border-color: #d4af37;
    box-shadow: 0 0 0 0.2rem rgba(212, 175, 55, 0.25);
}

/* Desktop Search Suggestions Container Enhancement */
@media (min-width: 769px) {
    .top-header .search-form {
        position: relative;
        z-index: 1050;
    }
    
    .top-header .search-suggestions {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        border: 1px solid #ddd;
        border-top: none;
        border-radius: 0 0 8px 8px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
        z-index: 1051;
        max-height: 400px;
        overflow-y: auto;
        display: none;
        width: 100%;
        min-width: 400px; /* Ensure minimum width for desktop */
    }
    
    .top-header .search-suggestions.show {
        display: block;
    }
    
    /* Ensure the header container doesn't clip the suggestions */
    .top-header {
        position: relative;
        z-index: 1050;
        overflow: visible;
    }
    
    .top-header .container-fluid {
        overflow: visible;
    }
    
    .top-header .col-md-6 {
        overflow: visible;
    }
}

.search-btn {
    background-color: #d4af37;
    border-color: #d4af37;
    color: white;
}

.search-btn:hover {
    background-color: #b8941f;
    border-color: #b8941f;
}

.search-btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(212, 175, 55, 0.25);
}

/* Mobile search toggle */
.search-toggle {
    background: none;
    border: none;
    color: #d4af37;
    font-size: 1.1em;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.search-toggle:hover {
    background-color: rgba(212, 175, 55, 0.1);
    color: #b8941f;
}

.mobile-search {
    display: none;
    border-top: 1px solid #eee;
}

.dark-mode .mobile-search {
    border-top-color: #444;
}

/* Animation for suggestions */
.search-suggestions {
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.search-suggestions.show {
    opacity: 1;
    transform: translateY(0);
}

/* Keyboard navigation highlight */
.suggestion-item.keyboard-active {
    background-color: #e9f4ff;
}

.dark-mode .suggestion-item.keyboard-active {
    background-color: #1a3a5c;
}
