@import "./common-var.css";

/* -------------------------------------------------------
   Header Shell
   ------------------------------------------------------- */
.omifco-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: transparent;
    border-bottom: 1px solid transparent;
    padding: 15px 0;
    transition: background 0.3s ease, border-color 0.3s ease;

    &.scrolled {
        background: rgba(246,248,247,.85);
        border-bottom: 1px solid var(--nav-border);
        backdrop-filter: blur(10px);
        .nav-brand-logo{
            transition: all 0.5s;
            color: var(--primary-color);
        }
        .toggler-bar {
            background: var(--primary-color);
        }
        .nav-link-item {
            color: var(--primary-color);
            svg{
                path{
                    fill: var(--primary-color);
                }
            }
        }
        .nav-collapse {
            @media(max-width:1199px){
                background-color: var(--white);
            }
        }
        .nav-actions {
            .custom-nav-button{
                background-color: var(--primary-color);
                color: var(--white);
                &:hover{
                    background-color: var(--secondary-color);
                    color: var(--white);
                }
            }
        }
    }

    .container-fluid {
        max-width: 91%;
        @media(max-width:1300px){
            max-width: 100%;
        }
    }
}

/* -------------------------------------------------------
   Navbar
   ------------------------------------------------------- */
.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    @media(max-width:1400px){
        gap: 16px;
    }
}

/* -------------------------------------------------------
   Brand / Logo
   ------------------------------------------------------- */
.nav-brand {
    flex-shrink: 0;
    display: block;
    .nav-brand-logo{
        width: auto;
        height: 48px;
        color: var(--white);
    }

    img {
        height: 48px;
        width: auto;
        display: block;

        @media (max-width: 1440px) { height: 42px; }
        @media (max-width: 1199px) { height: 36px; }
    }
}

/* -------------------------------------------------------
   Hamburger Toggler
   ------------------------------------------------------- */
.nav-toggler {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 22px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    z-index: 1111;

    .toggler-bar {
        display: block;
        width: 100%;
        height: 3px;
        background: var(--grey);
        border-radius: 2px;
        transition: transform 0.3s ease, opacity 0.3s ease;
    }

    &.active {
        .toggler-bar:nth-child(1) { transform: rotate(45deg) translate(6px, 8px); }
        .toggler-bar:nth-child(2) { opacity: 0; }
        .toggler-bar:nth-child(3) { transform: rotate(-45deg) translate(5px, -8px); }
    }

    @media (max-width: 1199px) { display: flex; }
}

/* -------------------------------------------------------
   Collapse / Drawer
   ------------------------------------------------------- */
.nav-collapse {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 20px;

    @media (max-width: 1199px) {
        display: none;
        flex-direction: column;
        align-items: stretch;
        position: fixed;
        top: 0;
        right: -100%;
        width: min(380px, 100%);
        height: 100vh;
        background: var(--primary-color);
        overflow-y: auto;
        padding: 20px;
        gap: 0;
        transition: right 0.3s ease;
        box-shadow: -4px 0 16px rgba(0, 0, 0, 0.12);
        z-index: 999;

        &.open {
            right: 0;
            display: flex;
        }
    }
    @media (max-width: 576px) {
        height: 85vh;
        padding: 10px 20px;
        &.open {
            margin-top: 78px;
        }
    }
}

/* -------------------------------------------------------
   Nav Menu List
   ------------------------------------------------------- */
.nav-menu {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
    flex: 1;
    margin: 0;
    padding: 0;
    list-style: none;

    @media (max-width: 1440px) { gap: 15px; }
    @media (max-width: 1199px) {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        flex: none;
    }
}

/* Nav Item */
.nav-item {
    position: relative;

    @media (max-width: 1199px) {
        border-bottom: 1px solid rgba(15, 63, 71, 0.08);
    }
}

/* Nav Link */
.nav-link-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 30px;
    color: rgba(246,248,247,.8);
    font-size: 14px;
    font-weight: 400;
    line-height: 23px;
    white-space: nowrap;
    transition: color 0.25s ease;
    cursor: pointer;
    svg{
        path{
            fill: rgba(246,248,247,.8);
        }
    }

    &:hover {
        color: rgba(246,248,247, 1);
        border-bottom: 1px solid var(--secondary-color);

        .nav-caret { color: var(--primary-color); }
    }

    .nav-caret {
        flex-shrink: 0;
        color: var(--secondary-subtext-color);
        transition: transform 0.25s ease, color 0.25s ease;
    }

    @media (max-width: 1440px) { font-size: 13px; }
    @media (max-width: 1199px) {
        display: flex;
        height: auto;
        padding: 11px 0;
        font-size: 15px;
        width: 100%;
        justify-content: space-between;
        white-space: normal;
    }
}

/* Active nav link */
.nav-link-item.nav-active {
    color: var(--white);
    border-bottom: 1px solid var(--secondary-color);

    @media (max-width: 1199px) {
        border-bottom: none;
        color: var(--secondary-color);
    }
}

/* -------------------------------------------------------
   Dropdown Card
   ------------------------------------------------------- */
