/*--------------------------------------------------------------
# Header Layout
--------------------------------------------------------------*/
.custom-header {
    background-color: transparent;
    padding: 0;
    position: fixed;
    width: 100%;
    z-index: 9999; /* Make sure it's high enough */
    transition: background-color 0.3s ease-in-out;
    border-bottom: 1px solid transparent; /* Use a transparent border to prevent layout shifts */
}

/* This new class will be added by JavaScript */
.custom-header.header-solid {
    background-color: #fff;
    border-bottom: 1px solid #DEDEF966;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
}

.header-container .left-wrap{
    display: flex;
    align-items: center;
}

.header-container .logo{
    margin-right: 40px;
}

.header-container .logo svg{
    width: 178px;
}

.header-container .logo > a{
    display: flex;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-actions .login-link {
    text-decoration: none;
    color: #302B38;
    font-weight: 500;
    font-size: 16px; 
}

/*--------------------------------------------------------------
# Main Navigation
--------------------------------------------------------------*/
.main-navigation ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    gap: 30px;
}

.main-navigation > ul > li > a {
    text-decoration: none;
    color: #302B38;
    font-weight: 500;
    display: flex;
    font-size: 16px;
    align-items: center;
    gap: 8px;
    border-bottom: 3px solid transparent;
    transition: color 0.3s, border-color 0.3s;
    padding: 27px 0px;
}

.main-navigation > ul > li > a:hover {
    color: #6F37DB;
    border-bottom-color: #6F37DB;
}

.main-navigation ul li.current-menu-item > a{
    color: #6F37DB;
}

.main-navigation ul li a .dropdown-arrow {
    transition: transform 0.3s ease;
    transform: rotate(180deg);
}

.main-navigation ul li:hover > a .dropdown-arrow {
    transform: unset;
}


/*--------------------------------------------------------------
# Mega Menu
--------------------------------------------------------------*/
.mega-menu {
    display: none; /* Hidden by default */
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #fff;
    box-shadow: 0px 2px 5px 0px #20275E14;
    padding-top: 40px;
    z-index: 1000;
    border-top: 1px solid #DEDEF966;
}

/* Show on hover of the parent li */
.main-navigation ul li.has-megamenu:hover > .mega-menu {
    display: block;
}

.mega-menu-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.mega-menu .mega-menu-container > .sub-menu {
    display: block; /* Override default submenu styles */
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
}

.mega-menu .mega-menu-container > .sub-menu > li.menu-item > .sub-menu{
    flex-direction: column;
}



.mega-menu-column-header {
    font-size: 14px;
    color: #858496;
    font-weight: 500;
    text-transform: uppercase;
    margin-bottom: 20px;
}

.mega-menu-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    transition: background-color 0.3s;
}

.mega-menu-item-icon {
    width: 20px !important;
    height: 20px !important;
    margin-top: 2px;
}

.mega-menu-item-text {
    display: flex;
    flex-direction: column;
}

.mega-menu-item-title {
    font-size: 16px;
    color: #302B38;
    font-weight: 500;
}

.mega-menu .mega-menu-container > .sub-menu > li.menu-item > .sub-menu li:hover .mega-menu-item-title {
    color: #6F37DB;
}
.mega-menu-item-description {
    font-size: 14px;
    color: #302B38;
    font-weight: 300;
    line-height: 1.25em;
}

/* Footer Strip */
.mega-menu-footer-strip {
    background-color: #ebf4ff; /* A slightly darker shade than your request for visibility */
    margin-top: 40px;
    padding: 20px 0;
    text-align: right;
}

