/* ==========================================================================
   Metal America Concrete - Header Styles
   ==========================================================================
   Cloned from the Metal America reference theme.
   Two-row header: top row (logo/buttons), bottom row (nav/phone).
   Mobile: hamburger overlay, full-width accordion nav.
   ========================================================================== */

/* ==========================================================================
   Site Header - Main Container
   ========================================================================== */

.site-header {
    background-color: #fff;
    padding: 0;
    position: relative;
    box-sizing: border-box;
    z-index: 100;
    border-bottom: 1px solid #e0e0e0;
}

/* ==========================================================================
   Header Top Row
   ========================================================================== */

.header-top-row {
    border-bottom: 1px solid #e0e0e0;
    padding: 0.5rem 0;
}

.header-top-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* ==========================================================================
   Header Logo
   ========================================================================== */

.header-logo {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    padding-left: 0;
}

.header-logo a {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    line-height: 0;
    text-decoration: none;
}

.header-logo img {
    max-height: 45px;
    width: auto;
    display: block;
}

/* ==========================================================================
   Header Top Buttons
   ========================================================================== */

.header-top-buttons {
    display: flex;
    align-items: center;
    gap: 0;
}

.header-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s ease;
    font-family: 'Work Sans', 'Work Sans Fallback', sans-serif;
}

.header-button:hover {
    color: #333;
}

.header-button .button-icon {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.button-divider {
    width: 1px;
    height: 30px;
    background-color: #d0d0d0;
}

/* --------------------------------------------------------------------------
   CTA Button - "Get Started Free"
   -------------------------------------------------------------------------- */

.cta-button-header {
    background-color: #ff2400;
    color: #fff !important;
    padding: 8px 20px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.3;
}

.cta-button-header:hover {
    background-color: #cc1d00;
    color: #fff !important;
    text-decoration: none;
}

.cta-button-header:focus-visible {
    outline: 2px solid #FF2400;
    outline-offset: 2px;
}

/* ==========================================================================
   Header Bottom Row - Navigation
   ========================================================================== */

.header-bottom-row {
    padding: 0.25rem 0;
    min-height: 35px;
    display: flex;
    align-items: flex-end;
}

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

/* ==========================================================================
   Navigation
   ========================================================================== */

.navigation-titles {
    width: 100%;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    margin: 0;
    padding: 0;
    font-family: 'Work Sans', 'Work Sans Fallback', sans-serif;
    justify-content: flex-start;
    flex-wrap: nowrap;
}

.nav-menu > li {
    white-space: nowrap;
}

.nav-menu a {
    color: #333;
    text-decoration: none;
    font-size: 1rem;
    padding: 0.5rem 0.5rem 5px 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: color 0.3s ease;
    z-index: 1;
    text-align: center;
    width: 100%;
}

.nav-menu a:hover {
    color: #ff2400;
}

/* Current / Active Menu Item */
.nav-menu .current-menu-item > a,
.nav-menu .current-menu-ancestor > a,
.nav-menu .current_page_item > a,
.nav-menu .current_page_ancestor > a {
    color: #333;
    position: relative;
}

.nav-menu .current-menu-item > a::after,
.nav-menu .current-menu-ancestor > a::after,
.nav-menu .current_page_item > a::after,
.nav-menu .current_page_ancestor > a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #000;
    z-index: 2;
}

/* ==========================================================================
   Desktop Phone Section
   ========================================================================== */

.desktop-phone-section {
    display: none;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.phone-number-text {
    font-family: 'Work Sans', 'Work Sans Fallback', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    color: #666;
    white-space: nowrap;
}

.desktop-phone-button {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 18px;
    background: #ff2400;
    color: #fff;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Work Sans', 'Work Sans Fallback', sans-serif;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    white-space: nowrap;
    box-sizing: border-box;
}

.desktop-phone-button:hover {
    background: #cc1d00;
    color: #fff;
}

.desktop-phone-button svg {
    stroke: #fff;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.desktop-phone-button span {
    line-height: 1;
}

/* ==========================================================================
   Page Overlay
   ========================================================================== */

.page-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 90;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    pointer-events: none;
}

