/*
 * DT Mega Menu Styles
 * -------------------
 * This file controls the desktop mega menu, including
 * the top-level bar and the multi-column dropdown panel.
 */

/* --- 0. Hide on Mobile --- */
@media (max-width: 1023px) {
    .my-mega-menu {
        display: none !important;
    }
}

/* --- 0a. Top-bar cluster on a single row (both auth states) ---
 * The account cluster holds two groups — social icons and the auth links
 * (phone / login / logout / cart). They were wrapping onto two lines. Keep
 * them, and everything inside them, on one row. */
@media (min-width: 1024px) {
    .dtmm-top-bar-account {
        display: flex !important;
        /* The theme sets this cluster to flex-direction:column, which stacked
         * the social icons above the login/cart. Force a single row. */
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 16px !important;
    }
    .dtmm-top-bar-account .dt-social-icons,
    .dtmm-top-bar-account .dt-auth-links {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 12px !important;
    }
    /* Action icons (phone / login / cart) first, social icons after. */
    .dtmm-top-bar-account .dt-auth-links   { order: 1 !important; }
    .dtmm-top-bar-account .dt-social-icons { order: 2 !important; }
}

/* --- 0b. Two-row header layout (LOGGED-OUT desktop only) ---
 * The public header used to be a single row — logo + full text nav + the
 * login/cart/social cluster. On any laptop under ~1360px the nav couldn't
 * shrink (labels don't wrap), so it stole the width and shoved the auth icons
 * clean off the right edge, with no page scroll to reach them.
 *
 * Splitting it into two rows fixes that at the structure level: logo + auth on
 * a top row, the menu full-width below.
 *
 * Scoped to body:not(.logged-in) ON PURPOSE. The logged-IN header is a
 * different layout — logo, a compact icon menu (chat / connections / courses /
 * settings / notifications) centred, and Account/Logout/Cart on the right, all
 * on ONE row. Those icons are tiny and never overflow, so the logged-in header
 * must keep its original single row; the two-row rules below would wrap and
 * reorder it into a mess.
 */
@media (min-width: 1024px) {
    body:not(.logged-in) .site-header > .header-inner {
        display: flex !important;
        flex-wrap: wrap !important;
        /* Centre the top row so the logo sits level with the icons, rather
         * than the small icons floating above the taller logo. */
        align-items: center !important;
        row-gap: 3px !important;
        padding: 6px 0 !important;
    }

    /* Top row: logo left, auth (login / cart / social) pushed to the right. */
    body:not(.logged-in) .site-header .site-logo {
        order: 1 !important;
        flex: 0 0 auto !important;
        /* The logo box carried ~30px of dead vertical padding around a 66px
         * image, which stretched the top row and left a gap above the menu.
         * Collapse it to the image. */
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        margin: 0 !important;
        line-height: 0 !important;
    }
    body:not(.logged-in) .site-header .desktop-auth {
        order: 2 !important;
        margin-left: auto !important;
        flex: 0 0 auto !important;
        display: flex !important;
        align-items: center !important;
    }

    /* Bottom row: the menu takes the whole width to itself. */
    body:not(.logged-in) .site-header .desktop-nav {
        order: 3 !important;
        flex: 0 0 100% !important;
        width: 100% !important;
    }
    body:not(.logged-in) .site-header .my-menu-top-level {
        justify-content: center !important;   /* group items in the middle */
    }

    /* Compact row: all six items fit the full-width row down to 1024px, where
     * the mobile menu takes over. Font is unchanged — the width came from the
     * layout, not from shrinking text. */
    body:not(.logged-in) .site-header .my-menu-top-level > li      { padding: 0.4rem 0.65rem !important; }
    body:not(.logged-in) .site-header .my-menu-top-level > li > a  { font-size: 1rem !important; }

    /* Thin divider between menu items so the sections read as distinct.
     * A border rather than a "|" character so it centres cleanly and never
     * wraps. Not before the first item. li stays position:static — the mega
     * dropdown panel is positioned against .site-header, so a pseudo-element
     * here would need position:relative and break that. */
    body:not(.logged-in) .site-header .my-menu-top-level > li + li {
        border-left: 1px solid rgba(0, 0, 0, 0.14) !important;
    }
}

