/* Header and Mega Menu Styles */

/* Basic Navbar Styles (assuming some might be here or in styles.css) */
/* Placeholder for any general navbar styles that might be moved here from styles.css */

/* Mobile menu toggle button - initially hidden on desktop */
.mobile-menu-toggle {
    display: none;
    cursor: pointer;
    background: none;
    border: none;
    padding: 10px;
    z-index: 110;
    margin-left: auto;
    margin-right: 15px;
}

.mobile-menu-toggle span {
    display: block;
    width: 30px;
    height: 3px;
    margin: 6px 0;
    background-color: #1181D0;
    transition: all 0.3s ease;
}

/* Header CTA Button */
.cta-button {
    display: flex;
    align-items: center;
}

/* Mega Menu Specific Styles */
.nav-item-products {
    position: relative; /* For positioning the mega menu */
}

.has-megamenu a[class*="-link"] .mega-menu-arrow {
    font-size: 0.7em;
    margin-left: 5px;
    transition: transform 0.3s ease;
}

.has-megamenu.mega-menu-open a[class*="-link"] .mega-menu-arrow {
    transform: rotate(180deg);
}

.mega-menu-container {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-35%); /* Move menu to the right a bit */
    width: 90vw; /* Adjust as needed */
    max-width: 1200px; /* Prevent extreme widths on large screens */
    transition: all 0.2s ease-in-out;
    z-index: 100;
    overflow: hidden;
    background-color: #FFFFFF; /* Figma background */
    border-radius: 16px; /* Figma border-radius */
    box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.16); /* Figma box-shadow */
    padding: 20px; /* Figma padding */
    z-index: 1000;
    margin-top: 10px; /* Small gap from the navbar */
    /* border: 1px solid #e0e0e0; /* Figma spec doesn't show a main border, relying on shadow */
}

.nav-item-services .mega-menu-container {
    margin-top: 0px; /* Further reduced to move up */
    transform: translateX(-40%); /* For desktop - adjusted for better positioning */
}

/* Mobile-specific positioning for submenus */
@media (max-width: 768px) {
    .nav-item-services .mega-menu-container {
        transform: translateX(-1%); /* For mobile view */
    }
    
    .nav-item-company .mega-menu-container {
        transform: translateX(-1%); /* For mobile view */
    }
    
    /* Fix company menu gaps in mobile */
    .mega-menu-company-content {
        gap: 0 !important;
    }
    
    .mega-menu-company-content .mega-menu-column {
        margin: 0;
        padding: 0;
    }
    
    /* Target specifically menu items in company menu with different structure */
    .mega-menu-company-content a .mega-menu-item {
        margin: 0;
        padding: 0;
        border: none;
        display: block;
        visibility: visible;
        opacity: 1;
    }
    
    /* Simplified anchor styling */
    .mega-menu-company-content a {
        display: block;
        padding: 12px 15px;
        border-bottom: 1px solid #f0f0f0;
    }
    
    /* Text elements within the company menu */
    .mega-menu-company-content h4 {
        display: block;
        color: #333;
        margin: 0 0 5px 0;
        font-size: 16px;
    }
    
    .mega-menu-company-content p {
        display: block;
        color: #666;
        margin: 0;
        font-size: 14px;
    }
}

.has-megamenu.mega-menu-open .mega-menu-container {
    visibility: visible;
    opacity: 1;
} /* Show when parent has class */

.mega-menu-content {
    display: flex;
    gap: 20px; /* Figma gap */
}