.page-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ==========================================================================
   Mobile Controls
   ========================================================================== */

.mobile-controls {
    display: none;
    align-items: center;
    gap: 10px;
}

/* Mobile Phone Button */
.mobile-phone-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #ff2400;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-decoration: none;
}

.mobile-phone-button:hover {
    background: #cc1d00;
}

.mobile-phone-button svg {
    stroke: #fff;
    width: 20px;
    height: 20px;
}

/* Hamburger Toggle */
.mobile-nav-toggle {
    background-color: #ff2400;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    z-index: 1001;
    position: relative;
    transition: none;
}

.mobile-nav-toggle:hover {
    background-color: #cc1d00;
}

.mobile-nav-toggle.active {
    background-color: #ff2400;
}

.mobile-nav-toggle.active:hover {
    background-color: #cc1d00;
}

.mobile-nav-toggle svg {
    stroke: #fff;
    width: 24px;
    height: 24px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease;
}

.mobile-nav-toggle .close-icon {
    opacity: 0;
}

.mobile-nav-toggle.active .menu-icon {
    opacity: 0;
}

.mobile-nav-toggle.active .close-icon {
    opacity: 1;
}

/* ==========================================================================
   Mobile Navigation Container
   ========================================================================== */

.mobile-nav-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    min-height: 0;
    background-color: #fff;
    z-index: 1000;
    overflow-y: visible;
    padding-top: 0;
}

.mobile-nav-container.active {
    display: block;
}

/* Mobile Top Buttons in hamburger overlay */
.mobile-nav-container .mobile-top-buttons {
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 !important;
    margin-bottom: 0 !important;
    display: flex;
    align-items: center;
    min-height: 60px;
}

/* ==========================================================================
   Mobile Top Buttons
   ========================================================================== */

.mobile-top-buttons {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    padding: 1rem 0;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 1rem;
}

.mobile-header-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s ease;
    font-family: 'Work Sans', 'Work Sans Fallback', sans-serif;
}

.mobile-header-button:hover {
    color: #333;
}

