/* ==========================================================
   HPD LIGHTWEIGHT HEADER
   HardwarePartsDirect.com
   Version 1.4
   ========================================================== */


/* ==========================================================
   GLOBAL HEADER SETTINGS
   ========================================================== */

#hpd-light-header,
#hpd-light-header * {
    box-sizing: border-box;
}

#hpd-light-header {
    width: 100%;
    background: #ffffff;
    font-family: Arial, Helvetica, sans-serif;
    position: relative;
    z-index: 9999;
}

.hpd-header-container {
    width: 80%;
    max-width: 1080px;
    margin: 0 auto;
}


/* ==========================================================
   TOP NAVY BAR
   ========================================================== */

.hpd-topbar {
    width: 100%;
    background: #0e2a47;
    color: #ffffff;
    font-size: 12px;
}

.hpd-topbar-inner {
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.hpd-topbar-item {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    line-height: 1;
}

/*
 * The location item also carries the .hpd-state-selector class so the
 * geolocation JavaScript can update it. Keep the old state-selector
 * stylesheet from making this one top-bar item full width.
 */
#hpd-light-header .hpd-topbar-item.hpd-state-selector {
    width: auto;
    max-width: none;
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    background: transparent;
}

.hpd-topbar-item img {
    width: 15px;
    height: 15px;
    object-fit: contain;
    display: block;
}

.hpd-topbar-item a {
    color: #ffffff;
    text-decoration: none;
}

.hpd-topbar-item a:hover {
    color: #ff8a00;
}

.hpd-stars {
    color: #ff8a00;
    font-size: 13px;
    letter-spacing: 1px;
}

.hpd-topbar-divider {
    color: rgba(255, 255, 255, 0.45);
    font-size: 12px;
    line-height: 1;
}


/* ==========================================================
   MAIN WHITE HEADER
   ========================================================== */

.hpd-main-header {
    width: 100%;
    background: #ffffff;
    border-bottom: 1px solid #e5e9ed;
}

.hpd-main-header-inner {
    min-height: 0;
    display: flex;
    align-items: center;
    gap: 18px;
    padding-top: 12px;
    padding-bottom: 12px;
}


/* ==========================================================
   LOGO
   ========================================================== */

.hpd-header-logo {
    flex: 0 0 220px;
}

.hpd-header-logo a {
    display: block;
    line-height: 0;
}

.hpd-header-logo img {
    display: block;
    width: 100%;
    max-width: 220px;
    height: auto;
}


/* ==========================================================
   PRIMARY NAVIGATION
   ========================================================== */

.hpd-primary-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    flex: 1 1 auto;
}

.hpd-primary-nav a {
    color: #0e2a47;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s ease;
}

.hpd-primary-nav a:hover {
    color: #ff8a00;
}


/* Customer Support */

.hpd-primary-nav .hpd-support-link {
    background: #0e2a47;
    color: #ffffff;
    padding: 10px 14px;
    border-radius: 4px;
    transition:
        background-color 0.15s ease,
        color 0.15s ease;
}

.hpd-primary-nav .hpd-support-link:hover {
    background: #ff8a00;
    color: #ffffff;
}


/* ==========================================================
   SEARCH
   ========================================================== */

.hpd-header-search {
    position: relative;
    flex: 0 0 500px;
    min-width: 500px;
}

.hpd-search-form {
    width: 100%;
    height: 38px;
    display: flex;
    align-items: stretch;
    background: #ffffff;
    border: 1px solid #aeb8c2;
    border-radius: 4px;
    overflow: hidden;
}

.hpd-search-input {
    width: 100%;
    min-width: 0;
    height: 36px;
    padding: 0 15px;
    margin: 0;
    border: 0 !important;
    outline: 0 !important;
    background: #ffffff !important;
    color: #222222;
    font-size: 15px;
    box-shadow: none !important;
}

.hpd-search-input::placeholder {
    color: #6c737a;
}

.hpd-search-button {
    width: 48px;
    min-width: 48px;
    height: 36px;
    padding: 0;
    margin: 0;
    border: 0;
    border-left: 1px solid #d8dde2;
    background: #ffffff;
    color: #0e2a47;
    font-size: 17px;
    cursor: pointer;
}

.hpd-search-button:hover {
    background: #f7f7f7;
    color: #ff8a00;
}


/* ==========================================================
   AJAX SEARCH RESULTS
   ========================================================== */

.hpd-search-results {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    max-height: 370px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #d9dee3;
    border-radius: 4px;
    z-index: 10020;
}

.hpd-search-results.is-open {
    display: block;
}

.hpd-search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-bottom: 1px solid #edf0f2;
    text-decoration: none;
    background: #ffffff;
}

.hpd-search-result-item:last-child {
    border-bottom: 0;
}

.hpd-search-result-item:hover {
    background: #f7f9fb;
}

.hpd-search-result-image {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    object-fit: contain;
    background: #ffffff;
}

.hpd-search-result-info {
    min-width: 0;
}

.hpd-search-result-title {
    display: block;
    color: #0e2a47;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
}

.hpd-search-result-sku {
    display: block;
    margin-top: 3px;
    color: #666666;
    font-size: 12px;
}


