/* ===================================
   Search Bar & Auto-suggest Styling
   =================================== */

/* Search Container for Desktop */
.search-container {
    position: relative;
    margin: 0 1rem;
    width: 100%;
    max-width: 300px;
    z-index: 1050;
}

/* Search Form */
.search-form {
    width: 100%;
    display: flex;
    align-items: center;
    position: relative;
}

/* Search Input */
.search-input {
    width: 100%;
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.15);
    color: var(--warm-white);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

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

.search-input:focus {
    background: rgba(255, 255, 255, 0.25);
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

/* Search Button */
.search-button {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0.25rem 0.5rem;
}

.search-button:hover {
    color: var(--warm-white);
}

/* Search Results Container */
.search-results-container {
    position: relative;
    width: 100%;
}

/* Search Results Dropdown */
.search-results {
    position: absolute;
    top: 0.5rem;
    left: 0;
    width: 100%;
    background: var(--warm-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    z-index: 1060;
    transition: all 0.3s ease;
    border: 1px solid var(--primary-200);
}

.search-results.show {
    max-height: 400px;
    opacity: 1;
    overflow-y: auto;
}

/* Search Result Items */
.search-result-item {
    border-bottom: 1px solid var(--primary-100);
}

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

.search-result-link {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--navy-700);
    transition: all 0.2s ease;
}

.search-result-link:hover {
    background: var(--primary-50);
}

.search-result-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--primary-700);
}

.search-result-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--navy-600);
}

.search-result-price {
    font-weight: 600;
    color: var(--primary-600);
}

.search-no-results {
    padding: 1rem;
    text-align: center;
    color: var(--navy-600);
    font-style: italic;
}

/* Mobile menu search container positioning */
.mobile-search-container {
    display: none; /* Hidden by default on desktop */
    padding: 1rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 0.5rem;
    width: 100%;
}

.mobile-search-container .search-input {
    background: rgba(255, 255, 255, 0.15);
    color: var(--warm-white);
    font-size: 1rem;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
}

/* ===================================
   Responsive Design for Tablets and Mobile
   =================================== */

/* Tablet Styles (768px - 992px) */
@media (max-width: 992px) {
    .search-container {
        max-width: 260px;
        margin: 0 0.5rem;
    }
    
    .search-input {
        font-size: 0.85rem;
    }
}

/* Mobile Styles (< 768px) */
@media (max-width: 768px) {
    /* Hide the regular search in navbar */
    .search-container {
        display: none;
    }
    
    /* Show the mobile search at the top of burger menu */
    .mobile-search-container {
        display: block;
    }
    
    .search-input {
        background: rgba(255, 255, 255, 0.15);
        padding: 0.75rem 2.5rem 0.75rem 1rem;
        font-size: 1rem; /* Slightly larger for better touch targets */
    }
    
    .search-button {
        padding: 0.3rem 0.6rem;
    }
    
    .search-results {
        position: absolute;
        top: 100%; /* Position below the search input */
        left: 0;
        width: 100%;
        max-height: 60vh; /* Limit height on mobile */
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    }
    
    .search-result-link {
        padding: 1rem; /* Larger padding for touch targets */
    }
}

/* Small Mobile Screens */
@media (max-width: 576px) {
    .mobile-search-container {
        padding: 1rem;
    }
}
