/**
 * Navigation & Mega Menu Styles
 * RapidTeck Networks Inc.
 */

/* ===================================
   Site Logo
   =================================== */
.site-logo {
    max-height: 50px;
    width: auto;
    fill: #484169;
    transition: transform 0.3s ease;
}

.logo-link:hover .site-logo {
    transform: scale(1.05);
}

/* ===================================
   Header Updates
   =================================== */
       
.logged-in .site-header {
  margin-top: 30px;
}

.site-header {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 1rem 0;
}

.site-header.scrolled {
    padding: 0.5rem 0;
    box-shadow: 0 4px 20px rgba(72, 65, 105, 0.15);
}

.site-header.scrolled .site-logo {
    max-height: 40px;
    fill: #fff;
}

/* ===================================
   Mobile Menu Toggle Enhancement
   =================================== */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    z-index: 1001;
}

.menu-bar {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--primary-color);
    transition: all 0.3s ease;
    border-radius: 2px;
}

.menu-toggle.active .menu-bar:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.menu-toggle.active .menu-bar:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active .menu-bar:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.site-header.scrolled .menu-bar {
    background-color: var(--text-light);
}

/* ===================================
   Primary Menu
   =================================== */
.primary-menu {
    display: flex;
    align-items: center;
    gap: 2.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.menu-item {
    position: relative;
}

.menu-item > a {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.75rem 0;
    display: block;
    position: relative;
    transition: color 0.3s ease;
}
.menu-item > a.btn-nav {
    padding: 0.75rem;
}
.site-header.scrolled .menu-item > a.btn-nav {
    border: 2px solid var(--primary-color);
    background-color: var(--text-light);
    color: var(--primary-color)!important;
}

/* Menu underline effect - base */
.menu-item > a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-item.current-menu-item > a::after {
    width: 100%;
}

.site-header.scrolled .menu-item > a {
    color: var(--text-light);
}

.site-header.scrolled .menu-item > a::after {
    background: var(--text-light);
}

/* Desktop-only: Hover effects */
@media (min-width: 769px) {
    .menu-item > a:hover::after {
        width: 100%;
    }

    .btn-nav:hover {
        background: var(--primary-dark);
        border-color: var(--primary-dark);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(72, 65, 105, 0.3);
    }
}

/* ===================================
   CTA Button in Nav
   =================================== */
.menu-item-cta {
    margin-left: 1rem;
}

.btn-nav {
    padding: 0.65rem 1.75rem;
    background: var(--primary-color);
    color: #ffffff !important;
    border-radius: 4px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid var(--primary-color);
}

.btn-nav::after {
    display: none !important;
}

/* ===================================
   Mega Menu Container
   =================================== */
.mega-menu-item {
    position: relative;
}

/* Desktop mega menu styles */
@media (min-width: 769px) {
    .mega-menu {
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%) translateY(20px);
        background: #ffffff;
        border-radius: 12px;
        box-shadow: 0 10px 40px rgba(72, 65, 105, 0.15);
        padding: 2rem;
        min-width: 900px;
        opacity: 0;
        visibility: hidden;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        margin-top: 1rem;
    }

    .mega-menu::before {
        content: '';
        position: absolute;
        top: -10px;
        left: 50%;
        transform: translateX(-50%);
        width: 0;
        height: 0;
        border-left: 10px solid transparent;
        border-right: 10px solid transparent;
        border-bottom: 10px solid #ffffff;
    }

    /* Desktop-only: Hover to show mega menu */
    .mega-menu-item:hover .mega-menu {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(0);
    }
}

/* ===================================
   Mega Menu Inner Grid & Links - Base Styles
   =================================== */
.mega-menu-inner {
    display: grid;
    gap: 1.5rem;
}

.mega-menu-column {
    transition: transform 0.3s ease;
}

.mega-menu-link {
    display: flex;
    align-items: start;
    gap: 1rem;
    padding: 1.25rem;
    transition: all 0.3s ease;
    text-decoration: none;
}

