/* ============================================
   DBM WEBSITE - HEADER & NAVIGATION
   Top bar, header, navigation, mega menu, mobile menu
   
   Purpose: All header and navigation styles
   Includes: Top bronze bar, main header, mega menu, mobile menu
   
   File size: ~12 KB
   ============================================ */

/* ============================================
   TOP BRONZE BAR
   Contact information bar at very top of page
   Background: Bronze #C67420
   Height: 40px
   ============================================ */
.top-bar {
    background: var(--bronze);
    height: 40px;
    width: 100%;
    padding: 0 60px;
}

.top-bar-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    height: 100%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 30px;
}

.top-bar-phone,
.top-bar-email {
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 15px;
    color: var(--pure-white);
    text-decoration: none;
    letter-spacing: 0.5px;
    transition: opacity 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.top-bar-phone:hover,
.top-bar-email:hover {
    color: var(--pure-white);
    opacity: 0.85;
}

.top-bar-separator {
    color: var(--pure-white);
    opacity: 0.5;
    font-weight: 300;
}

/* Top Bar Cart Icon */
.top-bar-cart {
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 15px;
    color: var(--pure-white);
    text-decoration: none;
    letter-spacing: 0.5px;
    transition: opacity 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.top-bar-cart:hover {
    color: var(--pure-white);
    opacity: 0.85;
}

.cart-icon {
    font-size: 16px;
}

.cart-icon-svg,
.phone-icon-svg,
.email-icon-svg {
    width: 16px;
    height: 16px;
    vertical-align: middle;
}

.cart-count {
    background: var(--pure-white);
    color: var(--bronze);
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Hide cart count when empty */
.cart-count:empty,
.cart-count[data-count="0"] {
    display: none;
}

/* ============================================
   MAIN HEADER & NAVIGATION
   Sticky white header with logo, nav links, CTA button
   Desktop: Horizontal navigation with mega menu
   Mobile: Hamburger menu (below 1024px)
   ============================================ */
header {
    background: var(--pure-white);
    box-shadow: var(--shadow-header);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    padding: 0 60px;
}

.header-container {
    max-width: 1200px;
    width: 100%;
    padding: 4px 0;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ============================================
   LOGO
   ============================================ */
.logo {
    display: flex;
    align-items: center;
    padding-left: 0;
}

.logo img {
    height: 86px;
    width: auto;
    display: block;
}

/* ============================================
   DESKTOP NAVIGATION
   Horizontal navigation with dropdowns
   ============================================ */
nav {
    display: flex;
    gap: 40px;
    align-items: center;
    flex: 1;
    justify-content: center;
}

nav a,
nav button.dropdown {
    font-family: var(--font-primary);
    font-weight: 500;
    font-size: 15px;
    color: var(--charcoal);
    text-decoration: none;
    transition: color 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Dropdown buttons need additional reset styles */
nav button.dropdown {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

nav a:hover,
nav button.dropdown:hover {
    color: var(--bronze);
}

nav a.dropdown::after,
nav button.dropdown::after {
    content: '▼';
    font-size: 10px;
}

/* ============================================
   NAVIGATION CTA BUTTON (in header)
   Two-line green button
   ============================================ */
.nav-cta {
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 15px;
    padding: 10px 28px;
    min-width: 160px;
    background: var(--enterprise-green-base);
    color: var(--pure-white);
    text-decoration: none;
    border: 2px solid var(--enterprise-green-base);
    border-radius: var(--radius-sm);
    transition: all 0.3s;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-align: center;
    white-space: nowrap;
}

.nav-btn-line-1 {
    display: block;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    opacity: 0.95;
}

.nav-btn-line-2 {
    display: block;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.nav-cta:hover {
    background: var(--enterprise-green-light);
    border-color: var(--enterprise-green-light);
    color: var(--pure-white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(2, 150, 89, 0.3);
}

/* ============================================
   MEGA MENU - PRODUCTS
   Large dropdown with sidebar and visual cards
   ============================================ */
.nav-item {
    position: relative;
    padding-bottom: 20px; /* Extends hover area below the button */
    margin-bottom: -20px; /* Prevents affecting layout */
}

.mega-menu {
    position: fixed;
    top: 122px; /* Position below top bar (40px) + header (~82px) */
    left: 50%;
    transform: translateX(-50%);
    background: var(--warm-white);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border-top: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    width: 1200px;
    max-width: calc(100vw - 120px);
}

/* Invisible bridge to prevent dropdown from closing - EXTENDED */
.mega-menu::before {
    content: '';
    position: absolute;
    top: -20px; /* Increased from 10px to 20px */
    left: 0;
    right: 0;
    height: 20px; /* Increased from 10px to 20px */
    background: transparent;
}

.nav-item:hover .mega-menu,
.mega-menu:hover {
    opacity: 1;
    visibility: visible;
    margin-top: 0;
}

.mega-menu-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 40px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px;
}

/* ============================================
   MEGA MENU CARDS
   Card styling matching footer cards
   ============================================ */
.mega-menu-card {
    background: var(--pure-white);
    padding: 24px;
    border-radius: 8px;
    border: 2px solid var(--pure-white);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: border-color 0.3s ease;
}

.mega-menu-card:hover {
    border-color: var(--bronze);
}

/* Heading with Bronze Underline - matches footer */
.mega-menu-heading {
    display: block;
    font-family: var(--font-primary);
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--charcoal);
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 3px solid var(--bronze);
}

/* List Styles - matches footer */
.mega-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mega-menu-list > li {
    margin-bottom: 6px;
}

.mega-menu-list > li > a {
    font-family: var(--font-primary);
    font-size: 15px;
    font-weight: 400;
    color: var(--charcoal);
    text-decoration: none;
    transition: color 0.3s ease;
}

.mega-menu-list > li > a:hover {
    color: var(--bronze);
    text-decoration: underline;
}

/* Capabilities Preview (indented bullets under View Capabilities) */
.capabilities-preview {
    list-style: none;
    margin: 4px 0 0 0;
    padding: 0 0 0 16px;
}

.capabilities-preview li {
    font-family: var(--font-primary);
    font-size: 15px;
    color: var(--slate-gray);
    padding: 1px 0;
    line-height: 1.3;
    position: relative;
    padding-left: 12px;
}

.capabilities-preview li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--bronze);
}

/* ============================================
   RESOURCES DROPDOWN
   Simple dropdown menu (not mega menu)
   ============================================ */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--pure-white);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border-radius: var(--radius-sm);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    margin-top: 0; /* Changed from 10px to 0 - no gap */
    min-width: 250px;
    z-index: 1000;
}

/* Add invisible bridge for Resources dropdown too */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
    background: transparent;
}

.nav-item:hover .dropdown-menu,
.dropdown-menu:hover {
    opacity: 1;
    visibility: visible;
    margin-top: 0;
}

.dropdown-links {
    list-style: none;
    padding: 16px 0;
    margin: 0;
}

.dropdown-links li {
    padding: 12px 24px;
    transition: background 0.2s ease;
}

.dropdown-links li:hover {
    background: var(--warm-white);
}

.dropdown-links a {
    font-family: var(--font-primary);
    font-weight: 500;
    font-size: 15px;
    color: var(--charcoal);
    text-decoration: none;
}

.dropdown-links a:hover {
    color: var(--bronze);
}

.dropdown-divider {
    height: 1px;
    background: #E2E8F0;
    margin: 8px 0;
}

.dropdown-links .view-all {
    color: var(--bronze);
    font-weight: 600;
}

/* ============================================
   MOBILE MENU
   Hamburger toggle and overlay menu
   ============================================ */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.hamburger-icon {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--charcoal);
    position: relative;
    transition: all 0.3s ease;
}