/* ==========================================================
   DEPARTMENT QUICK NAVIGATION
   ========================================================== */

.hpd-category-nav {
    width: 100%;
    background: #ffffff;
    border-bottom: 1px solid #e5e9ed;
}

.hpd-category-nav-inner {
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding-top: 7px;
    padding-bottom: 7px;
}

.hpd-category-nav-inner a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 9px;

    background: #ffffff;
    border: 1px solid #cbd3da;
    border-radius: 4px;

    color: #0e2a47;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;

    transition:
        border-color 0.15s ease,
        color 0.15s ease;
}

.hpd-category-nav-inner a:hover,
.hpd-category-nav-inner a:focus {
    border-color: #ff8a00;
    color: #ff8a00;
}


/* ==========================================================
   SCREEN READER TEXT
   ========================================================== */

#hpd-light-header .screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}


/* ==========================================================
   SMALLER DESKTOP / LAPTOP
   ========================================================== */

@media (max-width: 1180px) {

    .hpd-header-container {
        width: 92%;
        max-width: 1080px;
    }

    .hpd-topbar-inner {
        gap: 8px;
    }

    .hpd-main-header-inner {
        gap: 16px;
    }

    .hpd-header-logo {
        flex-basis: 200px;
    }

    .hpd-header-logo img {
        max-width: 200px;
    }

    .hpd-primary-nav {
        gap: 14px;
    }

    .hpd-primary-nav a {
        font-size: 13px;
    }

    .hpd-header-search {
        flex-basis: 250px;
        min-width: 230px;
    }

    .hpd-category-nav-inner {
        justify-content: flex-start;
        overflow-x: auto;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

}


/* ==========================================================
   TABLET / MOBILE
   CLEAN RESPONSIVE SYSTEM
   ========================================================== */

@media (max-width: 980px) {

    .hpd-header-container {
        width: 94%;
    }

    /* ---------- TOP BAR ---------- */

    .hpd-topbar-inner {
        min-height: 32px;
        justify-content: center;
        gap: 8px;
    }

    .hpd-topbar-item {
        font-size: 11px;
    }

    .hpd-topbar-item:first-child,
    .hpd-topbar-reviews,
    .hpd-topbar-divider {
        display: none !important;
    }

    /* Hide review-count item */
    .hpd-topbar-reviews + .hpd-topbar-divider + .hpd-topbar-item {
        display: none !important;
    }

    /* ---------- MAIN HEADER ---------- */

    .hpd-main-header-inner {
        min-height: auto;
        padding-top: 10px;
        padding-bottom: 10px;
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 10px 14px;
    }

    .hpd-header-logo {
        flex: none;
    }

    .hpd-header-logo img {
        width: 210px;
        max-width: 100%;
    }

    /* ---------- PRIMARY NAV ---------- */

    .hpd-primary-nav {
        grid-column: 1 / -1;
        order: 3;
        width: 100%;
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .hpd-primary-nav::-webkit-scrollbar {
        display: none;
    }

    .hpd-primary-nav a {
        flex: 0 0 auto;
        font-size: 13px;
        padding: 8px 10px;
    }

    .hpd-primary-nav .hpd-support-link {
        padding: 8px 12px;
    }

    /* ---------- SEARCH ---------- */

    .hpd-header-search {
        flex: none;
        min-width: 0;
        width: 250px;
    }

    /* ---------- CATEGORY NAV ---------- */

    .hpd-category-nav-inner {
        width: 94%;
        justify-content: flex-start;
        overflow-x: auto;
        padding-top: 6px;
        padding-bottom: 6px;
        gap: 7px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .hpd-category-nav-inner::-webkit-scrollbar {
        display: none;
    }

    .hpd-category-nav-inner a {
        flex: 0 0 auto;
        min-height: 32px;
        padding: 6px 11px;
        font-size: 12px;
    }
}


/* ==========================================================
   PHONE
   Match current HPD mobile header structure
   ========================================================== */

@media (max-width: 600px) {

    /* ======================================================
       TOP BAR
       Delivery + Phone ONLY
       ====================================================== */

    #hpd-light-header .hpd-topbar-inner {
        width: 100% !important;
        min-height: 40px;
        padding: 0 10px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }

    /*
     * Hide everything in top bar first.
     * Then explicitly restore Delivery and Phone.
     */

    #hpd-light-header .hpd-topbar-item,
    #hpd-light-header .hpd-topbar-divider {
        display: none !important;
    }

    /*
     * Delivery is the second .hpd-topbar-item.
     */

    #hpd-light-header .hpd-topbar-item:nth-of-type(2) {
        display: flex !important;
    }

    /*
     * Phone has its own class.
     */

    #hpd-light-header .hpd-topbar-phone {
        display: flex !important;
        margin-left: auto;
    }

    #hpd-light-header .hpd-topbar-item {
        align-items: center;
        gap: 5px;
        font-size: 11px;
        font-weight: 700;
        white-space: nowrap;
    }

    #hpd-light-header .hpd-topbar-item img {
        width: 17px;
        height: 17px;
    }


    /* ======================================================
       MAIN WHITE HEADER
       ====================================================== */

    #hpd-light-header .hpd-main-header-inner {
        width: 100% !important;
        display: flex;
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: center;
        gap: 9px;
        padding: 10px 14px 10px;
    }


    /* ======================================================
       LOGO
       ====================================================== */

    #hpd-light-header .hpd-header-logo {
        width: 100%;
        flex: none;
        text-align: center;
    }

    #hpd-light-header .hpd-header-logo a {
        display: inline-block;
    }

    #hpd-light-header .hpd-header-logo img {
        display: block;
        width: 285px;
        max-width: 88%;
        height: auto;
        margin: 0 auto;
    }


    /* ======================================================
       DESKTOP NAV
       Hide on phone
       ====================================================== */

    #hpd-light-header .hpd-primary-nav {
        display: none !important;
    }


    /* ======================================================
       SEARCH
       Temporary full-width version.
       Next step will create Department + Search row.
       ====================================================== */

    #hpd-light-header .hpd-header-search {
        position: relative;
        width: 100%;
        min-width: 0;
        flex: none;
    }

    #hpd-light-header .hpd-search-form {
        width: 100%;
        height: 42px;
        display: flex;
    }

    #hpd-light-header .hpd-search-input {
        height: 40px;
        font-size: 14px;
    }

    #hpd-light-header .hpd-search-button {
        width: 50px;
        min-width: 50px;
        height: 40px;
        background: #0e2a47;
        color: #ffffff;
        border-left: 0;
    }

    #hpd-light-header .hpd-search-button:hover {
        background: #ff8a00;
        color: #ffffff;
    }


    /* ======================================================
       DESKTOP CATEGORY ROW
       Hide completely on phone
       ====================================================== */

    #hpd-light-header .hpd-category-nav {
        display: none !important;
    }


    /* ======================================================
       AJAX SEARCH RESULTS
       ====================================================== */

    #hpd-light-header .hpd-search-results {
        top: calc(100% + 4px);
        max-height: 330px;
        z-index: 10060;
    }

}

