@use "../abstracts" as vars;

// =============================================
// CSS Custom Properties (mapped from Cdrive palette)
// =============================================
:root {
    --header-primary: #{vars.$footer-bg}; // #191825 (dark navy)
    --header-accent: #{vars.$footer-accent}; // #0073E6 (blue)
    --header-white: #{vars.$color-white};
    --header-text: #{vars.$color-text};
    --header-border: rgba(255, 255, 255, 0.12);
    --header-bg-sticky: #ffffff;
    --header-shadow: 0 4px 30px rgba(0, 0, 0, 0.08);
}

// =============================================
// Offcanvas Overlay
// =============================================
.offcanvas-overlay {
    position: fixed;
    height: 100%;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1100;
    top: 0;
    left: 0;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);

    &.overlay-open {
        opacity: 1;
        visibility: visible;
    }
}

// =============================================
// Side Info (Offcanvas Sidebar)
// =============================================
.side-info {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    height: 100%;
    position: fixed;
    z-index: 1200;
    right: -100%;
    top: 0;
    width: 420px;
    overflow-y: auto;
    transition: right 0.6s cubic-bezier(0.77, 0, 0.175, 1);
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.12);

    @media (max-width: 576px) {
        width: 100%;
    }

    &::-webkit-scrollbar {
        width: 4px;
    }

    &::-webkit-scrollbar-thumb {
        background: rgba(0, 115, 230, 0.3);
        border-radius: 10px;
    }

    &.info-open {
        right: 0;
    }
}

.side-info-content {
    position: relative;
    min-height: 100%;
    padding-bottom: 20px;
}

