/**
 * Brothers Home Inspection - Clean Header
 * Simple, maintainable header with working dropdown
 */

/* ===========================
   HEADER CONTAINER
   =========================== */
.site-header {
    background-color: #ffffff;
    border: none;
    box-shadow: none;
    position: relative;
    z-index: 9999;
    padding: 15px 0;
    width: 100%;
}

.header-container {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 5px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    box-sizing: border-box;
}

/* Hide ALL buttons in header except CTA and mobile menu buttons */
.site-header button:not(.btn-primary):not(.mobile-menu-toggle):not(.mobile-menu-close),
.header-container button:not(.btn-primary):not(.mobile-menu-toggle):not(.mobile-menu-close),
.header-nav button:not(.btn-primary):not(.mobile-menu-toggle):not(.mobile-menu-close) {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    position: absolute !important;
    left: -9999px !important;
}

/* Hide any Elementor hamburger/toggle elements that might appear */
.site-header .jkit-hamburger-menu,
.site-header .elementor-menu-toggle,
.site-header .jkit-close-menu,
.header-container .jkit-hamburger-menu,
.header-container .elementor-menu-toggle {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    position: absolute !important;
    left: -9999px !important;
}

/* ===========================
   LOGO
   =========================== */
.header-logo {
    justify-self: start;
}

.header-logo img {
    height: 50px;
    width: auto;
}

/* ===========================
   NAVIGATION
   =========================== */
.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 35px;
    justify-self: center;
}

.header-cta {
    justify-self: end;
}

.nav-menu li {
    position: relative;
}

.nav-menu > li > a {
    color: #333333;
    text-decoration: none;
    font-family: "Poppins", sans-serif;
    font-size: 15px;
    font-weight: 500;
    padding: 10px 0;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.3s ease;
}

.nav-menu > li > a:hover {
    color: var(--brand-green, #4E612C);
}

.nav-menu > li.active > a {
    color: var(--brand-green, #4E612C);
    font-weight: 600;
}

/* Dropdown arrow */
.nav-menu > li > a .dropdown-arrow {
    width: 10px;
    height: 10px;
    transition: transform 0.3s ease;
}

.nav-menu > li:hover > a .dropdown-arrow {
    transform: rotate(180deg);
}

/* ===========================
   DROPDOWN MENU
   =========================== */
.nav-menu li.has-dropdown {
    position: relative;
}

/* Submenu (dropdown) */
.submenu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    padding: 15px 0;
    margin-top: 10px;
    opacity: 0;
    visibility: hidden;
    list-style: none;
    z-index: 99999;
    transition: all 0.3s ease;
}

/* Invisible bridge to maintain hover */
.nav-menu li.has-dropdown::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 20px;
}

.nav-menu li:hover > .submenu,
.nav-menu li.has-dropdown:hover > .submenu,
.nav-menu .has-dropdown:hover .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.submenu li a {
    display: block;
    padding: 12px 25px;
    color: #333333;
    text-decoration: none;
    font-family: "Poppins", sans-serif;
    font-size: 14px;
    font-weight: 400;
    transition: all 0.2s ease;
}