.mega-menu-icon {
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.mega-menu-content h4 {
    color: var(--primary-color);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.mega-menu-content p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

/* Desktop mega menu styles */
@media (min-width: 769px) {
    .mega-menu-inner {
        grid-template-columns: repeat(3, 1fr);
    }

    .mega-menu-link {
        border-radius: 8px;
        background: #f8f9fa;
        border: 2px solid transparent;
    }

    .mega-menu-icon {
        font-size: 2.5rem;
    }

    /* Desktop-only: Hover effects */
    .mega-menu-link:hover {
        background: linear-gradient(135deg, rgba(72, 65, 105, 0.05) 0%, rgba(94, 85, 130, 0.05) 100%);
        border-color: var(--primary-color);
        transform: translateY(-3px);
        box-shadow: 0 5px 15px rgba(72, 65, 105, 0.1);
    }

    .mega-menu-link:hover .mega-menu-icon {
        transform: scale(1.1) rotate(5deg);
    }

    /* Scrolled Header Mega Menu */
    .site-header.scrolled .mega-menu {
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
    }
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 1024px) {
    .mega-menu {
        min-width: 750px;
    }

    .mega-menu-inner {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .mega-menu {
        min-width: auto;
        width: 100%;
        left: 0;
        right: 0;
    }

    .mega-menu-inner {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
        position: relative;
        z-index: 1002;
    }

    .main-navigation {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        max-width: 400px;
        height: 100vh;
        background: #ffffff;
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3);
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1001;
        overflow-y: auto;
        padding: 5rem 2rem 2rem;
    }

    .main-navigation.active {
        right: 0;
    }

    .primary-menu {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .menu-item {
        border-bottom: 1px solid rgba(72, 65, 105, 0.1);
        position: relative;
    }

    .menu-item > a {
        /* padding: 1.25rem 1rem; */
        display: block;
        position: relative;
    }

    /* Dropdown arrow for menu items with children */
    .menu-item-has-children > a::after {
        content: '\25BC';
        position: absolute;
        right: 1rem;
        top: 50%;
        transform: translateY(-50%);
        font-size: 0.7rem;
        color: var(--primary-color);
        transition: transform 0.3s ease;
        pointer-events: none;
        background: none;
        width: 20px !important;
        height: 20px;
        left: inherit;
    }

    .menu-item-has-children.active > a::after {
        transform: translateY(-50%) rotate(180deg);
    }

    .menu-item-cta {
        margin-left: 0;
        margin-top: 1rem;
        border: none;
    }

    .btn-nav {
        display: block;
        text-align: center;
        padding: 1rem;
    }

    /* Standard submenu (non-mega menu) */
    .sub-menu {
        display: none;
        background: #f8f9fa;
        padding: 0;
        margin: 0;
        list-style: none;
    }

    .menu-item-has-children.active > .sub-menu {
        display: block;
    }

    .sub-menu .menu-item {
        border-bottom: 1px solid rgba(72, 65, 105, 0.05);
    }

    .sub-menu .menu-item:last-child {
        border-bottom: none;
    }

    .sub-menu a {
        padding: 0.875rem 1rem 0.875rem 2.5rem;
        font-size: 0.95rem;
        color: var(--text-color);
        position: relative;
    }

    .sub-menu a::before {
        content: '→';
        position: absolute;
        left: 1.5rem;
        color: var(--primary-color);
        font-size: 0.875rem;
    }

    .sub-menu a:hover {
        background: rgba(72, 65, 105, 0.05);
        color: var(--primary-color);
    }

    /* Mobile Mega Menu */
    .mega-menu {
        position: static;
        transform: none;
        min-width: auto;
        width: 100%;
        padding: 0;
        margin: 0;
        background: #f8f9fa;
        border-radius: 0;
        box-shadow: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease, padding 0.4s ease;
    }

    .mega-menu::before {
        display: none;
    }

    .mega-menu-item.active .mega-menu {
        max-height: 1000px;
        padding: 1rem 0;
        opacity: 1;
        visibility: visible;
    }

    .mega-menu-inner {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 0;
    }

    .mega-menu-column {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .mega-menu-link {
        display: flex;
        align-items: center;
        gap: 1rem;
        padding: 1rem 1.5rem;
        margin: 0;
        background: transparent;
        border-radius: 0;
        border: none;
        border-bottom: 1px solid rgba(72, 65, 105, 0.1);
        transition: background 0.3s ease;
    }

    .mega-menu-link:hover {
        background: rgba(72, 65, 105, 0.05);
        border-color: rgba(72, 65, 105, 0.1);
        transform: none;
        box-shadow: none;
    }

    .mega-menu-icon {
        font-size: 2rem;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
        color: white;
        border-radius: 8px;
    }

    .mega-menu-link:hover .mega-menu-icon {
        transform: scale(1.05);
    }

    .mega-menu-content {
        flex: 1;
        text-align: left;
    }

    .mega-menu-content h4 {
        font-size: 1rem;
        margin-bottom: 0.25rem;
        color: var(--primary-color);
    }

    .mega-menu-content p {
        font-size: 0.85rem;
        line-height: 1.4;
        color: var(--text-muted);
        margin: 0;
        display: none;
    }

    /* Mobile menu overlay - creates dark background */
    .navigation-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.4s ease, visibility 0.4s ease;
        z-index: 999;
    }

    .navigation-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

@media (max-width: 480px) {
    .main-navigation {
        max-width: 100%;
    }

    .mega-menu-link {
        padding: 0.875rem 1rem;
        gap: 0.875rem;
    }

    .mega-menu-icon {
        width: 36px;
        height: 36px;
        font-size: 1.75rem;
    }

    .mega-menu-content h4 {
        font-size: 0.95rem;
    }

    .mega-menu-content p {
        font-size: 0.8rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}