/* ==========================================================
   HPD LIGHTWEIGHT MOBILE DEPARTMENT NAVIGATION
   Independent from Divi
   ========================================================== */

/* Hidden everywhere by default */
#hpd-mobile-department-nav {
    display: none;
}


/* ==========================================================
   PHONE ONLY
   ========================================================== */

@media (max-width: 600px) {

    /*
     * JS will add .is-visible after the main HPD header
     * has scrolled out of view.
     */

    #hpd-mobile-department-nav {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 10070;
        background: #ffffff;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.16);
    }

    #hpd-mobile-department-nav.is-visible {
        display: block;
    }


    /* ---------- ORANGE TRIGGER ---------- */

    #hpd-mobile-department-nav .hpd-mobile-department-trigger {
        width: 100%;
        min-height: 44px;
        margin: 0;
        padding: 0 16px;

        display: flex;
        align-items: center;
        justify-content: center;
        gap: 9px;

        border: 0;
        border-radius: 0;
        background: #ff8a00;
        color: #ffffff;

        font-family: Arial, Helvetica, sans-serif;
        font-size: 14px;
        font-weight: 700;
        line-height: 1;
        letter-spacing: 0.3px;

        cursor: pointer;
        appearance: none;
        -webkit-appearance: none;
    }

    #hpd-mobile-department-nav .hpd-mobile-department-arrow {
        display: inline-block;
        font-size: 11px;
        line-height: 1;
        transition: transform 0.18s ease;
    }

    #hpd-mobile-department-nav.is-open
    .hpd-mobile-department-arrow {
        transform: rotate(180deg);
    }


    /* ---------- DROPDOWN PANEL ---------- */

    #hpd-mobile-department-panel {
        display: none;
        width: 100%;
        max-height: calc(100vh - 44px);
        overflow-y: auto;
        background: #ffffff;
        border-top: 1px solid rgba(14, 42, 71, 0.12);
        -webkit-overflow-scrolling: touch;
    }

    #hpd-mobile-department-nav.is-open
    #hpd-mobile-department-panel {
        display: block;
    }


    /* ---------- DEPARTMENT LINKS ---------- */

    #hpd-mobile-department-panel a {
        min-height: 45px;
        padding: 0 18px;

        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;

        background: #ffffff;
        border-bottom: 1px solid #e6e9ec;

        color: #0e2a47;
        font-family: Arial, Helvetica, sans-serif;
        font-size: 14px;
        font-weight: 700;
        line-height: 1.2;
        text-decoration: none;
    }

    #hpd-mobile-department-panel a:active,
    #hpd-mobile-department-panel a:focus {
        background: #f5f7f9;
        color: #ff8a00;
    }

    #hpd-mobile-department-panel a span:last-child {
        flex: 0 0 auto;
        color: #ff8a00;
        font-size: 22px;
        font-weight: 400;
        line-height: 1;
    }


    /* ---------- MAIN PAGE / SHOP BY STATE ---------- */

    #hpd-mobile-department-panel
    .hpd-mobile-secondary-link {
        background: #f4f7fa;
    }

}