.has-dropdown {
    .nav-dropdown {
        position: absolute;
        top: calc(100% + 28px);
        left: 0;
        min-width: 257px;
        background: var(--nav-dropdown-bg);
        border-radius: 15px;
        padding: 12px;
        display: flex;
        flex-direction: column;
        gap: 4px;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-6px);
        transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
        z-index: 200;

        /* transparent bridge so mouse can reach dropdown */
        &::before {
            content: '';
            position: absolute;
            top: -18px;
            left: 0;
            right: 0;
            height: 18px;
        }
    }

    /* Show on desktop hover */
    &:hover .nav-dropdown {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    &:hover > .nav-link-item .nav-caret {
        transform: rotate(180deg);
        color: var(--primary-color);
    }

    /* Mobile: accordion via .dropdown-open class */
    @media (max-width: 1199px) {
        .nav-dropdown {
            position: static;
            min-width: auto;
            border-radius: 10px;
            opacity: 1;
            visibility: visible;
            transform: none;
            max-height: 0;
            overflow: hidden;
            padding: 0;
            gap: 0;
            transition: max-height 0.3s ease, padding 0.3s ease;

            &::before { display: none; }
        }

        &.dropdown-open {
            .nav-dropdown {
                max-height: 500px;
                padding: 8px;
                margin-bottom: 8px;
                gap: 4px;
            }

            .nav-caret { transform: rotate(180deg); }
        }
    }
}

/* Dropdown Item */
.dropdown-nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--secondary-subtext-color);
    font-family: var(--font-type1);
    font-size: 14px;
    font-weight: 400;
    line-height: 23px;
    transition: background 0.25s ease, color 0.25s ease;
    white-space: nowrap;
    
    &:hover {
        background: var(--primary-color);
        color: var(--white);

        svg {
            path{
                fill: var(--white);
            }
        }
    }

    @media (max-width: 1199px) {
        white-space: normal;
        padding: 10px 8px 10px 14px;
    }
}

/* -------------------------------------------------------
   Desktop Actions
   ------------------------------------------------------- */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    .custom-nav-button{
        background-color: var(--secondary-color);
        color: var(--white);
        &:hover{
            background-color: var(--white);
            color: var(--primary-color);
            svg{
                path{
                    fill: var(--primary-color);
                }
            }
        }
    }
}

/* Language Widget */
.lang-widget {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 40px;
    padding: 5px;
    border-radius: 50px;
    background: var(--background-light);

    .lang-pill-wrapper {
        display: flex;
        align-items: center;
        width: 76px;
        height: 32px;
        padding: 2px;
        border-radius: 21px;
        background: var(--nav-lang-toggle-bg);
        flex-shrink: 0;
    }

    .lang-btn {
        flex: 1;
        height: 100%;
        border: none;
        background: transparent;
        border-radius: 21px;
        font-family: var(--font-type1);
        font-size: 12px;
        font-weight: 700;
        color: var(--nav-teal-secondary);
        cursor: pointer;
        transition: background 0.25s ease, color 0.25s ease;
        padding: 0;

        &.active {
            background: var(--secondary-color);
            color: var(--primary-color);
        }
    }

    .globe-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        border: none;
        background: transparent;
        padding: 0;
        cursor: pointer;
        flex-shrink: 0;
    }
}

/* -------------------------------------------------------
   Mobile-only Actions
   ------------------------------------------------------- */
.nav-actions-mobile {
    margin-top: auto;
    display: flex;
    gap: 10px;

    .lang-widget {
        justify-content: center;
    }
    .btn-type1{
        background-color: var(--secondary-color);
    }
}

/* -------------------------------------------------------
   Overlay
   ------------------------------------------------------- */
.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 998;
    
    &.visible {
        opacity: 1;
        visibility: visible;
        @media (max-width: 576px) {
            opacity: 0;
        }
    }
}

/* Prevent body scroll when mobile menu is open */
body.omifco-menu-open { overflow: hidden; }

/* -------------------------------------------------------
   RTL Support
   ------------------------------------------------------- */
[dir="rtl"] {
    .has-dropdown {
        .nav-dropdown {
            left: auto;
            right: 0;
        }

        .nav-caret {
            transform: scaleX(-1);
        }

        &:hover > .nav-link-item .nav-caret {
            transform: scaleX(-1) rotate(180deg);
        }

        &.dropdown-open .nav-caret {
            transform: scaleX(-1) rotate(180deg);
        }
    }

    .dropdown-nav-item {
        svg {
            transform: rotate(180deg);
        }
        .item-arrow { transform: scaleX(-1); }

        &:hover .item-arrow { transform: scaleX(-1); }
        
    }

    @media (max-width: 1199px) {
        .nav-collapse {
            right: auto;
            left: -100%;
            transition: left 0.3s ease;
            box-shadow: 4px 0 16px rgba(0, 0, 0, 0.12);

            &.open {
                left: 0;
                right: auto;
            }
        }

    }
}

/* -------------------------------------------------------
   Responsive fine-tuning
   ------------------------------------------------------- */
@media (max-width: 1360px) {
    .nav-link-item { font-size: 13px; }
}

@media (max-width: 576px) {
    .nav-collapse { width: 100%; }

    .omifco-navbar .nav-container { padding: 12px 16px; }
}
