/* ===================================
   MOBILE MENU STYLES & ACCORDION
   =================================== */

/* Overlay backdrop */
.mobile-nav-wrapper::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.mobile-nav-wrapper.menu-open::after {
    opacity: 1;
    pointer-events: all;
}

.mobile-nav-wrapper {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1000;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.mobile-nav-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: transparent;
    border-bottom: none;
}

/* Hamburger Toggle Button */
.mobile-nav-toggle {
    display: none;
    cursor: pointer;
    user-select: none;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: background 0.25s ease, transform 0.2s ease;
    background: rgba(255,255,255,0.08);
    border: 1.5px solid rgba(255,255,255,0.18);
    padding: 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Hamburger icon — 3 animated bars */
.mobile-nav-toggle .bar {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease, width 0.3s ease;
    position: absolute;
}
.mobile-nav-toggle .bar:nth-child(1) { transform: translateY(-6px); }
.mobile-nav-toggle .bar:nth-child(2) { width: 14px; }
.mobile-nav-toggle .bar:nth-child(3) { transform: translateY(6px); }

.mobile-nav-wrapper.menu-open .mobile-nav-toggle .bar:nth-child(1) { transform: translateY(0) rotate(45deg); width: 20px; }
.mobile-nav-wrapper.menu-open .mobile-nav-toggle .bar:nth-child(2) { opacity: 0; width: 0; }
.mobile-nav-wrapper.menu-open .mobile-nav-toggle .bar:nth-child(3) { transform: translateY(0) rotate(-45deg); width: 20px; }

.mobile-nav-toggle:hover {
    background: rgba(255,255,255,0.15);
    transform: scale(1.05);
}

/* Mobile Navigation Container */
.mobile-nav {
    overflow-y: auto;
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(160deg, #0f1923 0%, #1a2333 60%, #0d1520 100%);
    position: fixed;
    top: 0;
    right: 0;
    width: 88%;
    max-width: 360px;
    height: 100vh;
    z-index: 999;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.45);
    transform: translateX(100%);
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(255,255,255,0.07);
}

/* Decorative top accent line */
.mobile-nav::before {
    content: '';
    display: block;
    height: 3px;
    width: 100%;
    background: linear-gradient(90deg, #667eea, #a78bfa, #00f0ff);
    flex-shrink: 0;
}

.mobile-nav.active {
    transform: translateX(0);
}

/* Drawer header — logo area */
.mobile-nav-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}

.mobile-nav-drawer-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.04em;
}

.mobile-nav-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: #aaa;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    line-height: 1;
    padding: 0;
}

.mobile-nav-close:hover {
    background: rgba(239,68,68,0.15);
    color: #ef4444;
    border-color: rgba(239,68,68,0.3);
}

/* Scrollable menu area */
.mobile-nav-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.mobile-nav-scroll::-webkit-scrollbar { width: 4px; }
.mobile-nav-scroll::-webkit-scrollbar-track { background: transparent; }
.mobile-nav-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }

/* Mobile Navigation Menu List */
.mobile-nav-menu {
    list-style: none;
    margin: 0;
    padding: 8px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Mobile Navigation Item */
.mobile-nav-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
}

.mobile-nav-item:last-child {
    border-bottom: none;
}

/* Mobile Navigation Link */
.mobile-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 14px;
    color: rgba(255,255,255,0.82);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.22s ease, color 0.22s ease, padding-left 0.22s ease;
    user-select: none;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    border-radius: 10px;
    letter-spacing: 0.01em;
    position: relative; /* needed for ::after arrow positioning */
}

/* Extra right padding on links that have a submenu arrow */
.mobile-nav-item.has-submenu > .mobile-nav-link {
    padding-right: 40px;
}

.mobile-nav-link:hover {
    background: rgba(255,255,255,0.07);
    color: #fff;
    padding-left: 18px;
}

.mobile-nav-item.active > .mobile-nav-link {
    background: rgba(102, 126, 234, 0.12);
    color: #a78bfa;
}

/* Arrow indicator — placed on the link itself so top:50% always
   refers to the link row height, not the full (expanded) item height */
.mobile-nav-item.has-submenu > .mobile-nav-link::after {
    content: '›';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%) rotate(90deg);
    font-size: 18px;
    font-weight: 300;
    color: rgba(255,255,255,0.8);
    transition: transform 0.3s ease, color 0.3s ease;
    pointer-events: none;
}

.mobile-nav-item.has-submenu.active > .mobile-nav-link::after {
    transform: translateY(-50%) rotate(270deg);
    color: #a78bfa;
}

/* Mobile Submenu */
.mobile-submenu {
    max-height: 0;
    overflow: hidden;
    /* include padding in transition so content slides smoothly, no pop */
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(0,0,0,0.2);
    border-radius: 0 0 10px 10px;
    margin: 0 2px;
    padding: 0;
}

