
/* =========================================
   Navigation System — Professional Mega-Menu
   M AND R SOLUTION · 2026 Refactor
   ========================================= */

/* ── Body spacing for fixed header ── */
body.has-unified-header {
    padding-top: 64px;
}

@media (max-width: 991px) {
    body.has-unified-header {
        padding-top: 56px;
    }
}

/* ── Unified Header Shell ── */
.unified-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--primary-gradient, linear-gradient(135deg, #3D2F7A 0%, #6B4FBB 100%));
    box-shadow: var(--shadow-md);
    transition: box-shadow 0.3s ease;
}

.unified-header.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* ── Navbar Layout ── */
.unified-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg, 1.5rem);
    height: 64px;
    position: relative;
}

/* ── Logo ── */
.unified-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.unified-logo .logo-icon img {
    width: 34px;
    height: 34px;
    border-radius: 6px;
}

.unified-logo .logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.unified-logo .company-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
}

.unified-logo .product-name {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
}

/* ── Main Menu ── */
.unified-menu {
    display: flex;
    align-items: center;
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 0;
    height: 100%;
}

.unified-menu-item {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.unified-menu-link {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 14px;
    height: 64px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    transition: color 0.2s;
    font-family: inherit;
}

.unified-menu-link:hover,
.unified-menu-link.active {
    color: #fff;
}

.unified-menu-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 14px;
    right: 14px;
    height: 3px;
    background: var(--highlight-color, #FFD700);
    border-radius: 3px 3px 0 0;
    transform: scaleX(0);
    transition: transform 0.25s ease;
    transform-origin: center;
}

.unified-menu-link:hover::after,
.unified-menu-link.active::after {
    transform: scaleX(1);
}

.unified-menu-link .dropdown-arrow {
    font-size: 10px;
    transition: transform 0.25s ease;
    opacity: 0.6;
}

.unified-menu-link[aria-expanded="true"] .dropdown-arrow {
    transform: rotate(180deg);
}

/* ── Simple Dropdown ── */
.unified-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 240px;
    background: #fff;
    border-radius: 0 0 var(--radius-lg, 12px) var(--radius-lg, 12px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    padding: 8px 0;
    list-style: none;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-top: 3px solid var(--primary-color, #3D2F7A);
}

.unified-menu-item:hover > .unified-dropdown-menu,
.unified-menu-link[aria-expanded="true"] + .unified-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.unified-dropdown-menu li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    color: var(--text-color, #333);
    font-size: 14px;
    text-decoration: none;
    transition: all 0.15s ease;
}

.unified-dropdown-menu li a:hover {
    background: var(--bg-light, #f5f7fa);
    color: var(--primary-color, #3D2F7A);
    padding-left: 22px;
}

.unified-dropdown-menu li a i {
    width: 20px;
    color: var(--secondary-color, #4A6FA5);
    font-size: 14px;
    text-align: center;
    flex-shrink: 0;
}

.unified-dropdown-menu li a:hover i {
    color: var(--primary-color, #3D2F7A);
}

.unified-dropdown-menu .dropdown-divider {
    height: 1px;
    background: var(--border-color, #eee);
    margin: 6px 18px;
}

.unified-dropdown-menu .dropdown-header {
    padding: 8px 18px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted, #888);
}

/* ── Products Mega-Menu ── */

/* Make mega-menu items position: static so mega panel centers on navbar */
.unified-menu-item.has-mega-menu {
    position: static;
}

.unified-mega-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    width: 880px;
    max-width: calc(100vw - 40px);
    background: #fff;
    border-radius: 0 0 var(--radius-xl, 16px) var(--radius-xl, 16px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.14);
    padding: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-top: 3px solid var(--primary-color, #3D2F7A);
    overflow: hidden;
}

.unified-menu-item.has-mega-menu:hover > .unified-mega-menu,
.unified-menu-item.has-mega-menu .unified-menu-link[aria-expanded="true"] + .unified-mega-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

/* Mega-menu grid: featured left column + 3 link columns */
.mega-grid {
    display: grid;
    grid-template-columns: 260px 1fr 1fr 1fr;
    min-height: 340px;
}

/* Featured column (left) */
.mega-featured {
    background: linear-gradient(160deg, var(--primary-color, #3D2F7A) 0%, var(--accent-color, #6B4FBB) 100%);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #fff;
}

.mega-featured-icon {
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 18px;
}

.mega-featured h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px;
    color: #fff;
}

.mega-featured p {
    font-size: 13px;
    line-height: 1.6;
    opacity: 0.85;
    margin: 0 0 20px;
}

.mega-featured .mega-featured-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: var(--radius-md, 8px);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
    backdrop-filter: blur(4px);
}

.mega-featured .mega-featured-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Mega-menu columns */
.mega-col {
    padding: 24px 20px;
    border-left: 1px solid rgba(0, 0, 0, 0.06);
}

.mega-col-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted, #888);
    font-weight: 700;
    margin: 0 0 14px;
    padding: 0 8px 10px;
    border-bottom: 1px solid var(--border-color, #eee);
}

.mega-col-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mega-col-list li a {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 8px;
    border-radius: var(--radius-sm, 6px);
    text-decoration: none;
    transition: all 0.15s ease;
    color: var(--text-color, #333);
}

.mega-col-list li a:hover {
    background: var(--bg-light, #f5f7fa);
    color: var(--primary-color, #3D2F7A);
}

.mega-col-list li a .mega-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 2px;
}

.mega-item-icon.icon-blue { background: #EBF5FF; color: #1565C0; }
.mega-item-icon.icon-green { background: #E8F5E9; color: #2E7D32; }
.mega-item-icon.icon-orange { background: #FFF3E0; color: #E65100; }
.mega-item-icon.icon-purple { background: #F3E8FF; color: #6B4FBB; }
.mega-item-icon.icon-red { background: #FFEBEE; color: #C62828; }
.mega-item-icon.icon-teal { background: #E0F2F1; color: #00695C; }
.mega-item-icon.icon-indigo { background: #E8EAF6; color: #283593; }
.mega-item-icon.icon-cyan { background: #E0F7FA; color: #00838F; }
.mega-item-icon.icon-amber { background: #FFF8E1; color: #FF8F00; }
.mega-item-icon.icon-pink { background: #FCE4EC; color: #AD1457; }
.mega-item-icon.icon-lime { background: #F0F4C3; color: #558B2F; }
.mega-item-icon.icon-brown { background: #EFEBE9; color: #4E342E; }

/* Featured panel quick links */
.mega-featured-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 14px;
}

.mega-featured-links a {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    padding: 3px 0;
    transition: color 0.2s;
}

.mega-featured-links a:hover {
    color: #fff;
}

.mega-featured-links a i {
    width: 16px;
    font-size: 11px;
    text-align: center;
    opacity: 0.7;
}

/* Compact list variant — icon + name only */
.mega-col-list.compact li a {
    padding: 5px 8px;
    align-items: center;
}

.mega-col-list.compact .mega-item-icon {
    width: 28px;
    height: 28px;
    font-size: 12px;
}

.mega-col-list.compact .mega-item-desc {
    display: none;
}

.mega-col-list.compact .mega-item-name {
    font-size: 13px;
}

.mega-col-list li a .mega-item-text {
    display: flex;
    flex-direction: column;
}

.mega-col-list li a .mega-item-name {
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.3;
}

.mega-col-list li a .mega-item-desc {
    font-size: 12px;
    color: var(--text-muted, #888);
    line-height: 1.4;
    margin-top: 2px;
}

.mega-col-list li a:hover .mega-item-name {
    color: var(--primary-color, #3D2F7A);
}

/* Mega-menu bottom bar */
.mega-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--bg-light, #f8f9fa);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 13px;
}

.mega-bottom a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-color, #3D2F7A);
    text-decoration: none;
    font-weight: 600;
    transition: gap 0.2s;
}

.mega-bottom a:hover {
    gap: 10px;
}

/* ── Actions (Desktop) ── */
.unified-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* Theme Switcher */
.theme-switcher {
    position: relative;
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: background 0.2s;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.22);
}

.theme-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border-radius: var(--radius-md, 8px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    padding: 6px;
    display: none;
    min-width: 150px;
    z-index: 1002;
}

.theme-switcher:hover .theme-dropdown,
.theme-dropdown.show {
    display: block;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-color, #333);
    font-family: inherit;
    transition: background 0.15s;
}

.theme-option:hover {
    background: var(--bg-light, #f5f7fa);
}

.theme-option.active {
    background: var(--bg-light, #f5f7fa);
    font-weight: 600;
}

.theme-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

/* Demo Button */
.unified-demo-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 20px;
    background: var(--highlight-color, #FFD700);
    color: var(--primary-dark, #2E2360);
    border: none;
    border-radius: var(--radius-md, 8px);
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
}

.unified-demo-btn:hover {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ── Mobile Toggle ── */
.unified-mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    z-index: 1002;
}

.unified-mobile-toggle .bar {
    width: 24px;
    height: 2.5px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.unified-mobile-toggle.active .bar:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
}
.unified-mobile-toggle.active .bar:nth-child(2) {
    opacity: 0;
}
.unified-mobile-toggle.active .bar:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
}

.unified-mobile-actions {
    display: none;
}

/* ── Responsive: Tablet & Mobile ── */
@media (max-width: 991px) {
    .unified-navbar {
        height: 56px;
    }

    .unified-mobile-toggle {
        display: flex;
    }

    .unified-menu {
        display: none;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        bottom: 0;
        background: #fff;
        flex-direction: column;
        align-items: stretch;
        padding: 0;
        overflow-y: auto;
        gap: 0;
        height: auto;
        z-index: 1000;
    }

    .unified-menu.active {
        display: flex;
    }

    .unified-menu-item {
        height: auto;
        border-bottom: 1px solid var(--border-color, #eee);
    }

    .unified-menu-link {
        height: auto;
        padding: 14px 20px;
        color: var(--text-color, #333);
        font-size: 15px;
        justify-content: space-between;
        width: 100%;
    }

    .unified-menu-link::after {
        display: none;
    }

    .unified-menu-link .dropdown-arrow {
        opacity: 1;
        color: var(--text-muted, #888);
    }

    /* Reset mega-menu item to relative on mobile */
    .unified-menu-item.has-mega-menu {
        position: relative;
    }

    /* Simple dropdown → accordion on mobile */
    .unified-dropdown-menu,
    .unified-mega-menu {
        position: static;
        width: 100%;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: none;
        border-radius: 0;
        box-shadow: none;
        border: none;
        border-top: none;
        display: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        background: #f9fafb;
    }

    .unified-menu-link[aria-expanded="true"] + .unified-dropdown-menu,
    .unified-menu-link[aria-expanded="true"] + .unified-mega-menu {
        display: block;
        max-height: 2000px;
    }

    .unified-dropdown-menu li a {
        padding: 12px 28px;
    }

    /* Mega-menu collapses to single column on mobile */
    .mega-grid {
        display: block;
    }

    .mega-featured {
        padding: 20px;
    }

    .mega-featured h3 {
        font-size: 16px;
    }

    .mega-col {
        border-left: none;
        border-top: 1px solid rgba(0, 0, 0, 0.06);
        padding: 16px 20px;
    }

    .mega-featured-links {
        margin-top: 10px;
    }

    .mega-featured-links a {
        font-size: 13px;
        padding: 5px 0;
    }

    .mega-col-list.compact .mega-item-icon {
        width: 26px;
        height: 26px;
    }

    .mega-bottom {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .unified-mobile-actions {
        display: block;
        padding: 16px 20px;
        border-top: 1px solid var(--border-color, #eee);
    }

    .unified-mobile-actions .unified-demo-btn {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
        font-size: 15px;
    }

    .unified-actions {
        display: none;
    }

    .unified-logo .product-name {
        display: none;
    }
}

@media (max-width: 480px) {
    .unified-navbar {
        padding: 0 var(--spacing-md, 1rem);
    }

    .unified-logo .company-name {
        font-size: 13px;
    }
}