.mega-menu-promo {
    flex-basis: 300px; /* Figma width */
    flex-shrink: 0;
    background-color: #1181D0; /* Figma background */
    color: #FFFFFF;
    padding: 40px 30px; /* Adjusted padding for visual balance, Figma's 100px 0 seems too much */
    border-radius: 8px; /* Keeping a slightly larger radius than Figma's 2px for consistency */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mega-menu-promo h3 {
    font-family: 'Geist', sans-serif; /* Figma font */
    font-size: 20px; /* Figma font-size */
    font-weight: 600; /* Figma font-weight */
    line-height: 24px; /* Figma line-height */
    color: #FFFFFF;
    margin-top: 0;
    margin-bottom: 17px; /* Figma gap from spec */
}

.mega-menu-promo p {
    font-family: 'Geist', sans-serif; /* Figma font */
    font-size: 16px; /* Figma font-size */
    font-weight: 400; /* Figma font-weight */
    line-height: 20px; /* Figma line-height */
    color: #C0D4FA; /* Figma color */
    margin-bottom: 20px; /* Figma gap */
}

.mega-menu-promo .btn-primary {
    background-color: #FFFFFF; /* Figma background */
    color: #141414; /* Figma text color */
    padding: 14px 24px; /* Figma padding */
    border-radius: 12px; /* Figma border-radius */
    text-decoration: none;
    font-family: 'Be Vietnam Pro', sans-serif; /* Figma font */
    font-weight: 400; /* Figma font-weight */
    font-size: 16px; /* Figma font-size */
    line-height: 20px; /* Figma line-height */
    text-align: center;
    border: 2px solid rgba(17, 129, 208, 0.8); /* Figma border */
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.mega-menu-links {
    flex: 1; /* Take remaining space */
    display: flex;
    gap: 40px; /* Figma gap between columns (Frame 1984079772) */
    /* padding-left is handled by overall container padding and promo block width */
}

.mega-menu-column {
    flex: 1;
    min-width: 264px; /* Based on Figma item width, ensures columns don't get too narrow */
    display: flex;
    flex-direction: column;
    gap: 20px; /* Gap between items in a column, can adjust if needed */
}

.mega-menu-item {
    padding: 8px; /* Figma padding (Frame 1984079763) */
    border-radius: 8px; /* Figma item border-radius */
    transition: background-color 0.2s ease;
    cursor: pointer;
    height: 90px; /* Fixed height to ensure consistent alignment */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mega-menu-item a {
    text-decoration: none;
    display: block;
}

.mega-menu-item:hover {
    background-color: #f4f8fc; /* Light blue hover */
}

.mega-menu-item.item-highlight {
    background-color: #EBF1FD; /* Figma background */
    /* border: 1px solid #D1E0FF; */ /* Figma spec for highlighted item doesn't show a border, relies on background */
    border-radius: 8px; /* Figma border-radius */
}

.mega-menu-item h4 {
    font-family: 'Geist', sans-serif; /* Figma font */
    font-size: 20px; /* Figma font-size */
    font-weight: 600; /* Figma font-weight */
    color: #111B29; /* Figma color */
    margin-top: 0;
    margin-bottom: 8px; /* Figma gap (Frame 1984079570) */
    line-height: 24px; /* Figma line-height */
}

.mega-menu-item.item-highlight h4 {
    color: #3573EE; /* Figma color */
}

.mega-menu-item p {
    font-family: 'Geist', sans-serif; /* Figma font */
    font-size: 14px; /* Figma font-size */
    font-weight: 400; /* Figma font-weight */
    color: #575757; /* Figma color */
    line-height: 20px; /* Figma line-height */
    margin-bottom: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limit to 2 lines */
    line-clamp: 2; /* Standard property for compatibility */
    -webkit-box-orient: vertical;
}

.mega-menu-item:hover h4 {
    color: #3573EE; /* Same h4 color as item-highlight */
}


/* Company Mega Menu Specific Styles */
.nav-item-company .mega-menu-container {
    width: auto; /* Auto width based on content */
    min-width: 600px; /* Adjust as needed, estimate from image */
    transform: translateX(-50%); /* Center it */
    margin-top: 0px; /* Align with nav link */
}

.nav-item-company .mega-menu-content.mega-menu-company-content {
    gap: 10px; /* Smaller gap between items */
}

.nav-item-company .mega-menu-promo {
    display: none;
}

.nav-item-company .mega-menu-links {
    gap: 10px; /* Adjust gap between columns/items */
}

.nav-item-company .mega-menu-column {
    min-width: auto; /* Allow columns to be narrower */
    flex-basis: auto; /* Adjust basis */
}

/* End Header and Mega Menu Styles */

/* Mobile Responsive Styles */

/* 1280x768 Resolution Optimizations */
@media (max-width: 1280px) and (min-width: 1025px) {
    .mega-menu-container {
        width: 85vw;
        max-width: 1000px;
        transform: translateX(-40%);
        padding: 18px;
        margin-top: 8px;
    }
    
    .mega-menu-content {
        gap: 18px;
    }
    
    .mega-menu-promo {
        flex-basis: 260px;
        padding: 32px 24px;
    }
    
    .mega-menu-promo h3 {
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .mega-menu-promo p {
        font-size: 15px;
        line-height: 18px;
        margin-bottom: 18px;
    }
    
    .mega-menu-promo .btn-primary {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .mega-menu-column {
        min-width: 240px;
        gap: 16px;
    }
    
    .mega-menu-item {
        padding: 6px;
    }
    
    .mega-menu-item h4 {
        font-size: 16px;
        margin-bottom: 6px;
        line-height: 20px;
    }
    
    .mega-menu-item p {
        font-size: 13px;
        line-height: 18px;
    }
    
    /* Specific positioning adjustments for 1280x768 */
    .nav-item-products .mega-menu-container {
        transform: translateX(-38%);
    }
    
    .nav-item-services .mega-menu-container {
        transform: translateX(-75%);
        width: 58vw;
        max-width: 620px;
        padding: 6px;
    }
    
    .nav-item-services .mega-menu-content {
        gap: 10px;
    }
    
    .nav-item-services .mega-menu-promo {
        flex-basis: 170px;
        padding: 16px 10px;
    }
    
    .nav-item-services .mega-menu-promo h3 {
        font-size: 15px;
        margin-bottom: 6px;
    }
    
    .nav-item-services .mega-menu-promo p {
        font-size: 12px;
        line-height: 14px;
        margin-bottom: 10px;
    }
    
    .nav-item-services .mega-menu-column {
        min-width: 160px;
        gap: 6px;
    }
    
    .nav-item-services .mega-menu-item {
        padding: 2px;
    }
    
    .nav-item-services .mega-menu-item h4 {
        font-size: 14px;
        margin-bottom: 3px;
        line-height: 16px;
    }
    
    .nav-item-services .mega-menu-item p {
        font-size: 11px;
        line-height: 14px;
    }
    
    .nav-item-company .mega-menu-container {
        transform: translateX(-45%);
        width: 75vw;
        max-width: 800px;
    }
}

@media (max-width: 1024px) {
    .mega-menu-container {
        width: 90vw;
        max-width: 95vw;
        transform: translateX(-45%);
    }

    .mega-menu-content {
        flex-direction: column;
    }

    .mega-menu-links {
        flex-direction: column;
        gap: 10px;
    }

    .mega-menu-column {
        flex: 1;
        width: 100%;
    }
}

@media (max-width: 768px) {
    /* Show mobile menu toggle and hide regular nav */
    .mobile-menu-toggle {
        display: block;
    }

    .navbar {
        padding: 12px 20px;
        height: auto;
        min-height: 70px;
        align-items: center;
        justify-content: space-between;
    }

    .logo {
        width: 120px;
        height: auto;
    }
    
    /* Hide the CTA button on mobile */
    .cta-button {
        display: none;
    }

    /* Hide the desktop navigation by default */
    .navbar nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%; /* Full width for maximum space */
        height: 100vh;
        background: white;
        z-index: 100;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
        transition: right 0.3s ease;
        padding: 80px 20px 20px;
        overflow-y: auto;
    }

    /* Show navigation when mobile menu is active */
    .navbar.mobile-active nav {
        right: 0;
    }

    /* Change the hamburger to X when menu is active */
    .navbar.mobile-active .mobile-menu-toggle span:first-child {
        transform: rotate(45deg) translate(6px, 6px);
    }

    .navbar.mobile-active .mobile-menu-toggle span:nth-child(2) {
        opacity: 0;
    }

    .navbar.mobile-active .mobile-menu-toggle span:last-child {
        transform: rotate(-45deg) translate(6px, -6px);
    }

    /* Stack nav items vertically */
    nav ul {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    nav ul li {
        width: 100%;
        padding: 15px 0;
        border-bottom: 1px solid #f0f0f0;
    }
    
    /* Hide all mega menus initially on mobile */
    .mega-menu-container {
        position: static;
        width: 100%;
        left: auto;
        right: auto;
        transform: none;
        margin-top: 10px;
        box-shadow: none;
        border: none;
        visibility: hidden;
        opacity: 0;
        display: none;
        max-height: 0;
        transition: none;
    }
    
    /* Show mega menu when parent is clicked */
    .has-megamenu.mega-menu-open .mega-menu-container {
        visibility: visible;
        opacity: 1;
        display: block;
        max-height: initial;
        overflow: visible;
    }
    
    /* Ensure ALL mega menus are visible when open */
    .has-megamenu.mega-menu-open .mega-menu-container {
        position: static !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        max-height: none !important;
        width: 100% !important;
        overflow: visible !important;
        margin: 0 !important;
        padding: 0 !important;
        transform: none !important;
    }
    
    /* Force visibility of company menu */
    .nav-item-company.mega-menu-open .mega-menu-container *,
    .nav-item-company.mega-menu-open .mega-menu-content *,
    .nav-item-company.mega-menu-open .mega-menu-links *,
    .nav-item-company.mega-menu-open .mega-menu-column *,
    .nav-item-company.mega-menu-open a,
    .nav-item-company.mega-menu-open h4,
    .nav-item-company.mega-menu-open p {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .mega-menu-container::before,
    .mega-menu-container::after {
        display: none;
    }
    
    .has-megamenu {
        position: relative;
    }
    
    .has-megamenu a[class*="-link"] {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    /* Mega menu content layout for mobile */
    .mega-menu-content {
        display: block;
        padding: 0;
        width: 100%;
        max-width: 100%;
        box-shadow: none;
        border-radius: 0;
        flex-direction: column;
        overflow: hidden;
    }
    
    /* Company menu specific layout */
    .mega-menu-company-content {
        display: block;
        margin: 0;
        padding: 0;
    }
    
    .mega-menu-company-content .mega-menu-links {
        display: block;
        width: 100%;
        margin: 0;
        padding: 0;
    }
    
    .mega-menu-company-content .mega-menu-column {
        width: 100%;
        margin: 0;
        padding: 0;
        display: block;
    }
    
    /* Company menu has anchors wrapping the mega-menu-item */
    .mega-menu-company-content .mega-menu-column > a {
        display: block;
        text-decoration: none !important;
        color: inherit !important;
        padding: 10px 15px;
        border-bottom: 1px solid #f0f0f0;
    }
    
    /* Blue promo area fixes */
    .mega-menu-promo {
        width: 100%;
        padding: 20px 15px;
        border-radius: 0;
        text-align: center;
        background-color: #1181D0;
        color: white;
        display: block;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .mega-menu-promo h3 {
        font-size: 18px;
        margin-top: 0;
        margin-bottom: 10px;
        color: white;
        white-space: normal;
        word-wrap: break-word;
        max-width: 100%;
        overflow: visible;
    }
    
    .mega-menu-promo p {
        font-size: 14px;
        margin-bottom: 15px;
        color: white;
        white-space: normal;
        display: block;
        overflow: visible;
        -webkit-line-clamp: unset;
        line-clamp: unset;
        -webkit-box-orient: unset;
        word-wrap: break-word;
        max-width: 100%;
    }
    
    .mega-menu-promo .btn-primary {
        display: inline-block;
        margin: 0 auto;
        background-color: white;
        color: #1181D0;
        border: none;
    }
    
    /* Menu items layout */
    .mega-menu-links {
        display: block;
        padding: 0;
        width: 100%;
    }
    
    .mega-menu-column {
        width: 100%;
        padding: 5px 15px;
        border: none;
        margin-bottom: 0;
    }
    
    .mega-menu-item {
        padding: 12px 0;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .mega-menu-item:last-child {
        border-bottom: none;
    }
    
    .mega-menu-item h4 {
        font-size: 16px;
        margin-bottom: 5px;
    }
    
    .mega-menu-item p {
        font-size: 13px;
        line-height: 1.4;
        margin: 0;
    }
}