.mega-menu-footer-strip .wrap{
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.mega-menu-footer-strip a {
    text-decoration: none;
    color: #6F37DB;
    font-weight: 500;
    margin-right: 25px;
}

.mega-menu-footer-strip svg {
    margin-left: 8px;
}

/*--------------------------------------------------------------
# Mega Menu - Banner Style Specifics
--------------------------------------------------------------*/

.mega-menu--banner .mega-menu-links {
    width: 65%;
}

.mega-menu--banner .mega-menu-content-wrap{
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
}

.mega-menu-banner {
    flex-shrink: 0;
    width: 35%;
    background-color: #20133b;
    background-size: cover;
    background-position: center;
    color: #fff;
    border-radius: 20px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    justify-content: start;
    min-height: 315px;
}

.mega-menu-banner h3 {
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    margin: 0 0 10px 0;
}

.mega-menu-banner p {
    font-size: 14px;
    line-height: 1.6;
    color: #e2d8ff;
    margin: 0 0 20px 0;
}

.mega-menu-banner a {
    color: #fff;
    font-weight: bold;
    font-size: 14px;
    text-decoration: none;
    letter-spacing: 0.5px;
}

/*--------------------------------------------------------------
# Mobile Navigation (FINAL POLISHED VERSION)
--------------------------------------------------------------*/

/* Header Height & Responsive Layout */
@media (max-width: 991px) {
    .header-container { padding-top: 20px; padding-bottom: 20px; }
    .main-navigation, .header-actions { display: none; }
    .custom-header .mobile-nav-toggle { display: block; }
}
.mobile-nav-toggle { display: none; }
.custom-header .mobile-nav-toggle { background: none !important; border: none !important; padding: 10px !important; border-radius: 0 !important; box-shadow: none !important; height: auto; width: auto; }
.hamburger-box { width: 24px; height: 18px; display: inline-block; position: relative; }
.hamburger-inner { display: block; top: 50%; margin-top: -1px; }
.hamburger-inner, .hamburger-inner::before, .hamburger-inner::after { width: 24px; height: 2px; background-color: #302B38; position: absolute; transition: transform .2s ease-in-out; }
.hamburger-inner::before, .hamburger-inner::after { content: ''; display: block; }
.hamburger-inner::before { top: -8px; }
.hamburger-inner::after { bottom: -8px; }

/* 1. NEW "Spin" Hamburger Animation */
body.mobile-nav-is-open .mobile-nav-toggle .hamburger-inner {
  transform: rotate(225deg);
  transition-delay: 0.12s;
  transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
}
body.mobile-nav-is-open .mobile-nav-toggle .hamburger-inner::before {
  top: 0;
  opacity: 0;
  transition: top 0.1s ease-out, opacity 0.1s 0.12s ease-out;
}
body.mobile-nav-is-open .mobile-nav-toggle .hamburger-inner::after {
  bottom: 0;
  transform: rotate(-90deg);
  transition: bottom 0.1s ease-out, transform 0.22s 0.12s cubic-bezier(0.215, 0.61, 0.355, 1);
}

/* Off-Canvas Menu Structure (Slide-Down Version) */
.mobile-nav-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.4); z-index: 998; opacity: 0; visibility: hidden; transition: opacity 0.4s ease, visibility 0s linear 0.4s; }
.mobile-nav { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 999; overflow: hidden; transform: translateY(-100%); opacity: 0; visibility: hidden; transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.4s ease, visibility 0s linear 0.4s; }
body.mobile-nav-is-open { overflow: hidden; }
body.mobile-nav-is-open .mobile-nav-overlay { opacity: 1; visibility: visible; transition-delay: 0s; }
body.mobile-nav-is-open .mobile-nav { transform: translateY(0); opacity: 1; visibility: visible; transition-delay: 0s; }