.submenu li a:hover {
    color: var(--brand-green, #4E612C);
    background-color: #f8f8f8;
}

/* ===========================
   CTA BUTTON
   =========================== */
.header-cta .btn-primary {
    background-color: var(--brand-green, #4E612C);
    color: #ffffff;
    text-decoration: none;
    font-family: "Gotham", "Poppins", sans-serif !important;
    font-size: 14px;
    font-weight: 700 !important;
    padding: 12px 28px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: inline-block;
}

.header-cta .btn-primary:hover {
    background-color: var(--brand-green-dark, #3d4a22);
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(78, 97, 44, 0.3);
}

.header-cta .btn-primary:active {
    background-color: var(--brand-green-dark, #3d4a22) !important;
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(78, 97, 44, 0.2);
}

.header-cta .btn-primary:focus {
    background-color: var(--brand-green, #4E612C);
    outline: 2px solid var(--brand-green-dark, #3d4a22);
    outline-offset: 2px;
}

/* ===========================
   MOBILE MENU TOGGLE (Hidden on desktop, shown on mobile via media query)
   =========================== */
.mobile-menu-toggle {
    display: none;
    border: none;
    background: var(--brand-green, #4E612C);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
}

.mobile-menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background-color: #ffffff;
    border-radius: 2px;
}

/* Close button - only visible inside mobile menu */
.mobile-menu-close {
    display: none;
}

/* Mobile menu header - hidden on desktop */
.mobile-menu-header {
    display: none;
}

/* ===========================
   RESPONSIVE - TABLET & MOBILE
   =========================== */
@media screen and (max-width: 1024px) {
    /* Change grid to flex for mobile */
    .header-container {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    /* Show hamburger button on mobile - FORCE override any other styles */
    .mobile-menu-toggle,
    button.mobile-menu-toggle,
    .site-header .mobile-menu-toggle,
    .header-container .mobile-menu-toggle {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        pointer-events: auto !important;
        overflow: visible !important;
        background: var(--brand-green, #4E612C) !important;
        border: none !important;
        border-radius: 8px !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 5px !important;
        cursor: pointer !important;
        z-index: 99999 !important;
    }

    /* Mobile menu header with logo and close button */
    .mobile-menu-header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
        padding: 0 0 20px 0 !important;
        margin-bottom: 10px !important;
        border-bottom: 1px solid #e5e5e5 !important;
    }

    .mobile-menu-header .mobile-logo {
        display: block !important;
    }

    .mobile-menu-header .mobile-logo img {
        height: 40px !important;
        width: auto !important;
    }

    .mobile-menu-header .mobile-menu-close {
        position: relative !important;
        top: auto !important;
        right: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important;
        background: var(--brand-green, #4E612C) !important;
        border: none !important;
        border-radius: 8px !important;
        cursor: pointer !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    .mobile-menu-header .mobile-menu-close::before,
    .mobile-menu-header .mobile-menu-close::after {
        content: '' !important;
        position: absolute !important;
        width: 16px !important;
        height: 2px !important;
        background-color: #ffffff !important;
        display: block !important;
    }

    .mobile-menu-header .mobile-menu-close::before {
        transform: rotate(45deg) !important;
    }

    .mobile-menu-header .mobile-menu-close::after {
        transform: rotate(-45deg) !important;
    }

    /* Hamburger lines */
    .mobile-menu-toggle span,
    button.mobile-menu-toggle span,
    .header-container .mobile-menu-toggle span {
        display: block !important;
        width: 20px !important;
        height: 2px !important;
        min-height: 2px !important;
        background-color: #ffffff !important;
        border-radius: 2px !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        left: auto !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Hide nav-menu and header-cta by default */
    .nav-menu {
        position: fixed !important;
        top: 0 !important;
        left: -100% !important;
        width: 280px !important;
        height: 100vh !important;
        background-color: #ffffff !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 20px 25px 30px !important;
        gap: 0 !important;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1) !important;
        transition: left 0.4s ease !important;
        z-index: 99998 !important;
        transform: none !important;
        justify-self: auto !important;
        overflow-y: auto !important;
    }

    .nav-menu.active {
        left: 0 !important;
    }

    .nav-menu > li {
        width: 100%;
    }

    .nav-menu > li > a {
        padding: 15px 0 !important;
        border-bottom: 1px solid #f0f0f0 !important;
        width: 100% !important;
        justify-content: space-between !important;
    }

    /* Mobile menu header should not have link styles */
    .nav-menu > li.mobile-menu-header > a {
        padding: 0 !important;
        border-bottom: none !important;
    }

    .submenu {
        position: static !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
        margin: 0 !important;
        padding: 0 0 0 20px !important;
        display: none !important;
        background-color: #f9f9f9 !important;
    }

    .nav-menu li.dropdown-open > .submenu {
        display: block !important;
    }

    .submenu li a {
        padding: 12px 15px !important;
        border-bottom: 1px solid #f0f0f0 !important;
    }

    /* Hide CTA on mobile (will be inside menu) */
    .header-cta {
        display: none !important;
    }

    /* Close button styles are now in .mobile-menu-header section above */

    /* Overlay */
    .menu-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 99997;
    }

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

@media screen and (max-width: 767px) {
    .header-logo img {
        height: 40px;
    }

    .header-container {
        padding: 0 15px;
    }
}
