/* ================== MEGAMENU & DROPDOWN ================== */

/* Use blog dropdown styles for header dropdown */
.header_menu__item--has-dropdown .header_menu__wrap {
    position: relative;
}

/* Hover states for header dropdown using blog styles */
@media (min-width: 1024px) {
    .header_menu__item--has-dropdown:hover .blog-nav__dropdown {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);

        border-radius: 0 0 .6rem .6rem;
        top: 4.75rem;
        box-shadow: 0px 10px 15px -3px rgba(0, 0, 0, 0.10), 0px 4px 6px -2px rgba(0, 0, 0, 0.05);
        border-left: none;
        border-right: none;
        border-bottom: none;
    }
    .blog-nav__dropdown.blog-nav__dropdown--border {
        border-left: none;
        border-right: none;
        border-bottom: none;
    }
}

.megamenu {
    position: absolute;
    top: 5.5rem;
    left: 0;
    /* transform: translateX(-28.71%) translateY(0.7rem); */
    width: 100vw;
    max-width: 128rem; /* 1300px */
    background: #FFFFFF;
    border-top: 1px solid #E2E8F0;
    border-radius: 0 0 0.8rem 0.8rem;
    box-shadow: 0px 10px 15px -3px rgba(0, 0, 0, 0.10), 0px 4px 6px -2px rgba(0, 0, 0, 0.05);   
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    z-index: 1000;
    display: none;
}

/* Hover states for desktop only */
@media (min-width: 1024px) {
    .header_menu__item--has-megamenu:hover .megamenu {
        opacity: 1;
        visibility: visible;
        /* transform: translateX(-28.71%) translateY(0.7rem); */
        display: block;
    }
    /* Change header__in:before border-radius when hovering megamenu item */
    .header__in:has(.header_menu__item--has-megamenu:hover):before,
    .header__in:has(.megamenu:hover):before {
        border-radius: 0.8rem 0.8rem 0 0 !important;
    }
}

/* JS controlled states */
.megamenu[style*="display: block"] {
    display: block !important;
}

.megamenu[style*="opacity: 1"] {
    transform: translateY(0);
}

/* Position relative for megamenu container */
.header_menu__item--has-megamenu .header_menu__wrap {
    position: relative;
}

.megamenu__container {
    padding: 2.4rem 3.2rem;
    margin-bottom: 2.4rem;
}

.megamenu__content {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    max-width: calc(136rem - var(--gl-hr-indent)* 2); /* 1232px */
    margin: 0 auto;
}

.megamenu__services {
    display: flex;
    align-items: flex-start;
    align-self: stretch;
    gap: 3rem;
    flex: 1;
    width: 85.4rem; /* 854px */
}

.megamenu__service-group {
    display: flex;
    flex-direction: column;
    flex: 0 1 20.6rem;
    min-width: 20rem;
    padding: 1.6rem 0;
}

.megamenu__service-header {
    display: flex;
    gap: 0.8rem;
    margin: 0 0 2rem 0;
}

.megamenu__service-title {
    font-family: Inter;
    font-weight: 500;
    font-size: 1.2rem;
    line-height: 1.333;
    text-transform: uppercase;
    color: #64748B;
    margin: 0;
    padding: 0 0 0.4rem;
    border-bottom: 1px solid #E2E8F0;
}

.megamenu__service-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin: 0;
    width: 100%;
}

.megamenu__service-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.4rem 0;
    width: 100%;
}

.megamenu__service-link {
    font-family: Inter;
    font-weight: 500;
    font-size: 1.4rem;
    line-height: 1.429;
    color: #020617;
    text-decoration: none;
    transition: color 0.2s ease;
}

.megamenu__service-link:hover {
    color: #1D4ED8;
    text-decoration: none;
}

/* Active service item styles */
.megamenu__service-item--active .megamenu__service-link {
    /* color: #FF4E32;
    font-weight: 600;
    background-color: #FFF1F0;
    padding: 0.8rem 1.2rem;
    border-radius: 0.4rem; */
}

.megamenu__service-item--active .megamenu__service-link:hover {
    /* color: #FF4E32;
    text-decoration: none; */
}

.megamenu__featured {
    display: flex;
    flex-direction: column;
    gap: 2.6rem;
    padding: 2.4rem;
    background: #EFF6FF;
    border-radius: 0.8rem;
    width: 100%;
    max-width: 24.8rem; /* 248px */
}

.megamenu__featured-image {
    width: 100%; /* 200px */
    height: 13.6rem; /* 136px */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 0.8rem;
    flex-shrink: 0;
}

.megamenu__featured-image img{
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0.8rem;
}

.megamenu__featured-content {
    display: flex;
    flex-direction: column;
    align-self: stretch;
    gap: 0.4rem;
}