/* --- 1. The Main Header Card (Theme-Specific) --- */
.site-header {
    background: #fff !important;
    border: 2px solid #a987c2 !important; /* Purple Border */
    border-radius: 1rem !important;        /* Rounded Card Look */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
    
    /* FIX: RESTORED STICKY LOGIC */
    position: fixed !important; 
    top: 40px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 95% !important;
    max-width: 1400px !important;
    
    z-index: 1000 !important;
    margin: 0 !important; /* Removed 10px 20px margin to prevent alignment jump */
    transition: border-bottom-left-radius 0.3s ease, border-bottom-right-radius 0.3s ease !important;
}

.site-header > .header-inner {
    position: relative;
    z-index: 1002;
    border-radius: 0.85rem;
    transition: border-bottom-left-radius 0.3s ease, border-bottom-right-radius 0.3s ease;
}

/* --- 2. The Top-Level Menu Container (FIXED FOR LOGGED-IN STATE) --- */
.my-mega-menu {
    display: flex;
    align-items: center;
    height: 100%;
    flex-grow: 1; /* Ensures it takes up available space */
    width: auto;
}

.my-menu-top-level {
    display: flex !important;
    flex-wrap: nowrap !important; /* CRITICAL: Forbids two lines */
    justify-content: space-evenly; /* Distributes items nicely */
    align-items: center;
    width: 100%;
    list-style: none !important;
    margin: 0;
    padding: 0;
}

.my-menu-top-level > li {
    position: static; 
    padding: 1rem 1rem;
    list-style: none !important;
    white-space: nowrap; /* CRITICAL: Prevents text wrapping */
    flex-shrink: 1;      /* Allows slight squish if needed, but prefers staying on one line */
}

.my-menu-top-level > li > a {
    text-decoration: none;
    color: #333;
    font-weight: 600;
    transition: color 0.2s ease;
    font-size: 1.1rem;
    font-family: 'Poppins', sans-serif;
}

.my-menu-top-level > li:hover > a {
    color: #a987c2;
}