.mobile-header-button .button-icon {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

/* ==========================================================================
   DESKTOP STYLES
   @media (min-width: 1046px)
   ========================================================================== */

@media screen and (min-width: 1046px) {
    .header-bottom-container {
        align-items: center;
    }

    .header-bottom-container .navigation-titles {
        display: block !important;
        position: static !important;
        width: auto !important;
        height: auto !important;
        padding-top: 0 !important;
        background-color: transparent !important;
    }

    .header-bottom-container .navigation-titles .nav-menu {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
    }

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

    .nav-menu .menu-item-has-children {
        position: relative;
    }

    .nav-menu .sub-menu {
        position: absolute;
        top: 100%;
        left: 0;
        background-color: #fff;
        min-width: 240px;
        width: max-content;
        max-width: 280px;
        padding: 0.5rem;
        list-style: none;
        margin: 0;
        visibility: hidden;
        opacity: 0;
        display: block !important;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        z-index: 100;
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
        border: 1px solid #e0e0e0;
    }

    .nav-menu .sub-menu .sub-menu {
        position: absolute;
        top: 0;
        left: 100%;
        margin-top: 0;
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
    }

    .nav-menu .sub-menu li:hover > .sub-menu {
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
    }

    .nav-menu .sub-menu .menu-item-has-children:hover > .sub-menu {
        position: relative;
        top: auto;
        left: 0;
        margin-top: 5px;
        margin-left: 15px;
        box-shadow: none;
        border: none;
        border-left: 2px solid #ff2400;
    }

    .nav-menu .sub-menu .sub-menu li {
        padding: 0.2rem 0.5rem;
    }

    .nav-menu .sub-menu .sub-menu a {
        font-size: 0.85rem;
        padding: 0.4rem 0.5rem;
    }

    .nav-menu .menu-item-has-children:hover > .sub-menu {
        visibility: visible;
        opacity: 1;
        display: block !important;
    }

    .nav-menu .sub-menu li {
        padding: 0.2rem 0.85rem;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        display: block;
        position: relative;
        text-align: left;
    }

    .nav-menu .sub-menu li:last-child {
        border-bottom: none;
    }

    .nav-menu .sub-menu a {
        white-space: nowrap;
        font-size: 0.9rem;
        padding: 0.45rem 0.75rem;
        width: 100%;
        transition: color 0.2s ease;
        display: block;
        text-align: left;
        justify-content: flex-start;
        color: #333;
        position: relative;
    }

    .nav-menu .sub-menu a:hover {
        color: #ff2400;
    }

    /* Show desktop phone section */
    .desktop-phone-section {
        display: flex !important;
    }

    /* Hide mobile elements on desktop */
    .mobile-controls,
    .mobile-nav-container,
    .mobile-top-buttons {
        display: none !important;
    }
}

/* ==========================================================================
   MOBILE & TABLET STYLES
   @media (max-width: 1045px)
   ========================================================================== */

@media screen and (max-width: 1045px) {
    .header-top-container {
        padding: 0.5rem 1rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .header-logo {
        max-width: calc(100% - 100px);
        min-width: 0;
        flex-shrink: 1;
        display: flex;
        align-items: center;
        padding-left: 10px;
    }

    .header-logo img {
        max-height: 35px;
        width: auto;
        transition: max-height 0.3s ease;
    }

    /* Hide desktop top buttons */
    .header-top-buttons {
        display: none;
    }

    /* Show mobile controls */
    .mobile-controls {
        display: flex !important;
        align-items: center;
        flex-shrink: 0;
        margin-left: auto;
        padding: 0;
        position: relative;
    }

    /* Hide desktop phone section */
    .desktop-phone-section {
        display: none !important;
    }

    /* Show bottom row with mobile buttons */
    .header-bottom-row {
        display: block;
        padding: 0.35rem 0;
    }

    .header-bottom-container {
        max-width: 1200px;
        margin: 0 auto;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 0;
        padding: 0 1rem;
        justify-content: flex-start;
    }

    /* Mobile top buttons in bottom row */
    .mobile-top-buttons {
        display: flex;
        align-items: center;
        gap: 0;
        flex-shrink: 0;
        order: 1;
        padding: 0;
        margin-bottom: 0;
        border-bottom: none;
        justify-content: space-between !important;
        width: 100%;
    }

    .mobile-top-buttons .button-divider {
        display: none;
    }

    .mobile-top-buttons .cta-button-header {
        margin-left: auto;
        margin-right: 0.5rem;
        font-weight: 600;
    }

    /* Hide desktop navigation on mobile */
    .navigation-titles {
        display: none;
        flex: 1;
        min-width: 0;
        order: 2;
    }

    /* Mobile Navigation Menu - Full-width accordion */
    .mobile-nav-menu {
        flex-direction: column;
        width: 100%;
        padding: 0;
        margin: 0;
        list-style: none;
    }

    .mobile-nav-menu > li {
        width: 100%;
        box-sizing: border-box;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }

    .mobile-nav-menu .sub-menu {
        display: none;
        margin: 0;
        padding: 0;
        list-style: none;
        background-color: #f8f8f8;
        width: 100%;
        position: static;
        box-shadow: none;
        border: none;
        border-radius: 0;
        visibility: visible;
        opacity: 1;
    }

    .mobile-nav-menu > li > a {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        padding: 0.75rem 2rem 0.75rem 1.25rem;
        color: #333;
        font-size: 1.05rem;
        font-weight: 500;
        text-transform: none;
        position: relative;
        width: 100%;
        box-sizing: border-box;
        text-decoration: none;
    }

    /* Dropdown arrow indicator for items with submenus */
    .mobile-nav-menu > .menu-item-has-children > a::after {
        content: '';
        display: inline-block;
        width: 8px;
        height: 8px;
        border-right: 2px solid #666;
        border-bottom: 2px solid #666;
        transform: rotate(45deg);
        margin-left: auto;
        flex-shrink: 0;
        transition: transform 0.3s ease;
    }

    .mobile-nav-menu > .menu-item-has-children.active > a::after {
        transform: rotate(-135deg);
        border-color: #ff2400;
    }

    /* Mobile active state */
    .mobile-nav-menu .current-menu-item > a,
    .mobile-nav-menu .current-menu-ancestor > a {
        color: #333;
        font-weight: 600;
        background-color: #f8f8f8;
    }

    .mobile-nav-menu .sub-menu li {
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        width: 100%;
    }

    .mobile-nav-menu .sub-menu li:last-child {
        border-bottom: none;
    }

    .mobile-nav-menu .sub-menu a {
        padding: 0.65rem 1.25rem 0.65rem 2rem;
        display: block;
        width: 100%;
        box-sizing: border-box;
        text-align: left;
        font-size: 1rem;
        color: #333;
        text-decoration: none;
    }

    .mobile-nav-menu .sub-menu .sub-menu {
        background-color: #f0f0f0;
    }

    .mobile-nav-menu .sub-menu .sub-menu li {
        border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    }

    .mobile-nav-menu .sub-menu .sub-menu a {
        padding: 0.65rem 1.25rem 0.65rem 3.5rem;
        font-size: 0.95rem;
        text-decoration: none;
    }
}

/* ==========================================================================
   RESPONSIVE: Max-Width 480px
   ========================================================================== */

@media screen and (max-width: 480px) {
    .header-top-container {
        padding: 0.25rem 0.5rem;
    }

    .header-logo {
        max-width: calc(100% - 90px);
        padding-left: 10px;
    }

    .header-logo img {
        max-height: 30px;
    }

    .mobile-phone-button {
        width: 36px;
        height: 36px;
    }

    .mobile-phone-button svg {
        width: 18px;
        height: 18px;
    }

    .mobile-nav-toggle {
        width: 36px;
        height: 36px;
    }

    .mobile-nav-toggle svg {
        width: 20px;
        height: 20px;
    }

    .header-bottom-container {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
        padding: 0 0.5rem;
    }

    .mobile-top-buttons {
        order: 2;
        align-self: stretch;
        padding: 0;
        width: 100%;
    }

    .mobile-header-button span {
        font-size: 0.8rem;
    }
}

/* ==========================================================================
   RESPONSIVE: Max-Width 360px
   ========================================================================== */

@media screen and (max-width: 360px) {
    .header-top-container {
        padding: 0.25rem 0 0.25rem 0.25rem;
    }

    .header-logo img {
        max-height: 26px;
    }

    .mobile-phone-button {
        width: 32px;
        height: 32px;
    }

    .mobile-phone-button svg {
        width: 16px;
        height: 16px;
    }

    .mobile-nav-toggle {
        width: 32px;
        height: 32px;
    }

    .mobile-nav-toggle svg {
        width: 18px;
        height: 18px;
    }
}

/* ==========================================================================
   Header Utility: No-Scroll (when mobile nav is open)
   ========================================================================== */

body.nav-open {
    overflow: hidden;
}

/* ==========================================================================
   Header Accessibility
   ========================================================================== */

.skip-to-content {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 999;
    padding: 10px 20px;
    background: #FF2400;
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}

.skip-to-content:focus {
    left: 0;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .site-header {
        position: static;
        box-shadow: none;
    }

    .mobile-controls,
    .mobile-nav-container,
    .page-overlay,
    .header-top-buttons,
    .desktop-phone-section {
        display: none !important;
    }
}