.megamenu__featured-title h4 {
    font-family: Inter;
    font-weight: 700;
    font-size: 1.6rem;
    line-height: 1.5;
    color: #020617;
    margin: 0;
}

.megamenu__featured-link {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 0.8rem;
    height: 4rem; /* 40px */
    padding: 0 ;
    font-family: Inter;
    font-weight: 500;
    font-size: 1.4rem;
    line-height: 1.429;
    color: #FF4E32;
    text-decoration: none;
    background: transparent;
    border-radius: 0.6rem;
    transition: all 0.2s ease;
}


/* Body overlay for megamenu (controlled by JS) */
.megamenu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #020617;
    opacity: 0;
    visibility: hidden;
    z-index: 50;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.megamenu-overlay.active {
    opacity: 0.1;
    visibility: visible;
}

/* Ensure header is above overlay - minimal changes */

/* Mobile menu styles - NEW SYSTEM with unique classes */

/* Hide new mobile menu by default */
.mobile-header {
    display: none;
}

/* Show mobile menu only on mobile screens */
@media (max-width: 1199px) {
    /* Hide old mobile menu trigger - keep existing desktop functionality */
    .header_trigger {
        display: none;
    }
    
    /* Show new mobile trigger */
    .mobile-trigger {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 1.6rem;
        height: 1.6rem;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
        gap: 0.3rem;
    }
    
    .mobile-trigger__line {
        width: 1.6rem;
        height: 0.15rem;
        background: #020617;
        border-radius: 0.2rem;
        transition: all 0.3s ease;
    }
    
    .mobile-trigger.active .mobile-trigger__line:nth-child(1) {
        transform: translateY(0.5rem) rotate(45deg);
    }
    
    .mobile-trigger.active .mobile-trigger__line:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-trigger.active .mobile-trigger__line:nth-child(3) {
        transform: translateY(-0.5rem) rotate(-45deg);
    }
    
    /* Mobile language button in header */
    .mobile-controls__lang {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        background: none;
        border: none;
        font-size: 1.4rem;
        font-weight: 500;
        color: #020617;
        cursor: pointer;
        padding: 0.4rem 0.8rem;
        border-radius: 0.6rem;
        transition: background-color 0.2s ease;
    }
    
    .mobile-controls__lang:hover {
        background: #F1F5F9;
    }
    
    /* Show mobile header system */
    .mobile-header {
        display: block;
    }
    
    /* Mobile overlay */
    .mobile-header__overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(2, 6, 23, 0.1);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .mobile-header__overlay.active {
        /* opacity: 1; */
        visibility: visible;
    }
    
    /* Main mobile menu */
    .mobile-menu {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        background: #FFFFFF;
        z-index: 1000;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        /* Use dynamic viewport height for better mobile browser support */
        height: 100vh; /* Fallback for older browsers */
        height: 100dvh; /* Modern browsers with dynamic height */
        display: flex;
        flex-direction: column;
    }
    
    .mobile-menu.active {
        transform: translateX(0);
        min-height: 100vh; /* Fallback */
        min-height: 100dvh; /* Dynamic viewport height */
        padding: 1.2rem 1.6rem;
        background: #fff;
        /* Respect safe areas on devices with notches */
        padding-bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px));
    }
    
    /* Mobile menu header */
    .mobile-menu__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: .8rem 1.6rem;
        background: #F9FAFB;
        border-radius: 0.8rem 0.8rem 0 0;
        min-height: 5.6rem;
        position: relative;
        z-index: 10;
    }

    .button_controls {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-width: 12.7rem;
    }
    
    /* Back button in header */
    .mobile-menu__back {
        display: flex;
        align-items: center;
        gap: 0.8rem;
        background: transparent;
        border: none;
        cursor: pointer;
        font-family: Inter;
        font-size: 1.4rem;
        font-weight: 500;
        color: #FF4E32;
        padding: 0.8rem 0;
        border-radius: 0.6rem;
        transition: background-color 0.2s ease;
        line-height: 1.4285714285714286;
    }
    
    .mobile-menu__back:hover {
        background: rgba(255, 78, 50, 0.1);
    }
    
    .mobile-menu__logo img {
        max-height: 3.2rem;
        width: 100%;
        max-width: 14.5rem;
    }
    
    .mobile-menu__close {
        background: #fff;
        border-radius: .4rem;
        border: none;
        cursor: pointer;
        padding: 1.2rem;
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        right: 1.6rem;
    }
    
    /* Mobile menu content */
    .mobile-menu__content {
        padding: 2.4rem 1.6rem 0;
        display: flex;
        flex-direction: column;
        /* Dynamic height calculation for proper mobile support */
        height: calc(100vh - 5.6rem); /* Fallback - height of header */
        height: calc(100dvh - 5.6rem); /* Dynamic viewport height */
        background: #F9FAFB;
        border-radius: 0 0 .8rem .8rem;
        flex: 1; /* Take available space */
        overflow: hidden; /* Prevent content overflow */
    }
    
    /* Mobile menu main content wrapper */
    .mobile-menu__main {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        /* padding-bottom: 2.4rem; */
    }

    /* Mobile navigation */
    .mobile-nav__list {
        list-style: none;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 1.2rem;
        flex: 1;
    }
    
    .mobile-nav__item {
        background: #FFFFFF;
        border-radius: .8rem;
        box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);
        overflow: hidden;
    }
    
    .mobile-nav__link {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1.2rem;
        text-decoration: none;
        color: #020617;
        font-size: 1.6rem;
        font-weight: 500;
        line-height: 1.5;
        background: none;
        border: none;
        width: 100%;
        cursor: pointer;
        transition: background-color 0.2s ease;
    }
    .mobile-nav__link svg{
        width: 2.4rem;
        height: 2.4rem;
    }
    
    .mobile-nav__link:hover,
    .mobile-nav__link:focus {
        background: #fff;
    }
    
    .mobile-nav__text {
        font-family: Inter;
        color: #020617;
        font-size: 1.6rem;
        font-weight: 500;
        line-height: 1.5;
    }
    
    /* Mobile language selector */
    .mobile-lang {
        position: relative;
    }
    
    .mobile-lang__trigger {
        display: flex;
        height: 4rem;
        padding: 0.8rem 1.6rem;
        justify-content: center;
        align-items: center;
        border-radius: 4px;
        background: #fff;
        gap: 0.8rem;
        transition: all 0.2s ease;
        color: #020617;
        font-family: Inter;
        font-size: 1.4rem;
        font-weight: 500;
        line-height: 1.4285714285714286;
    }
    
    .mobile-lang__trigger:hover {
        /* background: #F8FAFC; */
    }
    
    .mobile-lang__trigger svg {
        transition: transform 0.2s ease;
    }
    
    .mobile-lang__trigger:has(+ .mobile-lang__dropdown.active) svg {
        transform: rotate(180deg);
    }
    
    .mobile-lang__dropdown {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #FFFFFF;
        border-radius: .4rem;
        box-shadow: 0px 4px 6px -1px rgba(0, 0, 0, 0.1), 0px 2px 4px -1px rgba(0, 0, 0, 0.06);
        z-index: 10;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-0.8rem);
        transition: all 0.2s ease;
        margin-top: 0.4rem;
        overflow: hidden;
    }
    
    .mobile-lang__dropdown.active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    
    .mobile-lang__item {
        display: flex;
        align-items: center;
        gap: 1.2rem;
        padding: 1.2rem 2.0rem;
        text-decoration: none;
        color: #020617;
        font-size: 1.4rem;
        font-weight: 400;
        transition: background-color 0.2s ease;
        border-bottom: 1px solid #F1F5F9;
    }
    
    .mobile-lang__item:last-child {
        border-bottom: none;
    }
    
    .mobile-lang__item:hover {
        background: #F8FAFC;
    }
    
    .mobile-lang__item--active {
        background: #F1F5F9;
        font-weight: 600;
    }
    
    .mobile-lang__flag {
        display: none;
    }
    
    /* Mobile menu footer */
    .mobile-menu__footer {
        /* Fixed at bottom of container */
        flex-shrink: 0; /* Prevent shrinking */
        padding: 2.4rem 1.6rem;
        margin: 0 -1.6rem;
        /* Add safe area padding for devices with home indicators */
        padding-bottom: calc(2.4rem + env(safe-area-inset-bottom, 0px));
        background: #F9FAFB; /* Match parent background */
        border-radius: 0 0 .8rem .8rem;
    }
    
    .mobile-menu__login {
        width: 100%;
    }
    
    /* Mobile submenu */
    /* Mobile submenu content styles (reused within single container) */
    .mobile-menu__submenu {
        background: #F9FAFB;
        border-radius: 0 0 0.8rem 0.8rem;
        padding: 0.4rem 1.6rem 0;
        margin: -1.6rem -1.6rem -1.2rem -1.6rem;
        /* Dynamic height calculation for proper mobile support */
        height: calc(100vh - 5.6rem - 1.2rem); /* Fallback */
        height: calc(100dvh - 5.6rem - 1.2rem); /* Dynamic viewport height */
        display: flex;
        flex-direction: column;
        overflow: hidden; /* Prevent content overflow */
    }
    
    /* Mobile submenu header inside content */
    .mobile-submenu__header-content {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 0 2rem 0;
    }
    
    .mobile-submenu__title {
        color: #020617;
        font-size: 1.2rem;
        font-weight: 400;
        line-height: 1;
    }
    
    /* Mobile submenu scrollable content */
    .mobile-submenu__content-scroll {
        flex: 1;
        overflow-y: auto;
        padding-bottom: 2.4rem;
    }

    /* Mobile submenu list container */
    .mobile-submenu__list {
        display: flex;
        flex-direction: column;
        /* gap: 3.2rem; */
        flex: 1;
    }
    
    /* Mobile submenu groups */
    .mobile-submenu__group {
        display: flex;
        flex-direction: column;
        gap: 0.4rem;
    }
    
    .mobile-submenu__group:not(:last-child) {
        margin-bottom: 2.2rem;
    }
    
    .mobile-submenu__group-title {
        color: #64748B;
        font-family: Inter;
        font-size: 1.2rem;
        font-weight: 600;
        line-height: 1;
        text-transform: uppercase;
        padding: 0px 1.6rem 1.2rem 0px;
        border-bottom: 1px solid #E2E8F0;
    }

    .mobile-submenu__group-title:first-child {
        padding-top: 1rem;
    }
    
    .mobile-submenu__group-list {
        display: flex;
        flex-direction: column;
        gap: 0.4rem;
    }
    
    /* Mobile submenu items */
    .mobile-submenu__item {
        overflow: hidden;
        height: 4.4rem;
        display: flex
;
        align-items: center;
    }
    
    .mobile-submenu__link {
        display: block;
        padding: 0.4rem 0;
        text-decoration: none;
        color: #020617;
        font-size: 1.4rem;
        font-weight: 500;
        line-height: 1.4285714285714286;
    }
    
    .mobile-submenu__link:hover {
        background: #F8FAFC;
    }

    /* Active mobile submenu item styles */
    .mobile-submenu__item--active .mobile-submenu__link {
        /* color: #FF4E32;
        font-weight: 600;
        background-color: #FFF1F0;
        padding: 0.8rem 1.2rem;
        border-radius: 0.4rem; */
    }

    .mobile-submenu__item--active .mobile-submenu__link:hover {
        /* background: #FFF1F0;
        color: #FF4E32; */
    }
    
    /* Featured guide block in submenu */
    .mobile-submenu__featured {
        background: #EFF6FF;
        border-radius: 0.8rem;
        padding: 2.4rem;
        margin-top: 1.6rem;
        display: flex;
        flex-direction: column;
        gap: 2.6rem;
    }
    
    .mobile-submenu__featured-image {
        width: 100%;
        height: 21.2rem;
        border-radius: 0.8rem;
        overflow: hidden;
        background: #F1F5F9;
    }
    
    .mobile-submenu__featured-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .mobile-submenu__featured-content {
        display: flex;
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .mobile-submenu__featured-title h4 {
        font-family: Inter;
        font-size: 1.6rem;
        font-weight: 700;
        color: #020617;
        margin: 0;
        line-height: 1.5;
    }
    
    .mobile-submenu__featured-link {
        display: flex;
        align-items: center;
        gap: 0.8rem;
        background: transparent;
        border: none;
        cursor: pointer;
        font-family: Inter;
        font-size: 1.4rem;
        font-weight: 500;
        color: #FF4E32;
        padding: 0.8rem 0;
        text-decoration: none;
        line-height: 1.4285714285714286;
    }
    
    /* Login button in submenu footer */
    .mobile-submenu__footer {
        display: flex;
        flex-direction: column;
        gap: 1.2rem;
        /* Fixed at bottom of container */
        flex-shrink: 0; /* Prevent shrinking */
        padding: 3.2rem 1.6rem 2.4rem;
        margin: 0 -1.6rem;
        /* Add safe area padding for devices with home indicators */
        padding-bottom: calc(2.4rem + env(safe-area-inset-bottom, 0px));
        background: #F9FAFB; /* Match parent background */
        border-radius: 0 0 .8rem .8rem;
    }
    
    .mobile-submenu__login {
        background: #FF4E32;
        color: #FFFFFF;
        border: none;
        border-radius: 0.4rem;
        padding: 0.8rem 3.2rem;
        font-family: Inter;
        font-size: 1.4rem;
        font-weight: 500;
        line-height: 1.4285714285714286;
        text-align: center;
        text-decoration: none;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 4.4rem;
    }
    
    /* Global safe area support for mobile devices */
@supports (padding: max(0px)) {
    .mobile-menu__footer,
    .mobile-submenu__footer {
        /* Ensure content is never hidden behind system UI */
        padding-bottom: max(env(safe-area-inset-bottom, 0px), 2.4rem);
    }
}

/* Hide desktop megamenu on mobile */
.megamenu {
    display: none !important;
    }
}

/* Desktop styles remain unchanged - only hide mobile elements */
@media (min-width: 1200px) {
    .mobile-header,
    .mobile-trigger,
    .mobile-controls__lang {
        display: none !important;
    }
} 