/* Prevent horizontal scrolling */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    position: relative;
}

/* Top Bar Improvements - COMPACT */
.top-bar {
    font-size: 0.8rem;
    padding: 0.4rem 0 !important;
}

.top-bar small {
    white-space: nowrap;
    font-size: 0.8rem;
}

/* Header Bar Spacing - REDUCED HEIGHT */
.header-bar {
    padding: 0.75rem 0;
    position: relative;
    z-index: 1030;
    background-color: white;
}

.header-bar .container {
    max-width: 100%;
}

.header-bar .row {
    margin: 0;
}

.header-bar .col-lg-3,
.header-bar .col-lg-5,
.header-bar .col-lg-4 {
    padding: 0.25rem;
    position: relative;
    z-index: 1031;
}

/* User Dropdown - Fix z-index */
.header-bar .dropdown {
    position: relative;
    z-index: 1100;
}

.header-bar .dropdown-menu {
    z-index: 1110 !important;
    position: absolute;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.25);
    border: 1px solid #dee2e6;
    background-color: white;
}

.header-bar .dropdown-toggle {
    position: relative;
    z-index: 1105;
}

/* Search box wrapper */
.header-bar .position-relative {
    z-index: 1100;
}

/* Logo Improvements - SMALLER */
.navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    white-space: nowrap;
    overflow: visible; /* allow brand text to be fully visible */
    text-overflow: clip;
    font-size: 1.1rem;
    padding: 0;
    line-height: 1;
}

.navbar-brand img {
    max-width: 100%;
    height: auto;
    max-height: 80px !important;
}

/* Ensure the brand text next to logo does not shrink or get hidden */
.navbar-brand .brand-text {
    flex-shrink: 0;
    display: inline-block;
    white-space: nowrap;
}

/* If header-logo class exists prefer its explicit sizes but still cap to avoid oversized logo */
.navbar-brand .header-logo {
    max-height: 80px !important;
    height: 80px !important;
}

/* Search Box Improvements - COMPACT */
.header-bar .input-group {
    max-width: 100%;
}

.header-bar .form-control {
    border-right: none;
    font-size: 0.9rem;
    padding: 0.45rem 0.75rem;
    height: auto;
}

.header-bar .btn-success {
    white-space: nowrap;
    padding: 0.45rem 1rem;
    font-size: 0.9rem;
}

/* Cart and User Buttons - COMPACT */
.header-bar .gap-3 {
    gap: 0.5rem !important;
}

.header-bar .btn {
    white-space: nowrap;
    font-size: 0.85rem;
    padding: 0.45rem 0.85rem;
}

/* Cart count badge styling */
.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    padding: 0.15rem 0.4rem;
    font-size: 0.65rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Navigation Menu Bar - COMPACT */
.navbar {
    padding: 0.5rem 0;
}

.navbar-light {
    background-color: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.navbar-nav {
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* Menu Links Styling - COMPACT */
.nav-link {
    padding: 0.5rem 0.85rem;
    white-space: nowrap;
    font-weight: 500;
    font-size: 0.95rem;
    color: #333;
    transition: all 0.3s ease;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    line-height: 1;
}

.nav-link:hover {
    background-color: #e9ecef;
    color: #198754;
}

.nav-link i {
    font-size: 0.9rem;
}

/* Dropdown Improvements */
.dropdown-menu {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.25);
    margin-top: 0 !important;
    font-size: 0.9rem;
    z-index: 1110 !important;
    background-color: white;
}

.dropdown-menu-end {
    right: 0;
    left: auto;
}

.dropdown {
    position: relative;
    z-index: 1100;
}

.dropdown-toggle {
    position: relative;
}

.dropdown-toggle::after {
    margin-left: 0.4rem;
}

/* Remove gap between toggle and menu */
.nav-item.dropdown:hover .dropdown-menu,
.dropdown:hover .dropdown-menu {
    display: block;
    margin-top: 0 !important;
}

/* Keep dropdown open when hovering over it */
.dropdown-menu:hover {
    display: block;
}

/* Ensure smooth transition */
.dropdown-menu {
    transition: opacity 0.15s linear, visibility 0.15s linear;
}

/* Fix dropdown positioning - no gap */
.navbar .dropdown-menu {
    top: 100%;
    margin-top: 0 !important;
}

/* Prevent dropdown from closing on hover */
.dropdown:hover > .dropdown-menu {
    display: block;
}

/* Bootstrap override for better hover behavior */
.dropdown-toggle:hover + .dropdown-menu,
.dropdown-menu:hover {
    display: block;
}

.dropdown-item {
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    color: #198754;
    padding-left: 1.25rem;
}

.dropdown-item i {
    width: 18px;
    text-align: center;
    font-size: 0.85rem;
}

/* Search suggestions dropdown */
.search-suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 0.25rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1110 !important;
    margin-top: 2px;
}

/* Mobile Responsive Fixes */
@media (max-width: 767.98px) {
    .top-bar {
        font-size: 0.7rem;
        padding: 0.35rem 0 !important;
    }

    .top-bar small {
        display: block;
        padding: 0.2rem 0;
        font-size: 0.7rem;
    }

    .header-bar {
        padding: 0.5rem 0;
    }

    .navbar-brand {
        font-size: 0.95rem;
    }

    .navbar-brand img {
        height: 32px !important;
        max-height: 32px;
    }

    .navbar-brand span {
        font-size: 0.85rem;
    }

    .header-bar .btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.65rem;
    }

    .nav-link {
        padding: 0.6rem 0.4rem;
        justify-content: flex-start;
        font-size: 0.9rem;
    }

    .navbar {
        padding: 0.4rem 0;
    }
}

@media (max-width: 991.98px) {
    .navbar-brand span {
        max-width: 150px;
    }

    .header-bar .gap-3 {
        gap: 0.4rem !important;
    }
}

@media (min-width: 992px) {
    /* Ensure proper spacing on desktop */
    .navbar-nav {
        justify-content: center;
        width: 100%;
    }

    .nav-link {
        margin: 0 0.15rem;
    }
}

/* Sticky Navigation - COMPACT */
.sticky-top {
    position: sticky;
    top: 0;
    z-index: 1020;
    background-color: #f8f9fa;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Ensure dropdowns appear above sticky navigation and everything else */
.dropdown-menu.show {
    z-index: 1120 !important;
}

/* Header bar should be above sticky nav */
.header-bar {
    z-index: 1030 !important;
}

/* Navigation menu should be below header */
.navbar.sticky-top {
    z-index: 1020 !important;
}

/* Button Improvements */
.btn-outline-success {
    border-width: 1.5px;
}

.btn-outline-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(25, 135, 84, 0.2);
}

/* Ensure no text overflow */
* {
    box-sizing: border-box;
}

.container {
    max-width: 100%;
    padding-right: 15px;
    padding-left: 15px;
}

/* Reduce overall header height */
.header-bar + .navbar {
    border-top: 1px solid #dee2e6;
}

/* Make sure content starts right after menu */
main {
    margin-top: 0;
    padding-top: 0;
}