.side-info-close {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 20px;
    padding: 0;
    background-color: rgba(0, 115, 230, 0.08);
    color: var(--header-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 115, 230, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;

    &:hover {
        transform: rotate(90deg) scale(1.1);
        background-color: var(--header-accent);
        color: var(--header-white);
        border-color: var(--header-accent);
    }
}

.offset-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: vars.rem(20) vars.rem(20);
    margin-bottom: vars.rem(10);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.offset-logo img {
    max-width: vars.rem(130);
}

.offset-info-box {
    padding: vars.rem(10) vars.rem(20);
    margin-bottom: vars.rem(10);

    .title {
        font-size: vars.rem(28);
        font-weight: 700;
        line-height: 1.2;
        color: vars.$color-heading;
        margin-bottom: vars.rem(10);
    }

    .text {
        font-size: vars.rem(15);
        color: vars.$color-text2;
        line-height: 1.3;
        margin-bottom: 0;
    }
}

.offset-widget-box {
    padding: vars.rem(10) vars.rem(20);
    margin-bottom: vars.rem(10);

    .title {
        font-size: vars.rem(16);
        font-weight: 700;
        color: vars.$color-heading;
        margin-bottom: vars.rem(15);
        position: relative;

        &::after {
            content: "";
            position: absolute;
            bottom: -5px;
            left: 0;
            width: 28px;
            height: 2px;
            background: vars.$footer-accent;
        }
    }

    .contact-meta {
        margin-top: vars.rem(15);
    }

    .contact-item {
        margin-bottom: vars.rem(8);

        a,
        span.text {
            font-size: vars.rem(15);
            color: vars.$color-text2;
            transition: color 0.3s ease;

            &:hover {
                color: vars.$footer-accent;
            }
        }
    }

    .social-links {
        display: flex;
        gap: vars.rem(10);
        margin-top: vars.rem(20);

        a {
            width: vars.rem(42);
            height: vars.rem(42);
            border: 1px solid rgba(0, 0, 0, 0.1);
            display: inline-flex;
            justify-content: center;
            align-items: center;
            border-radius: 50%;
            font-size: vars.rem(13);
            font-weight: 600;
            color: vars.$color-heading;
            transition: all 0.3s ease;

            &:hover {
                background-color: vars.$footer-accent;
                border-color: vars.$footer-accent;
                color: #fff;
                transform: translateY(-4px);
                box-shadow: 0 6px 16px rgba(0, 115, 230, 0.3);
            }
        }
    }
}

// =============================================
// Mobile Nav (inside offcanvas sidebar)
// =============================================
.mobile-nav {
    padding-top: vars.rem(10);

    &__list {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    &__item {
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);

        &:last-child {
            border-bottom: none;
        }
    }

    &__link {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: vars.rem(13) 0;
        font-family: vars.$font-family-base;
        font-size: vars.rem(15);
        font-weight: 600;
        color: vars.$color-heading;
        text-decoration: none;
        transition: color 0.25s ease;

        &:hover {
            color: vars.$footer-accent;
        }
    }

    &__arrow {
        width: vars.rem(26);
        height: vars.rem(26);
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1px solid rgba(0, 0, 0, 0.1);
        border-radius: 50%;
        font-size: vars.rem(11);
        flex-shrink: 0;
        transition: transform 0.3s ease, background 0.3s ease, border-color 0.3s ease;

        i {
            pointer-events: none;
        }
    }

    &__item--has-children {
        &.open>.mobile-nav__link {
            color: vars.$footer-accent;

            .mobile-nav__arrow {
                transform: rotate(180deg);
                background: vars.$footer-accent;
                border-color: vars.$footer-accent;
                color: #fff;
            }
        }
    }

    &__sub {
        list-style: none;
        margin: 0;
        padding: 0 0 vars.rem(8) vars.rem(10);
        display: none; // toggled by JS

        li a {
            display: block;
            padding: vars.rem(8) vars.rem(12);
            font-size: vars.rem(14);
            font-weight: 500;
            color: vars.$color-text2;
            border-radius: vars.rem(6);
            text-decoration: none;
            transition: background 0.2s ease, color 0.2s ease;

            &:hover {
                background: rgba(0, 115, 230, 0.07);
                color: vars.$footer-accent;
            }
        }
    }
}

// =============================================
// Header Area 1 (Redesigned)
// =============================================
.header-area-1 {
    position: relative;
    z-index: 1000;
    width: 100%;

    .container {
        max-width: 1440px;
    }
}

// Top Tier
.header-top-tier {
    background-color: #fff;
    position: relative;
    padding: vars.rem(25) 0;
    border-bottom: 2px solid rgba(0, 0, 0, 0.05);

    &__bg {
        position: absolute;
        top: 23%;
        left: 0;
        z-index: 0;
        height: 100%;
        width: 100%;

        @media (max-width: 1799px) {
            display: none;
        }

        img {
            height: 100%;
            width: 100%;
            display: block;
        }
    }

    &__shape-left {
        position: absolute;
        top: 2%;
        left: 0;
        z-index: 1;
        height: 100%;
        display: none;

        @media (max-width: 1399px) {
            display: none;
        }

        img {
            height: 100%;
            display: block;
        }
    }

    &__shape-right {
        position: absolute;
        top: 2;
        right: 0;
        z-index: 1;
        height: 100%;
        display: none;

        @media (max-width: 1399px) {
            display: none;
        }

        img {
            height: 100%;
            display: block;
        }
    }

    &__inner {
        position: relative;
        z-index: 9;
        display: flex;
        align-items: center;
        justify-content: space-between;

        .header-logo {
            position: relative;
            z-index: 9;
        }
    }
}

.header-contact {
    display: flex;
    align-items: center;
    gap: vars.rem(50);
    margin-right: -100px;

    @media (max-width: 1399px) {
        gap: vars.rem(20);
        margin-right: 0;
    }

    &__item {
        display: flex;
        align-items: center;
        gap: vars.rem(15);
    }

    &__icon {
        width: vars.rem(40);
        height: vars.rem(40);
        background: vars.$color-primary;
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: vars.rem(8);
        font-size: vars.rem(16);
    }

    &__info {
        a {
            font-size: vars.rem(17);
            font-weight: 600;
            color: vars.$color-heading;
            transition: color 0.3s ease;
            text-decoration: none;

            @media (max-width: 1399px) {
                font-size: vars.rem(15);
            }

            &:hover {
                color: vars.$color-primary;
            }
        }
    }
}

.header-search {
    &__box {
        position: relative;
        display: flex;
        align-items: center;
        background: #f0f3f8;
        border-radius: vars.rem(50);
        padding: vars.rem(6) vars.rem(6) vars.rem(6) vars.rem(25);
        min-width: vars.rem(420);

        .theme__btn-shape {
            position: absolute;
            top: 0px;
            right: 0;
            z-index: 0;
        }

        input {
            border: none;
            background: transparent;
            font-size: vars.rem(15);
            font-weight: 500;
            color: vars.$color-heading;
            width: 100%;
            outline: none;

            &::placeholder {
                color: #888;
            }
        }

        i {
            color: vars.$color-black;
            font-size: vars.rem(18);
            margin-right: vars.rem(15);
        }

        .theme__btn {
            padding: 13px 46px 13px 30px;

            i {
                color: vars.$color-white;
                font-size: vars.rem(18);
                margin-right: vars.rem(15);
            }
        }


    }

}

// Bottom Tier
.header-bottom-tier {
    background: linear-gradient(90deg, #0073E6 0%, #191825 66.83%);

    position: relative;
    z-index: 9;



    &__inner {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: vars.rem(80);
    }

    &.sticky {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        animation: slideInDown 0.6s ease;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    }
}

.header-socials {
    display: flex;
    align-items: center;
    gap: vars.rem(30);

    a {
        color: #fff;
        font-size: vars.rem(18);
        transition: all 0.4s ease;
        text-decoration: none;

        &:hover {
            color: vars.$color-primary;
            transform: translateY(-5px);
        }
    }
}

.header-nav {
    .main-menu {
        >ul {
            display: flex;
            align-items: center;
            gap: vars.rem(53);
            list-style: none;
            margin: 0;
            padding: 0;

            @media(max-width: 1399px) {
                gap: vars.rem(30);
            }

            >li {
                position: relative;

                >a {
                    position: relative;
                    color: #fff;
                    font-size: vars.rem(15);
                    font-weight: 700;
                    text-transform: uppercase;
                    padding: vars.rem(28) 0;
                    display: block;
                    text-decoration: none;
                    transition: color 0.3s ease;
                    letter-spacing: 0.5px;

                    &::after {
                        content: "";
                        position: absolute;
                        bottom: vars.rem(18);
                        left: 0;
                        width: 0;
                        height: 2px;
                        background: vars.$color-primary;
                        transition: width 0.3s ease;
                    }
                }

                &:hover>a {
                    color: vars.$color-primary;

                    &::after {
                        width: 100%;
                    }
                }

                &.menu-item-has-children>a::before {
                    position: absolute;
                    top: 50%;
                    transform: translateY(-50%);
                    right: -16px;
                    content: "\f107";
                    font-family: "Font Awesome 6 Free";
                    font-weight: 900;
                    font-size: vars.rem(12);
                }
            }
        }
    }
}

// Dropdown menu
ul.dp-menu {
    background-color: #ffffff;
    padding: vars.rem(12) 0;
    min-width: vars.rem(240);
    position: absolute;
    top: 100%;
    left: 0;
    opacity: 0;
    pointer-events: none;
    z-index: 100;
    transition: all 0.3s ease;
    border-radius: vars.rem(10);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
    transform: translateY(vars.rem(15));
    list-style: none;
    margin: 0;

    li {
        padding: 0 vars.rem(10);

        a {
            display: block;
            font-size: vars.rem(15);
            font-weight: 500;
            color: vars.$color-heading;
            padding: vars.rem(10) vars.rem(16);
            border-radius: vars.rem(8);
            transition: background 0.2s ease, color 0.2s ease;
            text-decoration: none;

            &:hover {
                background: rgba(vars.$color-primary, 0.08);
                color: vars.$color-primary;
            }
        }
    }
}

.main-menu>ul>li:hover>ul.dp-menu {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

.header-auth {
    a {
        color: #fff;
        font-size: vars.rem(15);
        font-weight: 700;
        text-transform: uppercase;
        transition: color 0.3s ease;
        text-decoration: none;
        letter-spacing: 0.5px;

        &:hover {
            color: vars.$color-primary;
        }
    }
}

// Side toggle
.side-toggle {
    width: vars.rem(48);
    height: vars.rem(48);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: vars.rem(10);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: transparent;
    transition: all 0.3s ease;
    color: #fff;
    font-size: vars.rem(24);

    &:hover {
        background: vars.$color-primary;
        border-color: vars.$color-primary;
        transform: rotate(90deg);
    }
}

// Mobile Adjustments
@media (max-width: 991px) {
    .header-top-tier {
        display: none;
    }

    .header-bottom-tier {
        background: #fff;
        padding: vars.rem(15) 0;

        &::before {
            display: none;
        }

        &__inner {
            height: auto;
        }
    }

    .header-socials,
    .header-nav,
    .header-auth {
        display: none;
    }

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

    .side-toggle {
        color: vars.$color-heading;
        border-color: rgba(0, 0, 0, 0.1);
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

// Placeholder for split animation if needed
.split-word {
    display: inline-block;
    overflow: hidden;
    vertical-align: bottom;
    line-height: inherit;

    &__inner {
        display: inline-block;
        line-height: inherit;
    }
}

// =============================================
// Header Area 2 (Home 2 Design)
// =============================================
.header-area-2 {
    position: relative;
    z-index: 1000;

    .header2-top {
        color: #fff;
        background-color: #0073E6;
        border-top-left-radius: 100px;
        border-top-right-radius: 100px;
        position: relative;
        z-index: 10;
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);

        @media(max-width: 1399px) {
            border-top-left-radius: 40px;
            border-top-right-radius: 40px;
        }

        &.header-sticky.sticky {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            margin-top: 0;
            border-radius: 0;
            background: var(--header-accent);
            animation: slideInDown 0.5s ease-out;
            box-shadow: 0 5px 30px rgba(0, 0, 0, 0.1);
        }

        &__inner {
            display: flex;
            align-items: center;
            justify-content: space-between;
            position: relative;
            z-index: 9999;
        }

        &__socials {
            display: flex;
            gap: vars.rem(20);

            a {
                color: #fff;
                font-size: vars.rem(16);
                transition: color 0.3s ease;

                &:hover {
                    color: #191825;
                }
            }
        }

        &__auth {
            a {
                color: #fff;
                font-size: vars.rem(14);
                font-weight: 700;
                text-transform: uppercase;
                letter-spacing: 0.5px;
                text-decoration: none;

                &:hover {
                    opacity: 0.8;
                }
            }
        }

        .main-menu {
            >ul {
                display: flex;
                gap: vars.rem(53);
                margin: 0;
                padding: 0;
                list-style: none;

                @media(max-width: 1399px) {
                    gap: vars.rem(30);
                }

                >li {
                    position: relative;

                    >a {
                        display: inline-flex;
                        color: #fff;
                        padding: vars.rem(22) 0;
                        font-size: vars.rem(14);
                        font-weight: 700;
                        text-transform: uppercase;
                        text-decoration: none;
                        transition: color 0.3s ease;

                        &:hover {
                            color: #191825;
                        }
                    }

                    &.menu-item-has-children>a::after {
                        position: absolute;
                        top: 50%;
                        transform: translateY(-50%);
                        right: -16px;
                        content: "\f107";
                        font-family: "Font Awesome 6 Free";
                        font-weight: 900;
                        font-size: 0.75rem;
                    }

                    &:hover>ul.dp-menu {
                        opacity: 1;
                        visibility: visible;
                        transform: translateY(0);
                    }
                }
            }

            .dp-menu {
                position: absolute;
                top: 100%;
                left: 0;
                background: #fff;
                min-width: 200px;
                padding: 20px 0;
                box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
                opacity: 0;
                visibility: hidden;
                transform: translateY(10px);
                transition: all 0.3s ease;
                z-index: 100;
                list-style: none;

                li {
                    padding: 0 25px;
                    margin-bottom: 10px;

                    &:last-child {
                        margin-bottom: 0;
                    }

                    a {
                        color: #666;
                        font-size: 14px;
                        font-weight: 600;
                        text-decoration: none;
                        transition: all 0.3s ease;

                        &:hover {
                            color: var(--header-accent);
                            padding-left: 5px;
                        }
                    }
                }
            }
        }
    }

    .header2-bottom {
        position: relative;
        z-index: 5;
        transition: all 0.3s ease;

        &:before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 10px;
            background: vars.$color-white;
            z-index: -1;

            @media (max-width: 1899px) {
                display: none;
            }
        }

        &__shape {
            position: absolute;
            top: 8%;
            left: 50%;
            right: auto;
            transform: translateX(-50%);
            z-index: -1;
            width: 100%;
            height: 100%;
            pointer-events: none;

            @media (max-width: 1699px) {
                display: none;
            }

            img {
                width: 100%;
                height: 100%;
                display: block;
            }

            @media (max-width: 1399px) {
                display: none;
            }
        }

        &.header-sticky.sticky {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            margin-top: 0;
            padding: vars.rem(10) 0;
            background: #fff;
            animation: slideInDown 0.5s ease-out;
            box-shadow: 0 5px 30px rgba(0, 0, 0, 0.1);

            .header2-bottom__pill {
                background: transparent;
                box-shadow: none;
                padding: 0;
                border-radius: 0;
                color: #191825;
            }

            .header2-bottom__contact-item .text a {
                color: #191825;
            }
        }

        &__pill {
            background-color: var(--header-primary);
            color: #fff;
            border-radius: 100px;
            padding: vars.rem(12) vars.rem(45);
            display: flex;
            align-items: center;
            justify-content: space-between;
            box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
            transition: all 0.3s ease;
        }

        &__contacts {
            display: flex;
            gap: vars.rem(40);
        }

        &__contact-item {
            display: flex;
            align-items: center;
            gap: vars.rem(10);

            .icon {
                width: 20px;
                height: 20px;
                color: vars.$color-black;
                border-radius: 4px;
                background: vars.$color-primary;
                display: flex;
                align-items: center;
                justify-content: center;

                i {
                    color: vars.$color-black;
                    font-size: 12px;
                }
            }

            .text a {
                color: vars.$color-white;
                font-size: vars.rem(15);
                font-weight: 500;
                text-decoration: none;
                transition: color 0.3s ease;

                &:hover {
                    color: var(--header-accent);
                }
            }
        }

        &__right {
            display: flex;
            align-items: center;
            gap: vars.rem(20);
        }

        .header-search {
            &__box {
                background: #fff;
                border: 1px solid rgba(0, 0, 0, 0.05);
                border-radius: 100px;
                padding: 8px 8px 8px 25px;
                display: flex;
                align-items: center;
                min-width: vars.rem(320);

                .theme__btn-shape {
                    position: absolute;
                    top: 0px;
                    right: 0;
                    z-index: 0;
                }

                @media (max-width: 1399px) {
                    display: none;
                }

                i {
                    color: #888;
                    margin-right: 10px;
                }

                input {
                    border: none;
                    outline: none;
                    background: transparent;
                    width: 100%;
                    font-size: vars.rem(16);
                    font-family: vars.$font-family-base;
                    font-weight: 500;
                    line-height: 100%;
                    letter-spacing: 0%;
                    color: #878C8F;

                    &::placeholder {
                        font-family: vars.$font-family-base;
                        font-weight: 500;
                        font-size: 16px;
                        line-height: 100%;
                        letter-spacing: 0%;
                        color: #878C8F;
                    }
                }

                .theme__btn {
                    padding: 14px 50px 14px 20px;
                    border-radius: 100px;
                    background: var(--header-accent);
                    min-width: auto;
                    height: auto;

                    .theme__btn-text {
                        font-family: vars.$font-family-base;
                        font-weight: 700;
                        font-style: Bold;
                        font-size: 16px;
                        line-height: 100%;
                        letter-spacing: 2%;
                        text-align: right;
                        text-transform: uppercase;
                        color: #fff;
                    }


                    i {
                        color: #fff;
                        font-size: 12px;
                        margin: 0 0 0 0px;
                    }
                }
            }
        }

        .header-cart-btn {
            width: vars.rem(52);
            height: vars.rem(52);
            background: #FFFFFF33;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #fff;
            font-size: vars.rem(18);
            transition: all 0.3s ease;
            text-decoration: none;

            @media (max-width: 992px) {
                display: none;
            }

            &:hover {
                background: var(--header-accent);
                transform: translateY(-3px);
                color: #fff;
            }
        }
    }
}

// Mobile Adjustments for Header 2
@media (max-width: 991px) {
    .header-area-2 {
        margin-top: 0;

        .header2-bottom {
            margin-top: 0;
            padding: 15px 0;
            background: #011424;

            &__pill {
                background: transparent;
                padding: 0;
                box-shadow: none;
                border-radius: 0;
                color: #191825;
            }

            .header-cart-btn {
                border: 1px solid #eee;
                color: #191825;


            }

            .side-toggle {
                color: #ffffff;
                border-color: #eee;
            }
        }
    }
}