/* ============================================= */
/* MEGA MENU COMMON STYLES - FULLY GENERIC */
/* ============================================= */

/* Import Poppins Font */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');

/* ============================================= */
/* BASE STYLES - ALL MENUS */
/* ============================================= */
.l-subheader-cell{
    flex-shrink: unset;
}
.l-subheader-cell.at_right>*{
    margin : 0;
}
/* Container */
.mega-menu-container {
    position: relative;
    display: inline-block;
}

/* Button */
.mega-menu-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 27px 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 22px;
    color: #1C1D1F;
    transition: all 0.3s ease;
}

.mega-menu-button:hover,
.mega-menu-button.menu-open {
    color: #0066cc;
}

/* Disable mega menu buttons when action dropdown is active */
body.action-dropdown-active .mega-menu-button {
    pointer-events: none;
    cursor: default;
}

body.action-dropdown-active .mega-menu-button:hover {
    color: #333;
}

.mega-menu-button-icon {
    width: 20px;
    height: 20px;
}

.mega-menu-arrow {
    transition: transform 0.3s ease;
    margin-left: 4px;
}

.mega-menu-button:hover .mega-menu-arrow,
.mega-menu-button.menu-open .mega-menu-arrow,
.mega-menu-wrapper.active ~ .mega-menu-button .mega-menu-arrow {
    transform: rotate(180deg);
}

/* Global Overlay - Appears below header when any menu is open */
.mega-menu-global-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, top 0s;
    z-index: 1045 !important; /* Below header (1050), above page content */
    pointer-events: none; /* Don't block clicks when hidden */
}

/* Active1: For mega menu items (Loans, Credit Cards, etc.) 
   Covers from below l-subheader.at_middle */
.mega-menu-global-overlay.active1 {
    opacity: 1;
    visibility: visible;
    top: var(--overlay-top-menu, 142px); /* Fallback to 142px */
    pointer-events: auto; /* Allow clicks when visible */
}

/* Active2: For Get the App and Talk to Expert 
   Covers from below l-subheader.at_top */
.mega-menu-global-overlay.active2 {
    opacity: 1;
    visibility: visible;
    top: var(--overlay-top-actions, 74px); /* Fallback to 74px */
    pointer-events: auto; /* Allow clicks when visible */
}

/* Ensure header stays on top with all its child elements */
.l-header {
    position: relative;
    z-index: 1050 !important; 
}

/* Ensure sticky header maintains z-index */
.l-header.sticky {
    z-index: 1050 !important;
}

.l-subheader.at_top{
    background-color: #F6F6F6 !important;
}

/* Subheaders should NOT create new stacking context - remove z-index */
.l-subheader.at_top,
.l-subheader.at_middle,
.l-subheader.at_bottom {
    position: relative;
    background-color: inherit;
    border-bottom: 1px solid #E4E4E3;
    box-shadow: none !important;
}

/* Mega menu button needs to be clickable */
.mega-menu-button {
    position: relative;
    z-index: 1051 !important;
}

/* Mega menu dropdowns should be above overlay */
.mega-menu-wrapper {
    z-index: 1060 !important; /* Above overlay (1045) */
}

/* Talk to Expert and Get the App dropdowns - must be above global overlay */
.talk-to-expert-wrapper,
.get-the-app-wrapper {
    z-index: 1060 !important; /* Above overlay (1045) and header (1050) */
}

/* Language selector dropdown - must be above global overlay */
.language-selector-wrapper .language-dropdown {
    z-index: 1060 !important; /* Above overlay (1045) and header (1050) */
}

/* Language selector local overlay - use global overlay instead, hide local */
.language-selector-wrapper .language-overlay {
    display: none !important; /* Use global overlay instead */
}

/* Mobile menu should be above overlay */
/* .mobile-menu-container {
    z-index: 1045 !important;
}

.mobile-menu-backdrop {
    z-index: 1044 !important;
} */

/* ============================================= */
/* DROPDOWN WRAPPER - ALL MENUS */
/* ============================================= */

#blogPblogin a{
    border-radius: 4px;
    border: 1px solid #0066FF;
    padding: 8px 10px;
    background: #ffffff !important;
    color: #0066FF !important;
}
.mega-menu-wrapper {
    position: absolute;
    top: calc(100%);
    left: 0;
    background: #ffffff;
    border-radius: 0 0 8px 8px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
    width: max-content;
    max-width: calc(100vw - 40px);
}

.mega-menu-wrapper.active {
    opacity: 1;
    visibility: visible;
}


.mega-menu-arrow-up {
    display: none;
}


/* ============================================= */
/* MULTI-LEVEL MENU LAYOUT */
/* Menus with left sidebar (Loans, etc.) */
/* ============================================= */

.mega-menu-content {
    display: flex;
    min-height: 350px;
    max-height: 650px;
    overflow: hidden;
}

/* Prevent accidental close when moving cursor */
.mega-menu-wrapper::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
    background: transparent;
}

