/* ===================================
   Layout Navbar Styles
   Styles for navigation bar and dropdowns
   =================================== */

/* Two-Row Navbar Layout */
.navbar > .container {
    flex-direction: column;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.navbar .navbar-brand-row {
    margin-bottom: 0.5rem;
}

.navbar .navbar-links-row {
    width: 100%;
}

@media (min-width: 992px) {
    .navbar > .container {
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }
    
    .navbar .navbar-collapse {
        width: 100%;
        margin-top: 0;
    }
    
    .navbar .navbar-nav {
        flex-wrap: wrap;
    }
    
    /* CRITICAL: On desktop, navbar-collapse should ALWAYS be shown - override Bootstrap */
    .navbar-expand-lg .navbar-collapse {
        display: flex !important;
        flex-basis: auto;
    }
    
    .navbar-links-row.collapse:not(.show),
    .navbar-links-row.collapse {
        display: flex !important;
    }
}

/* When scrolled, remove extra padding since logo is hidden on desktop */
@media (min-width: 992px) {
    .navbar.navbar-scrolled > .container {
        padding-top: 0.35rem;
        padding-bottom: 0.35rem;
    }
}

/* Cart Badge Styles */
#cartItemCount, #cartItemCountDropdown, #cartItemCountMobile {
    min-width: 18px;
    height: 18px;
    font-size: 11px;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

#cartItemCount.show, #cartItemCountDropdown.show, #cartItemCountMobile.show {
    display: inline-flex !important;
}

.navbar-nav .nav-link {
    position: relative;
}

/* Products Dropdown Styles */
.dropdown-menu-products {
    max-width: 600px;
}

.category-item {
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-radius: 0.25rem;
    margin-bottom: 0.25rem;
    color: white;
    background-color: rgb(130,130,130,0.2);
}

.category-item:hover {
    background-color: rgb(0,0,0,0.2) !important;
}

.category-header {
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 500;
}


.subcategories-list {
    display: none;
    padding-left: 1rem;
    margin-top: 0.25rem;
    border-left: 2px solid #dee2e6;
    margin-left: 1rem;
}

.subcategories-list.show {
    display: block;
}

.subcategory-item {
    padding: 0.4rem 1rem;
    display: block;
    color: #6c757d;
    text-decoration: none;
    transition: all 0.2s ease;
    border-radius: 0.25rem;
}

.subcategory-item:hover {
    background-color: #f1f3f5;
    color: var(--primary-color);
    padding-left: 1.25rem;
}

.category-toggle-icon {
    transition: transform 0.3s ease;
}

.category-toggle-icon.rotated {
    transform: rotate(90deg);
}

.product-count-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
}

/* User Dropdown Positioning Fix */
.navbar-nav .nav-item.dropdown:last-child .dropdown-menu {
    position: absolute;
    right: 0;
    left: auto;
    transform: none;
}

.navbar-nav .nav-item.dropdown:last-child .dropdown-menu.dropdown-menu-end {
    right: 0 !important;
    left: auto !important;
    max-width: 250px;
}

/* Enhanced Search Styles */
.search-result-item {
    transition: background-color 0.2s ease;
}

.search-result-item:hover,
.search-result-item.active {
    background-color: #f8f9fa !important;
}

.hover-bg-light:hover {
    background-color: #f8f9fa !important;
}

#searchResults,
#searchResultsMobile {
    border: 1px solid #dee2e6;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    background-color: white;
    z-index: 1050;
}

.search-result-item .badge {
    font-size: 0.7rem !important;
}

/* Loading animation */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Search input focus styles */
#globalSearch:focus,
#globalSearchMobile:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Product image placeholder */
.search-result-item img {
    border: 1px solid #dee2e6;
}