.mobile-nav-item.active .mobile-submenu {
    max-height: 2000px; /* large enough for any full mega-menu-list content */
    padding: 6px 0 10px;
}

/* Mobile Submenu List */
.mobile-submenu ul {
    list-style: none;
    margin: 0;
    padding: 0 12px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.mobile-submenu li {
    margin: 0;
    padding: 0;
}

.mobile-submenu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px 9px 14px;
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 400;
    border-left: 2px solid transparent;
    border-radius: 7px;
    transition: all 0.22s ease;
}

.mobile-submenu a::before {
    content: '–';
    font-size: 12px;
    color: rgba(102,126,234,0.5);
    flex-shrink: 0;
}

.mobile-submenu a:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #a78bfa;
    border-left-color: #a78bfa;
    padding-left: 18px;
}

/* Section title (h6) inside mobile submenu */
.mobile-submenu-section {
    padding: 10px 14px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(167, 139, 250, 0.7);
    pointer-events: none;
    list-style: none;
}

/* h5 description header inside mobile submenu */
.mobile-submenu-header {
    padding: 8px 14px 6px;
    font-size: 11.5px;
    font-style: italic;
    color: rgba(255,255,255,0.3);
    line-height: 1.4;
    pointer-events: none;
    list-style: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 4px;
}

/* Mobile CTA Button */
.mobile-cta {
    border-bottom: none;
    padding: 6px 0 0;
}

.mobile-cta .cta-btn-primary {
    display: block;
    padding: 13px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.03em;
    transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
    border: none;
    cursor: pointer;
    width: 100%;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.35);
}

.mobile-cta .cta-btn-primary:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 8px 28px rgba(102, 126, 234, 0.5);
}

/* Mobile drawer footer */
.mobile-nav-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}

.mobile-nav-footer-links {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.mobile-nav-footer-links a {
    font-size: 12px;
    color: rgba(255,255,255,0.35);
    text-decoration: none;
    transition: color 0.2s ease;
}

.mobile-nav-footer-links a:hover {
    color: rgba(255,255,255,0.7);
}

/* Mobile Menu Overlay (legacy, now handled by ::after) */
.mobile-nav.active::before {
    content: none;
}

/* ===================================
   RESPONSIVE MOBILE MENU
   =================================== */

@media (max-width: 991px) {
    .mobile-nav-header {
        display: flex;
    }
    
    .mobile-nav-toggle {
        display: flex;
    }
    
    .navbar-nav-primary {
        display: none !important;
    }
    
    .mobile_menu {
        display: block;
    }
    
    .mobile-nav {
        max-width: 350px;
    }
}

/* ===================================
   STICKY HEADER ENHANCEMENT
   =================================== */

.main-header-area {
    transition: all 0.3s ease;
    background: white;
    position: relative;
    z-index: 100;
}

.sticky-active {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 9999;
    background-color: #000 !important;
}

/* ===================================
   NAVIGATION SUBMENUS FOR TABLET/MOBILE
   =================================== */

@media (max-width: 991px) {
    .mega-menu {
        position: static !important;
        opacity: 0;
        visibility: hidden;
        max-height: 0;
        overflow: hidden;
        transform: none;
        box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.05);
        padding: 0;
        transition: all 0.3s ease;
        background: #f9f9f9;
    }

    .nav-item.active .mega-menu {
        opacity: 1;
        visibility: visible;
        max-height: 1200px;
    }

    .mega-menu-content {
        padding: 20px;
        flex-direction: column;
        gap: 0;
        display: flex;
    }

    .mega-column {
        flex: none;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding: 15px 0;
        min-width: auto;
        display: block;
    }

    .mega-column:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

    .mega-column h5 {
        font-size: 11px;
        margin-bottom: 15px;
    }

    .mega-column h6.section-title {
        margin: 15px 0 10px 0;
        font-size: 12px;
    }

    .mega-menu-list {
        padding-left: 15px;
        list-style: none;
        display: block;
    }

    .mega-menu-list li {
        display: block;
    }

    .mega-menu-list a {
        padding: 8px 0;
        font-size: 12px;
        display: block;
        color: #666;
        text-decoration: none;
    }
}

/* ===================================
   NAVIGATION SUBMENU ARROWS
   =================================== */

@media (max-width: 991px) {
    .nav-item.dropdown > .nav-link::after {
        float: right;
        transform: rotate(0deg);
        transition: transform 0.3s ease;
    }

    .nav-item.active > .nav-link::after {
        transform: rotate(180deg);
    }
}

/* ===================================
   TABLET SPECIFIC STYLES
   =================================== */

