/* --- Navigation (Adapted for Mega Menu) --- */

/*** 1. Top-Level Navigation (Your styles - mostly unchanged) ***/
.nav-bar {
    display: grid;
    justify-content: left;
    align-items: center;
    height: 48px;
}

.dd {
    height: 48px;
    list-style: none; /* Good practice to add */
    padding-left: 0;  /* Good practice to add */
    margin: 0;        /* Good practice to add */
}

/* Use direct child selector > to avoid affecting nested lists */
.dd > li {
    float: left; /* Or use display: inline-block; */
    display: block;
    text-align: center;
    font-size: 16px;
    position: relative; /* CRITICAL: This is the anchor for the absolute positioned mega menu */
}

.dd > li > a {
    position: relative;
    color: #050745;
    text-decoration: none;
    display: block;
    font-weight: 500;
    line-height: 48px;
    margin: 0 8px;
    white-space: nowrap;
    padding-left: 11px;
    padding-right: 11px;
}

.dd > li > a:hover {
    text-decoration: none;
    color: #2eaadc;
}


/* 2. Create the hidden pseudo-element (the underline) */
.dd > li > a::before {
    content: '';
    position: absolute;
    display: block;

    /* Positioning */
    width: 100%;
    left: 0;
    bottom: 5px;
    z-index: 110;

    /* Styling */
    height: 4px;
    background-color: #FC7D21;
    border-radius: 2px;

    /* Animation */
    transform: scaleX(0);
    transition: transform 0.3s ease-in-out;
    transform-origin: center;
}

/* 3. Show the underline on hover by scaling it back to full width */
.dd > li:hover > a::before {
    transform: scaleX(1);
}

/*** 2. The Mega Menu Container (CORRECTED) ***/

/* This is the default, HIDDEN state of the container */
.mega-menu-container {
    display: none;
    position: absolute;
    top: 100%;
    margin-top: -7px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;

    padding: 32px 56px;
    background: #FFFFFF;
    border: 1px solid #B4B5C8;
    box-shadow: 0px 15px 14.6px rgba(0, 0, 0, 0.1);
    border-radius: 16px;

    gap: 64px;
}

/* This is the VISIBLE state, shown only on hover of the parent list item */
.dd > li.is-active > .mega-menu-container {
    display: flex;
}


/*** 3. Mega Menu Columns & Titles (New styles) ***/
.mega-menu-column {
    flex: 1; /* This makes each column take up an equal amount of space */
    text-align: left;
}

.mega-menu-title {
    color: #50527D;
    font-weight: 400;
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 22px;

    white-space: nowrap;
}


/*** 4. Links Inside Columns (Adapted from your .dd li ul li styles) ***/
.mega-menu-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mega-menu-submenu li {
    float: none;
    padding: 0; /* Remove extra padding, control with the 'a' tag */
    text-align: left;
}

.mega-menu-submenu li a {
    display: block;
    color: #050745; /* Your original color */
    text-decoration: none;
    padding: 6px 0; /* Vertical padding, no horizontal */
    margin: 0;
    text-align: left; /* Overrides centered text from old rules */

    font-weight: 500;
    font-size: 16px;
    line-height: 24px;

    white-space: nowrap;
    cursor: pointer;
}

.mega-menu-submenu li a:hover {
    color: #2eaadc; /* Your original hover color */
    text-decoration: none; /* As per your a.dd_hover:hover rule */
}


/*** 5. Dropdown Arrow Fix ***/
/* WordPress adds 'menu-item-has-children' class by default. It's better to use this than '.parent' */
.dd > li.menu-item-has-children > a {
    position: relative;
    padding-right: 36px; /* leave room for arrow */
}

.dd > li.menu-item-has-children > a:after {
    content: '';
    position: absolute;
    right: 12px;
    top: 57%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-image: url('../images/dd_down2.png');
    background-repeat: no-repeat;
    background-size: contain;
    z-index: 10;
    display: inline-block;
}