/**
 * NAVIGATION STYLES - MOBILE FIRST
 * 
 * FIXES IN THIS VERSION:
 * - Adjusted search bar spacing from banner
 * - Fixed shopping cart title visibility
 * - Improved mobile account dropdown functionality
 */

/* ================================
   GLOBAL RESET & BASE STYLES
   ================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

/* Prevent horizontal overflow */
html, body {
    overflow-x: hidden;
    width: 100%;
}

/* ================================
   MAIN NAVIGATION CONTAINER
   Mobile: Full width, stacked layout
   ================================ */

nav {
    width: 100%;
    position: relative;
    z-index: 1000;
}

/* ================================
   TOP NAVIGATION BAR
   Mobile: Wrapped layout with full-width search
   ================================ */

.navTop {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px 15px 15px 15px; /* INCREASED BOTTOM PADDING */
    background-color: #19427f;
    color: white;
    gap: 10px;
    min-height: 60px;
}

/* ================================
   LOGO SECTION
   Mobile: Compact size
   ================================ */

.nav-logo {
    flex: 0 0 auto;
    order: 1;
}

.nav-logo .logo img {
    max-height: 35px;
    display: block;
}

/* ================================
   HEADER LINKS (Account & Cart)
   Mobile: Compact icons on right
   ================================ */

.header-links {
    display: flex;
    align-items: center;
    gap: 15px;
    list-style: none;
    margin-left: auto;
    order: 2;
    height: 100%;
}

.header-links a {
    text-decoration: none;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 11px;
    gap: 3px;
    transition: color 0.3s;
}

.header-links a i {
    font-size: 20px;
}

.navItem .badge {
    color: white;
    font-size: 11px;
    min-width: 60px;
    text-align: center;
    white-space: nowrap;
}

/* ================================
   SHOPPING CART COMPONENT
   Mobile: Show "Cart" label
   ================================ */

.icon-cart {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    cursor: pointer;
    text-decoration: none;
    font-size: 11px;
    gap: 3px;
    transition: color 0.3s;
}

.icon-cart i {
    font-size: 20px;
}

.cart-count {
    background-color: rgb(169, 16, 16);
    position: absolute;
    top: -3px;
    right: 15px;
    width: 18px;
    height: 18px;
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
}

/* MOBILE: Show "Cart" label */
.cart-text {
    display: inline;
    font-size: 11px;
}

/* ================================
   SEARCH COMPONENT - SLEEK DESIGN
   Mobile: Full width below logo/icons
   ================================ */

.search {
    display: flex;
    align-items: center;
    flex: 1 1 100%;
    order: 3;
    border-radius: 25px;
    padding: 0;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    margin-top: 5px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.search:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.search:focus-within {
    box-shadow: 0 4px 16px rgba(25, 66, 127, 0.3);
    border-color: #19427f;
}

.search-box-select {
    display: none;
}
/* Disabled state for search category dropdown */
.search-box-select:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.7;
}
.search-box-select:disabled option {
    color: #999;
}

.search-box-text {
    flex-grow: 1;
    border: none;
    outline: none;
    padding: 10px 15px;
    font-size: 14px;
    background-color: transparent;
    min-width: 0;
    width: 100%;
    color: #333;
}

.search-box-text::placeholder {
    font-size: 13px;
    color: #999;
}