/* Panel Structure */
.mobile-nav-panel { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #fff; display: flex; flex-direction: column; transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1); }
.mobile-nav-header { flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; border-bottom: 1px solid #E9E9F2; z-index: 1002; position: relative; min-height: 85px; }
.mobile-nav-header .logo img { height: 28px; }
.mobile-nav-content { flex-grow: 1; overflow-y: auto; padding: 20px; }
.mobile-nav-footer { flex-shrink: 0; padding: 20px; background-color: #F8F8FD; display: flex; gap: 15px; }
.mobile-nav-footer .button { width: 50%; text-align: center; padding: 12px; }

/* 2. Back Button Style Reset */
.mobile-nav-back { background: none !important; border: none !important; padding: 10px !important; border-radius: 0 !important; box-shadow: none !important; cursor: pointer; display: flex; align-items: center; font-size: 16px; font-weight: 500; }
.mobile-nav-back svg { margin-right: 15px; }

/* Panel Level 2 (Sub-menu) */
.mobile-nav-panel--level-2 { left: 100%; }
.mobile-nav-panel--level-2.is-active { transform: translateX(-100%); }

.mobile-nav-panel--level-2 .mobile-nav-header{
    margin-top: 84px;
    border-bottom: 1px solid #DEDEF966;
    box-shadow: 0px 2px 9px 0px #DEDEF966;
}

.mobile-nav-panel--level-2 .menu-item-has-children > a{
    font-weight: 500;
    font-size: 14px;
    text-transform: uppercase;
    color: #858496;
    padding-bottom: 20px;
    display: inline-block;
}

.mobile-nav-panel--level-2 .mobile-nav-content > .sub-menu > li{
    padding-bottom: 20px;
    border-bottom: 1px solid #DEDEF9;
    margin-bottom: 20px;
}

.mobile-nav-panel--level-2 .mobile-nav-content > .sub-menu > li > .sub-menu > li{
    padding-bottom: 15px;
    font-size: 16px;
}

.mobile-nav-panel--level-2 .mobile-nav-content > .sub-menu > li > .sub-menu > li:last-child{
    padding-bottom: 0;
}

/* Styling the Menu Links for Mobile (Level 1) */
.mobile-menu-level-1, .mobile-menu-static-links { list-style: none; padding: 0; margin: 0; }
.mobile-menu-static-links{
    border-top: 1px solid #DEDEF9;
    border-bottom: 1px solid #DEDEF9;
}

.mobile-menu-level-1 > li > a, .mobile-menu-static-links > li > a { display: flex; justify-content: space-between; align-items: center; padding: 18px 0; text-decoration: none; color: #302B38; font-weight: 500; font-size: 18px; }
.mobile-menu-level-1 .dropdown-arrow { display: none; }
.mobile-menu-level-1 .mega-menu, .mobile-menu-level-1 .sub-menu { display: none !important; }
.mobile-menu-level-1 > .menu-item-has-children > a::after {
    content: ''; display: block; width: 8px; height: 12px; background-image: url("data:image/svg+xml,%3Csvg width='8' height='12' viewBox='0 0 8 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1.5 1L6.5 6L1.5 11' stroke='%23858496' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: center;
}

/* 3. FINAL FIX: Styling for content INJECTED into the Level 2 panel */
.mobile-nav-sub-content .mega-menu, .mobile-nav-sub-content .sub-menu { display: block; position: static; box-shadow: none; padding: 0; list-style: none; }
.mobile-nav-sub-content .mega-menu .sub-menu { grid-template-columns: none; gap: 0; } /* Reset grid */
.mobile-nav-sub-content .mega-menu-column-header { margin-bottom: 15px; margin-top: 25px; font-size: 12px; letter-spacing: 0.5px; color: #858496; text-transform: uppercase; }
.mobile-nav-sub-content .mega-menu-column-header:first-of-type { margin-top: 0; }
.mobile-nav-sub-content .mega-menu-item {
    display: flex; align-items: flex-start; gap: 15px; padding: 10px 0; text-decoration: none;
}
.mobile-nav-sub-content .mega-menu-item-icon { width: 20px !important; height: 20px !important; margin-top: 2px; }
.mobile-nav-sub-content .mega-menu-item-text { display: flex; flex-direction: column; }
.mobile-nav-sub-content .mega-menu-item-title { font-size: 16px; color: #302B38; font-weight: 500; }
.mobile-nav-sub-content .mega-menu-item-description { display: block; font-size: 14px; color: #858496; line-height: 1.5; }
.mobile-nav-sub-content .mega-menu-banner { margin: 30px -20px -20px -20px; border-radius: 0; padding: 30px 20px; }
.mobile-nav-sub-content .mega-menu-banner a { color: #fff; font-weight: bold; }

body.mobile-nav-is-open .custom-header {
    background-color: #fff;
    border-bottom-color: #E9E9F2; /* Also show the border */
}

/*--------------------------------------------------------------
# Header - Dark Mode (Homepage)
--------------------------------------------------------------*/

/* Change the color of the main navigation links to white */
.custom-header.dark .main-navigation > ul > li > a {
    color: #fff;
}

/* Change the color of the dropdown arrow to white */
.custom-header.dark .main-navigation > ul > li > a .dropdown-arrow path {
    stroke: #fff;
}

/* Change the color of the Login link and Search icon to white */
.custom-header.dark .header-actions .login-link,
.custom-header.dark .header-actions .search-icon svg path {
    color: #fff;
    stroke: #fff;
}
/* --- SVG Logo Color Changes --- */

.custom-header.dark .logo .logo-text-main path {
    fill: #fff;
}

/* Change the secondary "by BIScience" text to the requested color */
.custom-header.dark .logo .logo-text-secondary path {
    fill: #B5B4CC;
}

/* Change the hamburger bars to white for mobile */
@media (max-width: 991px) {
    .custom-header.dark .hamburger-inner,
    .custom-header.dark .hamburger-inner::before,
    .custom-header.dark .hamburger-inner::after {
        background-color: #fff;
    }
}

/*--------------------------------------------------------------
# Header - Dark Mode Scroll Override
--------------------------------------------------------------*/

/* When the dark header becomes solid/scrolled, revert all colors back to the default. */

/* Revert main navigation links and dropdown arrow */
.custom-header.dark.header-solid .main-navigation > ul > li > a {
    color: #302B38;
}

.custom-header.dark.header-solid .main-navigation > ul > li > a .dropdown-arrow path {
    stroke: #302B38;
}

/* Revert Login link and Search icon */
.custom-header.dark.header-solid .header-actions .login-link {
    color: #302B38;
}
.custom-header.dark.header-solid .header-actions .search-icon svg path {
    stroke: #302B38;
}

/* Revert the "Contact Sale" button */
.custom-header.dark.header-solid .header-actions .button.light {
    color: #6F37DB; /* Your original purple color */
    border-color: #6F37DB;
}
.custom-header.dark.header-solid .header-actions .button.light:hover {
    background-color: #F8F8FD; /* Your original light purple hover */
}


/* --- Revert SVG Logo Colors --- */
.custom-header.dark.header-solid .logo .logo-text-main path {
    fill: #302B38;
}

.custom-header.dark.header-solid .logo .logo-text-secondary path {
    fill: #858496;
}

/* Revert the hamburger icon on mobile */
@media (max-width: 991px) {
    .custom-header.dark.header-solid .hamburger-inner,
    .custom-header.dark.header-solid .hamburger-inner::before,
    .custom-header.dark.header-solid .hamburger-inner::after {
        background-color: #302B38;
    }

    .mobile-nav-is-open .custom-header.dark .logo .logo-text-main path{
        fill: rgb(48, 43, 56);
    }

    .mobile-nav-is-open .custom-header.dark .hamburger-inner,
    .mobile-nav-is-open .custom-header.dark .hamburger-inner::before,
    .mobile-nav-is-open .custom-header.dark .hamburger-inner::after{
        background-color: #302B38;
    }
}