.hamburger-icon::before,
.hamburger-icon::after {
    content: '';
    display: block;
    width: 24px;
    height: 2px;
    background: var(--charcoal);
    position: absolute;
    transition: all 0.3s ease;
}

.hamburger-icon::before {
    top: -8px;
}

.hamburger-icon::after {
    bottom: -8px;
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    background: var(--pure-white);
    z-index: 9999;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.mobile-menu-overlay.active {
    display: block;
}

/* Mobile menu header with logo and close button */
.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 30px;
    border-bottom: 1px solid #E2E8F0;
    background: var(--pure-white);
    position: sticky;
    top: 0;
    z-index: 10;
}

.mobile-menu-header .logo img {
    height: 60px;
    width: auto;
}

.mobile-menu-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    font-size: 32px;
    line-height: 1;
    color: var(--charcoal);
    transition: color 0.3s;
}

.mobile-menu-close:hover {
    color: var(--bronze);
}

.mobile-menu-nav {
    padding: 20px 0;
    width: 100%;
    display: block;
    /* Let content flow naturally - overlay handles scrolling */
    height: auto;
    max-height: none;
    overflow: visible;
}

.mobile-menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: block;
    width: 100%;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

/* Ensure ALL mobile menu items are visible */
.mobile-menu-item {
    display: block !important;
    width: 100%;
    border-bottom: 1px solid #E2E8F0;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

/* Ensure the expandable items show properly */
.mobile-menu-item.has-submenu {
    display: block !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

.mobile-menu-item a,
.mobile-menu-toggle-btn {
    display: block;
    padding: 20px 30px;
    font-family: var(--font-primary);
    font-weight: 500;
    font-size: 18px;
    color: var(--charcoal);
    text-decoration: none;
    transition: background 0.2s ease;
}

.mobile-menu-toggle-btn {
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
}

.mobile-menu-item a:hover,
.mobile-menu-toggle-btn:hover {
    background: var(--warm-white);
}

.expand-icon {
    font-size: 24px;
    font-weight: 300;
    color: var(--bronze);
}

.mobile-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: none;
    background: var(--warm-white);
    width: 100%;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

.mobile-submenu.active {
    display: block !important;
    width: 100%;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

/* Ensure ALL submenu list items are visible when submenu is active */
.mobile-submenu.active li {
    display: block !important;
    width: 100%;
    border-top: 1px solid #E2E8F0;
    visibility: visible !important;
    opacity: 1 !important;
}

.mobile-submenu li {
    display: block;
    width: 100%;
    border-top: 1px solid #E2E8F0;
}

.mobile-submenu a {
    display: block !important;
    padding: 16px 30px 16px 50px;
    font-size: 16px;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Mobile submenu section headings - ALL must be visible */
.mobile-submenu-heading {
    display: block !important;
    width: 100%;
    font-family: var(--font-primary);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--bronze);
    padding: 16px 30px 8px 30px;
    border-top: 1px solid #E2E8F0;
    background: var(--warm-white);
    visibility: visible !important;
    opacity: 1 !important;
}

.mobile-submenu-heading:first-child {
    padding-top: 12px;
    border-top: none;
}

/* Mobile menu CTA button - MUST be visible */
.mobile-menu-cta {
    display: block !important;
    padding: 24px 30px;
    visibility: visible !important;
    opacity: 1 !important;
}

.mobile-menu-cta .btn-primary {
    width: 100%;
    text-align: center;
    justify-content: center;
}

/* Mobile menu footer with phone/cart - MUST be visible */
.mobile-menu-footer {
    display: flex !important;
    padding: 24px 30px;
    border-top: 1px solid #E2E8F0;
    justify-content: space-between;
    align-items: center;
    visibility: visible !important;
    opacity: 1 !important;
}

.mobile-phone {
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 16px;
    color: var(--bronze);
    text-decoration: none;
}

.mobile-utility-links {
    display: flex;
    gap: 20px;
}

.mobile-utility-links a {
    font-family: var(--font-primary);
    font-weight: 500;
    font-size: 14px;
    color: var(--charcoal);
    text-decoration: none;
}

/* ============================================
   RESPONSIVE - TABLET (Mega Menu)
   Stack cards on smaller screens
   ============================================ */
@media (max-width: 1100px) {
    .mega-menu-container {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        padding: 24px 32px;
    }

    .mega-menu-card:first-child {
        grid-column: 1 / -1;
    }
}

/* ============================================
   RESPONSIVE - MOBILE
   Hide desktop nav, show mobile menu
   ============================================ */
@media (max-width: 1024px) {
    .logo img {
        height: 71px;
    }
    
    .top-bar {
        padding: 0 30px;
        height: auto;
        min-height: 40px;
    }
    
    .top-bar-container {
        flex-direction: column;
        align-items: center;
        gap: 8px;
        padding: 8px 0;
    }
    
    .top-bar-phone,
    .top-bar-email {
        font-size: 14px;
        white-space: nowrap;
    }

    /* Hide separators when items stack vertically */
    .top-bar-separator {
        display: none !important;
    }

    /* Hide cart icon on mobile top bar (it's in mobile menu footer) */
    .top-bar-cart {
        display: none !important;
    }
    
    header {
        padding: 0 30px;
    }
    
    .top-bar-container,
    .header-container {
        padding: 0;
    }
    
    .logo {
        padding-left: 0;
    }
    
    /* Hide desktop nav, show mobile toggle */
    .header-container > nav {
        display: none !important;
    }
    
    .nav-cta {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Mega menu hidden on mobile */
    .mega-menu,
    .dropdown-menu {
        display: none;
    }

    /* ============================================
       MOBILE MENU - FULL SCREEN OVERLAY
       Ensure all menu items display and scroll properly
       ============================================ */

    /* Mobile menu is now a full-screen fixed overlay */
    .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for mobile browsers */
        z-index: 9999;
        overflow-y: auto; /* Allow overlay to scroll */
        -webkit-overflow-scrolling: touch; /* Smooth iOS scrolling */
    }

    /* Nav container - no height restriction, let content flow naturally */
    .mobile-menu-nav {
        max-height: none;
        overflow: visible;
        padding-bottom: 20px; /* Space at bottom for easier scrolling */
    }

    /* Show the header with logo and close button */
    .mobile-menu-header {
        display: flex !important;
    }

    /* DEBUG: Force ALL list items visible with high specificity */
    #mobileMenu .mobile-menu-nav .mobile-menu-list > li {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    /* Force all nav items to be visible */
    .mobile-menu-nav,
    .mobile-menu-list,
    .mobile-menu-item,
    .mobile-menu-cta,
    .mobile-menu-footer {
        display: block !important;
        visibility: visible !important;
        height: auto !important;
        max-height: none !important;
    }

    .mobile-menu-footer {
        display: flex !important;
    }

    /* Force ALL submenu items visible with maximum specificity */
    #productsSubmenu.active > li,
    #productsSubmenu.active > li.mobile-submenu-heading,
    #resourcesSubmenu.active > li {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    /* Ensure the submenu UL itself can show all content */
    #productsSubmenu.active,
    #resourcesSubmenu.active {
        display: block !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    /* Ensure submenus show when active */
    .mobile-submenu.active,
    .mobile-submenu.active li,
    .mobile-submenu.active li a,
    .mobile-submenu-heading {
        display: block !important;
        visibility: visible !important;
    }
}
