/* Mega Menu Styles - Imported from tmp.html with priority */

/* Nav Item Mega - from tmp.html */
.nav-item-mega {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

/* Ensure trigger serves as anchor for the arrow */
.mega-trigger {
    position: relative;
    z-index: 1001;
    /* Keep trigger above menu if needed */
}

/* Mega menu backdrop - full width layer - from tmp.html */
/* OUTER LAYER: Dynamic height controlled by JavaScript based on screen width percentage */
.mega-menu-container {
    position: fixed;
    top: calc(var(--navbar-height, 88px) - 20px);
    left: var(--mega-left, 20px);
    right: auto;
    width: var(--mega-width, calc(100% - 40px));
    /* Width controlled by JS to match constraints */
    background: transparent;
    /* Darker semi-transparent backdrop */
    /* Debug border removed */
    box-sizing: border-box;
    display: none;
    z-index: 990;
    padding: 0;
    overflow: hidden;
    /* Ensure inner content doesn't overflow */

    /* Dynamic height properties set by JavaScript:
     * - height: BASE_HEIGHT (400px) * multiplier
     * - multiplier based on window width percentage:
     *   - >46%: multiplier = 1 (400px)
     *   - <46%: multiplier = 3 (1200px)
     *   - <40%: multiplier = 5 (2000px)
     *   - <20%: multiplier = 7 (2800px)
     * - max-height: none (to prevent interference)
     */
    margin-top: 24px;
}

/* Inner content wrapper - centered with margins */
.mega-menu-content {
    margin: 0;
    margin-left: var(--mega-content-left, 0);
    /* Dynamic positioning relative to outer container */
    width: fit-content;
    /* Shrink-wrap to content */
    max-width: calc(100% - 100px);
    /* Ensure it stays within outer layer with 50px margins */
    /* Liquid Glass Effect - Refined */
    /* Solid Background - No Transparency */
    background: #191919;
    /* backdrop-filter: blur(16px); */
    /* -webkit-backdrop-filter: blur(16px); */

    border: 0.5px solid rgba(255, 255, 255, 0.2);
    /* Subtle glass edge */
    border-top: 0.5px solid rgba(255, 255, 255, 0.4);
    /* Specular highlight */
    border-bottom: 0.5px solid rgba(255, 255, 255, 0.1);

    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 0.5px 0 rgba(255, 255, 255, 0.3),
        /* Sharp inner rim */
        inset 0 0 20px rgba(255, 255, 255, 0.05);
    /* Volume glow */
    /* Box shadow: drop shadow, top inner highlight, subtle inner glow */
    border-radius: 18px;
    padding: 20px 25px 20px;
    box-sizing: border-box;
    /* Include padding in width calculation */
}

/* Show state - from tmp.html */
.mega-menu-container.show {
    display: block;
}

/* --- Mega Menu Blur Effect --- */
body.mega-menu-open>*:not(#navbar-placeholder):not(script):not(style) {
    filter: blur(8px);
    /* Strong blur */
    pointer-events: none;
    /* Prevent interaction with background */
    user-select: none;
    transition: filter 0.3s ease;
}

/* Ensure the navbar itself stays sharp and interactive */
#navbar-placeholder {
    filter: none !important;
    z-index: 1000;
    /* Ensure it stays on top */
    position: relative;
    /* Maintain context */
}

/* Optional: Darken the background slightly for better focus */
body.mega-menu-open::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    z-index: 998;
    /* Below navbar (1000) but above content */
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Active Menu Item Styling (No Arrow, Cyan Text) */
.nav-item-mega.active .mega-trigger {
    color: cyan !important;
}

/* Show state handled by JS click events */
.nav-item-mega.active .mega-menu-container {
    display: block;
    animation: slideDown 0.2s ease-out forwards;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mega Grid - from tmp.html */
/* Mega Grid - Smart Dynamic Width (Flexbox) */
.mega-grid {
    display: flex;
    flex-flow: row wrap;
    justify-content: flex-start;
    gap: 32px;
    /* Consistent gap between dynamic columns */
    margin: 0;
    padding: 0;
}

/* Mega Column - Intrinsic Sizing */
.mega-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 0 0 auto;
    /* Do not grow, do not shrink */
    width: max-content;
    /* Snap width to widest text element */
    min-width: 0;
}

/* Responsive adjustments if needed, but Flexbox handles wrapping naturally */
/* Responsive adjustments now handled in separate mobile-menu.css */

/* Remove flex properties from columns as they are now grid items */
.mega-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
    /* Allow grid to control width */
}

/* Column Title */
.mega-col-title {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #ffffff !important;
    opacity: 1 !important;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: block;
}

.mega-link-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Main Link Item (Interactive) */
.mega-link-item {
    font-size: 0.95rem;
    font-weight: 500;
    color: #d0d0d0;
    text-decoration: none;
    display: block;
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    padding: 4px 0 4px 8px;
    /* Constant padding */
    border-left: 2px solid transparent;
    /* Initial transparent border */
    position: relative;
}

.mega-link-item:hover {
    color: #fff !important;
    transform: none;
    border-left-color: cyan;
    padding-left: 8px;
    /* Maintain padding */
    text-shadow: 0 0 12px rgba(0, 255, 255, 0.6);
}

.mega-link-main {
    font-size: 1rem;
    /* Slightly Larger */
    font-weight: 600;
    color: #ffffff !important;
    display: block;
    margin-bottom: 4px;
    line-height: 1.3;
    letter-spacing: 0.3px;
    white-space: nowrap;
    /* Prevent wrapping */
    font-family: 'OpenSans' !important;
}

.mega-link-desc {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    display: block;
    line-height: 1.4;
    max-width: 240px;
    font-weight: 400;
    transition: color 0.2s;
}

.mega-link-item:hover .mega-link-desc {
    color: rgba(255, 255, 255, 0.7);
}

.mega-link-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

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

/* Sub Link Item (Interactive) */
.mega-sub-links {
    margin-top: 8px;
    padding-left: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Recursive Tree Level Styling */
.mega-tree-level {
    margin-top: 4px;
    padding-left: 14px;
    /* Indentation */
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    /* Tree connector line */
    margin-left: 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mega-sub-link {
    font-size: 0.9rem;
    color: #d0d0d0;
    text-decoration: none;
    display: block;
    padding-left: 12px;
    /* Reduce initial padding */
    border-left: 2px solid transparent;
    /* Indent sub-links */
    position: relative;
    transition: all 0.3s ease;
    font-family: 'OpenSans' !important;
}

.mega-sub-link:hover {
    color: cyan;
    transform: none;
    border-left-color: cyan;
    padding-left: 12px;
    /* Set to 12px to match base state */
}

/* Parent Item Styling */
li.has-children>.mega-sub-link {
    color: #fff;
    /* Highlight parent items */
    font-weight: 500;
}

/* Page Blur Effect for Mega Menu */
body.mega-open>*:not(#navbar-placeholder):not(script):not(.mega-menu-container) {
    filter: blur(5px);
    transition: filter 0.3s ease;
    pointer-events: none;
}