.search-box-button {
    background: linear-gradient(135deg, #dc382b 0%, #b92d21 100%);
    border: none;
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    color: #fff;
    border-radius: 20px;
    margin: 4px;
    transition: all 0.3s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

.search-box-button:hover {
    background: linear-gradient(135deg, #b92d21 0%, #9b281e 100%);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(220, 56, 43, 0.4);
}

.search-box-button:active {
    transform: scale(0.98);
}

.search-box-button i {
    font-size: 16px;
}

/* ================================
   ACCOUNT DROPDOWN MENU
   Mobile: Full-width dropdown, CLICK TO OPEN
   ================================ */

.header-links li > div {
    position: relative;
}

.account-dropdown-content {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    background-color: #fff;
    min-width: 200px;
    max-width: calc(100vw - 30px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    border-radius: 4px;
    padding: 10px 0;
    z-index: 9999;
}

/* MOBILE: Show dropdown when wrapper has .active class */
#accountDropdownWrapper.active .account-dropdown-content {
    display: block;
}

/* DESKTOP: Show dropdown on hover */
@media (hover: hover) and (min-width: 768px) {
    #accountDropdownWrapper:hover .account-dropdown-content {
        display: block;
    }
}

.account-dropdown-header {
    background: #19427f;
    color: white;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.account-dropdown-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.account-menu-list {
    list-style: none;
    padding: 8px 0;
    margin: 0;
}

.account-menu-list li {
    margin: 0;
}

.account-menu-list a {
    display: block;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s;
}

.account-menu-list a:hover,
.account-menu-list a:active {
    background-color: #eaeded;
}

.account-divider {
    height: 1px;
    background-color: #e5e5e5;
    margin: 8px 0;
}

/* Make clickable area larger on mobile */
@media (max-width: 767px) {
    .navItem {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
}

/* ================================
   BOTTOM CATEGORIES BAR
   Mobile: Simplified layout
   ================================ */

.categories-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f9f9f9;
    padding: 10px 15px;
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    font-size: 14px;
    color: #555;
}

.categories-left {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px;
}

.categories-left span {
    font-weight: 600;
    font-size: 14px;
    color: #555;
}

.categories-left i {
    font-size: 12px;
    color: #666;
}

/* ================================
   CATEGORY DROPDOWN MENU
   Mobile: Touch-friendly, full-width
   ================================ */

.categories-dropdown {
    position: relative;
    display: inline-block;
    cursor: pointer;
    user-select: none;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    background-color: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: calc(100vw - 30px);
    min-width: 250px;
    display: none;
    z-index: 1000;
    border-radius: 4px;
    max-height: 70vh;
    overflow-y: auto;
}

.categories-dropdown.active .dropdown-menu {
    display: block;
}

@media (hover: hover) {
    .categories-dropdown:hover .dropdown-menu {
        display: block;
    }
}

.menu-level-1 {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-level-1 > li {
    position: relative;
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
}

.menu-level-1 > li:last-child {
    border-bottom: none;
}

.menu-level-1 > li:active {
    background-color: #eaeded;
}

.menu-level-2 {
    list-style: none;
    padding: 0;
    margin: 0;
    display: none;
    background-color: #f9f9f9;
    margin-top: 8px;
    border-radius: 4px;
}

.menu-level-1 > li.expanded .menu-level-2 {
    display: block;
}

.menu-level-2 > li {
    padding: 10px 15px 10px 30px;
    border-bottom: 1px solid #eee;
}

.menu-level-2 > li:last-child {
    border-bottom: none;
}

.menu-level-2 > li:active {
    background-color: #e0e0e0;
}

.dropdown-menu a {
    text-decoration: none;
    color: #555;
    display: block;
    font-size: 14px;
    transition: color 0.3s ease;
}

/* ================================
   CATEGORIES RIGHT (Contact Link)
   Mobile: Visible but compact
   ================================ */

.categories-right a {
    text-decoration: none;
    color: #555;
    font-size: 14px;
    transition: color 0.3s ease;
    padding: 5px 10px;
    white-space: nowrap;
}

.categories-right a:hover {
    color: #007bff;
}

/* ================================
   TABLET BREAKPOINT (768px and up)
   ================================ */

@media (min-width: 768px) {
    .navTop {
        flex-wrap: nowrap;
        padding: 10px 30px 15px 30px; /* INCREASED BOTTOM PADDING */
        gap: 20px;
    }
    
    .nav-logo {
        order: 1;
    }
    
    .nav-logo .logo img {
        max-height: 30px;
    }
    
    /* Search moves to center */
    .search {
        flex: 1 1 auto;
        order: 2;
        max-width: 600px;
        margin: 0 auto;
        margin-top: 0;
    }
    
    .search-box-select {
        display: block;
        border: none;
        outline: none;
        font-size: 14px;
        padding: 10px 12px;
        background-color: #f3f3f3;
        margin-right: 0;
        border-right: 1px solid #ddd;
        border-radius: 0;
        cursor: pointer;
        color: #333;
        min-width: 120px;
    }
    
    .search-box-text {
        padding: 10px 15px;
        font-size: 14px;
        min-width: 300px;
    }
    
    .search-box-text::placeholder {
        font-size: 14px;
    }
    
    .search-box-button {
        padding: 10px 20px;
        font-size: 16px;
    }
    
    .header-links {
        order: 3;
        gap: 20px;
        margin-left: 0;
    }
    
    .header-links a {
        font-size: 13px;
        gap: 5px;
    }
    
    .navItem .badge {
        font-size: 13px;
        min-width: 70px;
    }
    
    .icon-cart {
        font-size: 13px;
        gap: 5px;
    }
    
    .cart-count {
        top: -5px;
        right: 18px;
        width: 20px;
        height: 20px;
        font-size: 12px;
    }
    
    /* Keep showing cart text on tablet */
    .cart-text {
        display: inline;
    }
    
    .categories-bar {
        padding: 10px 30px;
        font-size: 16px;
    }
    
    .categories-left span {
        font-size: 16px;
    }
    
    .dropdown-menu {
        width: 250px;
        max-height: none;
    }
    
    .menu-level-2 {
        position: absolute;
        top: 0;
        left: 100%;
        background-color: #fff;
        border: 1px solid #ddd;
        display: none;
        width: 200px;
        z-index: 1001;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        border-radius: 3px;
        margin-top: 0;
        margin-left: -1px;
    }
    
    .menu-level-1 > li:hover .menu-level-2 {
        display: block;
    }
    
    .menu-level-1 > li {
        padding: 12px 20px;
    }
    
    .menu-level-1 > li:hover {
        background-color: #eaeded;
    }
    
    .menu-level-2 > li {
        padding: 10px 15px;
    }
    
    .menu-level-2 > li:hover {
        background-color: #eaeded;
    }
    
    .categories-right a {
        font-size: 16px;
    }
}

/* ================================
   DESKTOP BREAKPOINT (992px and up)
   ================================ */

@media (min-width: 992px) {
    .navTop {
        padding: 10px 50px 18px 50px; /* INCREASED BOTTOM PADDING FOR DESKTOP */
        gap: 30px;
        height: auto;
        min-height: 60px;
    }
    
    .search {
        max-width: 800px;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    }
    
    .search:hover {
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
    }
    
    .search-box-text {
        min-width: 500px;
    }
    
    .header-links {
        gap: 30px;
    }
    
    .header-links a {
        font-size: 14px;
    }
    
    .header-links a i {
        font-size: 20px;
    }
    
    .navItem .badge {
        font-size: 14px;
        min-width: 80px;
    }
    
    .cart-text {
        display: inline;
        font-size: 14px;
    }
    
    .icon-cart {
        font-size: 14px;
    }
    
    .icon-cart i {
        font-size: 20px;
    }
    
    .cart-count {
        right: 20px;
    }
    
    .categories-bar {
        padding: 10px 50px;
        font-size: 17px;
    }
    
    .categories-left {
        padding: 10px;
    }
    
    .categories-left span {
        font-size: 17px;
        font-weight: 700;
    }
}

/* ================================
   LARGE DESKTOP (1200px and up)
   ================================ */

@media (min-width: 1200px) {
    .search {
        max-width: 900px;
    }
}

/* ================================
   ACCESSIBILITY & TOUCH OPTIMIZATION
   ================================ */

a:focus, button:focus, input:focus, select:focus {
    outline: 2px solid #19427f;
    outline-offset: 2px;
}

@media (max-width: 767px) {
    .header-links a,
    .icon-cart,
    .categories-dropdown,
    .categories-right a {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

* {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/**
 * ADD THESE STYLES TO YOUR EXISTING navbar.css
 * These are ONLY the new category dropdown styles
 * Don't replace anything - just add these at the end
 */

/* ================================
   CATEGORY DROPDOWN ENHANCEMENTS
   ================================ */

/* Disabled state for search category dropdown */
.search-box-select:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.7;
}

.search-box-select:disabled option {
    color: #999;
}

/* Login prompt styling in dropdown menu */
.dropdown-menu li a[href="/login"] {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    transition: all 0.3s ease;
    color: #666;
    font-style: italic;
}

.dropdown-menu li a[href="/login"]:hover {
    background-color: #f8f9fa;
    color: #007bff;
    padding-left: 25px;
}

.dropdown-menu li a[href="/login"] i.fa-lock {
    margin-right: 8px;
    font-size: 14px;
}

/* Department header styling */
.dropdown-menu .menu-level-1 > li > a {
    font-weight: 600;
    color: #333;
    padding: 12px 20px;
    border-bottom: 1px solid #e9ecef;
}

/* Category sub-items */
.dropdown-menu .menu-level-2 {
    background-color: #f8f9fa;
    padding-left: 0;
    list-style: none;
    margin: 0;
}

.dropdown-menu .menu-level-2 li a {
    padding: 10px 20px 10px 40px;
    font-size: 14px;
    color: #666;
}

.dropdown-menu .menu-level-2 li a:hover {
    background-color: #e9ecef;
    color: #007bff;
    padding-left: 45px;
}

/* Loading state */
.search-box-select option:first-child,
.dropdown-menu li:first-child {
    font-style: italic;
    color: #999;
}

/* Smooth transitions */
.search-box-select,
.dropdown-menu li a {
    transition: all 0.2s ease;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .dropdown-menu .menu-level-2 li a {
        padding: 8px 15px 8px 30px;
        font-size: 13px;
    }
    
    .dropdown-menu li a[href="/login"] {
        padding: 10px 15px;
    }
}