@media (max-width: 1199px) and (min-width: 768px) {
    .mega-menu {
        min-width: 500px;
    }

    .mega-menu-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .mega-column:not(:first-child) {
        border-left: none;
        border-top: 1px solid #f0f0f0;
        padding-left: 0;
        padding-top: 30px;
    }

    .nav-link {
        padding: 12px 10px;
    }

    .cta-btn-primary,
    .cta-btn-secondary {
        padding: 8px 16px;
        font-size: 12px;
    }
}

/* ===================================
   ACCESSIBILITY IMPROVEMENTS
   =================================== */

.nav-link:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
    border-radius: 4px;
}

.mega-menu-list a:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: -2px;
}

/* ===================================
   HIGH CONTRAST MODE
   =================================== */

@media (prefers-contrast: more) {
    .nav-link {
        color: #000;
        border: 1px solid transparent;
    }

    .nav-link:hover {
        border-color: #007bff;
    }

    .mega-menu-list a:hover {
        text-decoration: underline;
    }

    .cta-btn-primary {
        border: 2px solid #007bff;
    }

    .cta-btn-secondary {
        border: 2px solid #333;
    }
}

/* ===================================
   REDUCED MOTION MODE
   =================================== */

@media (prefers-reduced-motion: reduce) {
    .mega-menu,
    .nav-link,
    .cta-btn-primary,
    .cta-btn-secondary,
    .mega-menu-list a {
        transition: none;
    }

    .nav-item:hover .mega-menu {
        transform: none;
    }
}

/* ===================================
   DARK MODE SUPPORT
   =================================== */

@media (prefers-color-scheme: dark) {
    .nav-link {
        color: #e0e0e0;
    }

    .nav-link:hover {
        background-color: #2a2a2a;
        color: #4da3ff;
    }

    .mega-menu {
        background: #1a1a1a;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    }

    .mega-column h5,
    .mega-column h6.section-title {
        color: #e0e0e0;
    }

    .mega-menu-list a {
        color: #b0b0b0;
    }

    .mega-menu-list a:hover {
        color: #4da3ff;
    }

    .mega-column:not(:first-child) {
        border-color: #333;
    }

    .mega-menu-content {
        border-top-color: #333;
    }

    .cta-btn-secondary {
        background-color: #2a2a2a;
        color: #e0e0e0;
        border-color: #444;
    }

    .cta-btn-secondary:hover {
        background-color: #333;
        border-color: #4da3ff;
        color: #4da3ff;
    }
}

/* ===================================
   SEARCH BOX IN NAVIGATION
   =================================== */

.nav-search-box {
    position: relative;
    padding: 0 15px;
    display: none;
}

.nav-search-box.active {
    display: block;
}

.nav-search-box input {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    width: 200px;
    font-size: 13px;
    transition: all 0.3s ease;
}

.nav-search-box input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* ===================================
   LOADING STATE FOR NAV ITEMS
   =================================== */

.nav-item.loading .nav-link::after {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===================================
   BREADCRUMB IN MEGA MENU
   =================================== */

.mega-menu-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    font-size: 12px;
    color: #999;
    padding: 0 40px;
}

.mega-menu-breadcrumb a {
    color: #007bff;
    text-decoration: none;
}

.mega-menu-breadcrumb a:hover {
    text-decoration: underline;
}

.mega-menu-breadcrumb span {
    color: #ddd;
}

/* ===================================
   FEATURED/PROMOTED ITEMS
   =================================== */

.mega-menu-featured {
    background: linear-gradient(135deg, #f5f7fa 0%, #f9fafb 100%);
    padding: 20px;
    border-radius: 6px;
    margin-top: 15px;
}

.mega-menu-featured-title {
    font-size: 12px;
    font-weight: 600;
    color: #007bff;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.mega-menu-featured-item {
    font-size: 13px;
    color: #333;
    margin: 8px 0;
}

.mega-menu-featured-item a {
    color: #007bff;
    text-decoration: none;
}

.mega-menu-featured-item a:hover {
    text-decoration: underline;
}

/* ===================================
   BADGE/LABEL IN NAVIGATION
   =================================== */

.nav-badge {
    display: inline-block;
    background: #007bff;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 5px;
}

.nav-badge.new {
    background: #28a745;
}

.nav-badge.beta {
    background: #ffc107;
    color: #333;
}

.nav-badge.pro {
    background: #6f42c1;
}

/* ===================================
   DESKTOP BYPASS - HIDE ON DESKTOP
   ===================================== */

@media (min-width: 992px) {
    .mobile-nav-header {
        display: none !important;
    }
    
    .mobile-nav-toggle {
        display: none !important;
    }
    
    .mobile_menu {
        display: none !important;
    }
    
    .mobile-nav {
        display: none !important;
    }
}