/* Left Sidebar Navigation */
.mega-menu-left-nav {
    background: #f8f9fa;
    border-radius: 8px 0 0 8px;
    min-width: 180px;
    max-width: 180px;
    flex-shrink: 0;
}

.mega-menu-primary-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mega-menu-primary-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #1C1D1F;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    border-left: 3px solid transparent;
    margin: 0;
}

.mega-menu-primary-item:hover,
.mega-menu-primary-item.active {
    border-left: 3px solid rgba(0, 102, 255, 1);
    background: #ffffff;
    color: rgba(0, 102, 255, 1);
    font-weight: 500;
}

.menu-item-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Right Content Panel */
.mega-menu-right-content {
    flex: 1;
    padding: 16px 20px;
    position: relative;
    background: #ffffff;
    border-radius: 0 8px 8px 0;
    overflow-y: auto;
}

/* Submenu Container */
.mega-menu-submenu {
    display: none;
}

.mega-menu-submenu.active {
    display: block;
}

/* Multi-level Menu Columns - Max 3 columns */
.mega-menu-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 24px;
    max-width: 100%;
}

/* Force maximum 3 columns */
@supports (grid-template-columns: repeat(3, 1fr)) {
    .mega-menu-columns {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    
    /* When there are 4+ columns, limit to 3 columns max */
    .mega-menu-columns:has(> .mega-menu-column:nth-child(4)) {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================= */
/* SIMPLE MENU LAYOUT */
/* Menus without sidebar (Credit Cards, Investment, etc.) */
/* ============================================= */

.mega-menu-content-simple {
    padding: 16px 20px;
}

/* Adjust padding for single column */
.mega-menu-cols-1 .mega-menu-content-simple {
    padding: 16px 20px;
}

.mega-menu-columns-simple {
    display: grid;
    gap: 30px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* ============================================= */
/* COLUMN STYLES - ALL MENUS */
/* ============================================= */

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

/* Single column - set max width */
.mega-menu-cols-1 .mega-menu-column {
    min-width: 240px;
    max-width: 300px;
}

/* Column Header */
.column-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 6px;
}

.column-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.column-title {
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 500;
    line-height: 20px;
    color:#1C1D1F;
    margin: 0;
    padding: 0;
}

/* Column Links */
.mega-menu-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0px;
}

.mega-menu-links li {
    line-height: 1.4;
    margin: 0;
}

.mega-menu-links li a {
    display: inline-block;
    padding: 4px 0;
    color: #1C1D1F;
    text-decoration: none;
    font-family: 'Poppins', sans-serif !important;
    font-size: 12px;
    font-weight: 400;
    line-height: 20px;
    transition: color 0.2s ease, padding-left 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}

.mega-menu-links li a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background-color: #0066FF !important;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.3s ease 0.05s;
    will-change: transform;
}
.mega-menu-links li a:hover{
    color: #0066FF !important;
    font-weight: 500;
}
.mega-menu-links li a:hover::after {
    transform: scaleX(1);
}

/* ============================================= */
/* NUMBER OF COLUMNS MODIFIERS */
/* Use data-columns attribute or class */
/* ============================================= */

/* 1 Column */
.mega-menu-wrapper[data-columns="1"] .mega-menu-columns-simple,
.mega-menu-cols-1 .mega-menu-columns-simple {
    grid-template-columns: 1fr !important;
    gap: 20px;
}

/* 2 Columns */
.mega-menu-wrapper[data-columns="2"] .mega-menu-columns-simple,
.mega-menu-cols-2 .mega-menu-columns-simple {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 30px;
}

/* 3 Columns - Maximum allowed */
.mega-menu-wrapper[data-columns="3"] .mega-menu-columns-simple,
.mega-menu-cols-3 .mega-menu-columns-simple,
.mega-menu-wrapper[data-columns="4"] .mega-menu-columns-simple,
.mega-menu-cols-4 .mega-menu-columns-simple {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 24px;
}

/* ============================================= */
/* WIDTH MODIFIERS */
/* ============================================= */

/* Extra Small (1 column) */
.mega-menu-size-xsmall .mega-menu-wrapper {
    min-width: 280px;
    max-width: 350px;
}

/* Small (2 columns) */
.mega-menu-size-small .mega-menu-wrapper {
    min-width: 500px;
    max-width: 600px;
}

/* Medium (3 columns) */
.mega-menu-size-medium .mega-menu-wrapper {
    max-width: 780px;
}

/* Large (Multi-level or 4+ columns) */
.mega-menu-size-large .mega-menu-wrapper {
    max-width: 800px;
}

/* Auto width */
.mega-menu-size-auto .mega-menu-wrapper {
    min-width: auto;
    width: max-content;
}

.talk-to-expert-button{
    border: none;
}

@media (min-width: 768px) and (max-width: 1050px) {
    .mega-menu-wrapper{
        top: calc(100%);
    }
}

a.blogSignIn{
    font-family: Poppins, sans-serif !important;
    font-weight: 500;
    font-size: 12px !important;
    color: #0066FF !important;
    border: 1px solid #0066FF;
    border-radius: 4px !important;
    background-color: #ffffff !important;
}