/* --- 3. The Dropdown Panel (Theme-Specific Positioning) --- */
.my-megamenu-panel {
    position: absolute;
    top: 99%; 
    left: -1px;   
    right: -2px;  
    width: auto; /* Full width of .site-header */
    
    background: #fff;
    border: 2px solid #a987c2; 
    border-top: none; 
    
    border-bottom-left-radius: 0.85rem; 
    border-bottom-right-radius: 0.85rem;
    
    box-shadow: 0 20px 30px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    
    z-index: 999;
    
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(10px); 
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

/* --- 4. Active State (Theme-Specific) --- */
.my-menu-top-level > li.submenu-is-active .my-megamenu-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.site-header.menu-is-active {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}
.site-header.menu-is-active > .header-inner {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* --- 5. Panel Inner Layout (Vertical Stack) --- */
.my-megamenu-panel-inner {
    display: flex !important; 
    flex-direction: column !important; /* CRITICAL: Stack content on top of footer */
    gap: 20px !important;
    box-sizing: border-box;
}

/* --- 6. Main Content Wrapper (Horizontal Columns) --- */
/* We wrap the links and featured content so THEY stay side-by-side */
.my-megamenu-main-content {
    display: flex !important;
    justify-content: space-between !important;
    gap: 40px !important;
    width: 100%;
}

/* --- 7. Individual Link Column (Flexbox) --- */
.my-menu-column.my-menu-links {
    display: block !important; 
    flex: 1 !important; 
    min-width: 180px; 
}

/* --- 8. Featured "Ad" Column (Flexbox) --- */
.my-menu-column.my-menu-featured {
    display: block !important;
    flex-basis: 300px !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;

    text-decoration: none;
    color: inherit;
    border-radius: 12px;
    transition: box-shadow 0.3s ease;
    background: #f9f9f9;
}
.my-menu-column.my-menu-featured:hover {
    background: #f0f0f0;
}

.my-menu-column.my-menu-featured img {
    display: block;
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 12px 12px 0 0;
}

.my-menu-column.my-menu-featured h5 {
    font-size: 1rem;
    font-weight: 600;
    color: #111;
    line-height: 1.4;
    margin: 1rem 1.25rem;
}
.my-menu-column.my-menu-featured p {
    font-size: 0.95em;
    line-height: 1.4;
    color: #555;
    margin: 0 1.25rem 1rem 1.25rem;
    white-space: normal;
}
.my-menu-column.my-menu-featured:hover h5,
.my-menu-column.my-menu-featured:hover p {
    color: #a987c2;
}

/* --- 9. Link Item Styling (Flexbox) --- */
.my-menu-links ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    margin-top: 0; /* Ensure spacing from header */
}
.my-menu-links li {
    margin: 0 0 1.5rem 0;
    padding: 0;
    white-space: normal; /* Allow sub-descriptions to wrap naturally inside the dropdown */
}
.my-menu-links li a {
    display: inline-block; 
    padding: 0; 
    text-decoration: none;
    color: #444; 
    border-radius: 0;
}
.my-menu-links li a:hover .sub-link-title {
    color: #a987c2;
}

.my-menu-links .sub-link-title {
    font-size: 1.1rem; 
    font-weight: 600;
    display: block;
    margin-bottom: 0.35rem; 
    color: #111; 
    transition: color 0.2s ease;
}

.my-menu-links .sub-link-description {
    font-size: 0.9em;
    color: #666;
    line-height: 1.3;
    font-family: 'Poppins', sans-serif;
}

/* --- 10. Mega Menu Column Headers (Alignment Fix) --- */
.dtmm-column-header {
    font-size: 22px;          
    font-weight: 800;         
    color: #6a4c89;           
    margin-bottom: 18px;      
    padding-bottom: 10px;     
    border-bottom: 2px solid #f1f1f1; /* The division line */
    letter-spacing: -0.5px;   
    line-height: 1.2;
    display: block;
    
    /* NEW: Force alignment even if empty */
    min-height: 40px; 
    box-sizing: border-box;
}

/* Ensure the border shows even if there is no text inside */
.dtmm-column-header:empty::before {
    content: "\00a0"; /* Invisible space to keep the height active */
}

/* --- 11. Mega Menu Footer Utility Bar (Full-Width Snap Fix) --- */
.dtmm-menu-footer {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important; 
    align-items: center !important;
    gap: 50px !important;            
    padding: 25px 0 !important;
    background: #fcfcfc !important;  
    border-top: 1px solid #f1f1f1 !important;
    
    /* NEW: Force the row to ignore parent padding and snap to edges */
    width: calc(100% + 3rem) !important; 
    margin: 30px -1.5rem -1.5rem -1.5rem !important; 
    
    border-radius: 0 0 12px 12px;
    box-sizing: border-box !important;
}

.dtmm-footer-item {
    display: flex !important;
    align-items: center !important;
    gap: 15px !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    flex: 0 1 auto;
}

.dtmm-footer-icon {
    width: 50px !important;
    height: 50px !important;
    object-fit: contain !important;
    flex-shrink: 0 !important;
}

.dtmm-footer-label {
    font-weight: 700 !important;
    font-size: 1rem !important;
    color: #6a4c89 !important; /* Your Brand Purple */
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.dtmm-footer-item:hover .dtmm-footer-label {
    color: #a987c2 !important;
    text-decoration: underline !important;
}
/* Flag Alignment in Menu */
.my-menu-top-level > li > a .fi {
    margin-right: 8px; /* Spacing between flag and text */
    border-radius: 2px; /* Slight rounding for a modern look */
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    vertical-align: middle;
    display: inline-block;
}

/* Ensure the text doesn't look cramped */
.my-menu-top-level > li > a {
    display: flex;
    align-items: center;
}

a.dtmm-ql-item {
    font-size: 10px !important;
    line-height: 1.4 !important;
    color: #6a4c89 !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    text-decoration: none !important;
}
a.dtmm-ql-item:hover {
    text-decoration: underline !important;
    opacity: 1 !important;
}

/* Ensure sub-link descriptions stay small too */
.sub-link-description, 
.sub-link-description p {
    font-size: 0.9rem !important;
    line-height: 1.4 !important;
    margin-bottom: 4px !important;
}