/* 2. The Search Icon Toggle Button - Fixed Centering */
#toggleSearch {
    background: none;
    border: none;
    font-size: 1.9rem;
    cursor: pointer;
    color: #000000; /* Industrial Green Theme */
    padding: 0;
    z-index: 1010;
    
    /* Using inline-flex to keep it in the natural text flow of the navbar */
    display: inline-flex; 
    align-items: center;      /* Vertically centers the icon inside the button */
    justify-content: center;   /* Horizontally centers the icon */
    vertical-align: middle;    /* Aligns the button itself with the surrounding text/links */
    
    height: auto;
    line-height: 1;           /* Prevents extra height from the line-height property */
}

/* 1. Container for the search item - Ensure the li is also centered */
.search-item {
    position: relative;
    list-style: none;
    display: flex;            /* Flex here helps align the li within the ul */
    align-items: center;      /* Centers the button vertically in the navbar */
    
}

/* 3. The Search Form - Opens DOWNWARD below the icon */
#searchForm {
    position: absolute;
    top: 67%;       /* Positions bar below the icon */
    right: 0;        /* Aligns right edges */
    display: flex;
    background: white;
    border: 1px solid #ddd;
    border-radius: 30px; 
    padding: 2px 10px;
    width: 0;
    opacity: 0;
    overflow: visible; 
    transition: all 0.3s ease-in-out;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-top: 10px; /* Gap between icon and bar */
}

/* Active State for Search Expansion */
#searchForm.active {
    width: 280px; 
    opacity: 1;
}

/* 4. The Input Field Styling */
#searchInput {
    border: none;
    outline: none;
    box-shadow: none;
    background: transparent;
    width: 100%;
    padding: 8px 15px;
    font-size: 14px;
}

/* 5. Custom Dropdown Results - Compact Height */
.custom-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #ffffff;
    border: 1px solid #d1d1d1;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    margin-top: 5px; 
    z-index: 1000;
    overflow-y: auto;
    max-height: 220px; /* Limits the total vertical space used */
}

/* 6. Compact Dropdown Header (Suggested Products) */
.dropdown-header {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #aaa;
    padding: 5px 12px 2px 12px; /* Minimal top/bottom padding */
    font-weight: 700;
    line-height: 1; /* Minimum vertical footprint */
    display: block;
}

/* 7. Compact Product Links (Direct Name List) */
.list-group-item {
    padding: 4px 15px; /* Minimal height per item */
    font-size: 13px;
    color: #333;
    text-decoration: none;
    display: block;
    border-bottom: 1px solid #f8f8f8;
    line-height: 1.2; /* Tight text spacing */
    transition: all 0.2s ease;
}

/* 8. Interaction & Hover Effects */
.list-group-item:hover {
    background-color: #f8f9fa;
    color: #28a745;
    padding-left: 18px; /* Subtle slide effect */
}

/* 9. Modern Minimalist Scrollbar */
.custom-dropdown::-webkit-scrollbar {
    width: 4px;
}
.custom-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}
.custom-dropdown::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 10px;
}
.custom-dropdown::-webkit-scrollbar-thumb:hover {
    background: #28a745;
}

/* 11. Remove underlines from all links in the search component */
.search-item a, 
.custom-dropdown a, 
.list-group-item {
    text-decoration: none !important;
}

/* Ensure underlines don't appear on hover either */
.search-item a:hover, 
.custom-dropdown a:hover {
    text-decoration: none !important;
}

/* Mobile-friendly adjustments */
@media (max-width: 576px) {
    .search-wrapper {
        width: 100%;
    }

    #searchForm {
        display: flex;
        width: 100%;
        gap: 4px;
    }

    #searchInput {
        flex: 1; /* Input takes up available space */
        min-width: 0; /* Prevents overflow */
        margin-top: 7px;
    }

    /* Adjust button for small screens */
    #searchForm button[type="submit"] {
        padding: 0.375rem 0.5rem;
        font-size: 0.85rem;
        white-space: nowrap;
        margin-top: 10px;
    }
}