/**
 * Mobile Nav Bar Section Styles v2.0
 * Complete mobile navigation styling
 * 
 * @package starter Theme
 * @version 2.0.0
 */

/* ============================================
   BASE & RESET
   ============================================ */
.mobile-nav-bar-section {
    position: relative;
    z-index: 9999;
}

.mobile-nav-bar-section *,
.mobile-nav-bar-section *::before,
.mobile-nav-bar-section *::after {
    box-sizing: border-box;
}

/* ============================================
   DEVICE VISIBILITY
   ============================================ */
.mnav-show-mobile {
    display: none;
}

.mnav-show-tablet {
    display: none;
}

.mnav-show-all {
    display: block;
}

/* Mobile only */
@media (max-width: 767px) {
    .mnav-show-mobile {
        display: block;
    }
}

/* Mobile + Tablet */
@media (max-width: 1024px) {
    .mnav-show-tablet {
        display: block;
    }
}

/* ============================================
   TRIGGER BUTTON
   ============================================ */
.mnav-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 10001;
}

.mnav-trigger:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.mnav-trigger-open,
.mnav-trigger-close {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.mnav-trigger-close {
    display: none;
}

.mnav-trigger.active .mnav-trigger-open {
    display: none;
}

.mnav-trigger.active .mnav-trigger-close {
    display: flex;
}

/* ============================================
   OVERLAY
   ============================================ */
.mnav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    /* NO TRANSITION until page loads */
    transition: none;
    z-index: 10000;
    pointer-events: none; /* Don't block clicks when hidden */
    contain: strict; /* Performance optimization */
}

/* Enable transitions after initialization */
body:not(.page-loading) .mnav-overlay {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mnav-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto; /* Allow clicks when active */
}

/* ============================================
   SIDEBAR
   ============================================ */
.mnav-sidebar {
    position: fixed;
    top: 0;
    height: 100%;
    max-width: 100%;
    background-color: #ffffff;
    transform: translateX(-100%);
    /* NUCLEAR OPTION: No display until JS loads */
    display: none;
    z-index: 10001;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    
    /* Performance optimizations */
    will-change: transform;
    contain: layout style paint;
}

.mnav-sidebar-left {
    left: 0;
    transform: translateX(-100%);
}

.mnav-sidebar-right {
    right: 0;
    left: auto;
    transform: translateX(100%);
}

/* JS-initialized: Show sidebar with transitions enabled */
.mnav-sidebar[data-initialized="true"] {
    display: block;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mnav-sidebar.active {
    transform: translateX(0);
}

.mnav-sidebar-inner {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

/* ============================================
   HEADER
   ============================================ */
.mnav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.mnav-logo {
    display: block;
    flex-shrink: 0;
}

.mnav-logo img {
    display: block;
    height: auto;
    max-height: 50px;
}

/* Header Actions */
.mnav-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.mnav-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    line-height: 1;
}

.mnav-header-icon:hover {
    opacity: 0.8;
}

.mnav-header-icon i,
.mnav-header-icon svg {
    display: block;
}

/* Close Button */
.mnav-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin-left: auto;
}

.mnav-close:hover {
    background: #e0e0e0;
}

.mnav-close i,
.mnav-close svg {
    width: 16px;
    height: 16px;
}

/* ============================================
   LANGUAGE SWITCHER
   ============================================ */
.mnav-language-switcher {
    position: relative;
}

.mnav-language-trigger {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.mnav-lang-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.mnav-lang-flag img,
.mnav-lang-flag svg {
    display: block;
}

.mnav-lang-arrow {
    transition: transform 0.3s ease;
}

.mnav-language-switcher.active .mnav-lang-arrow {
    transform: rotate(180deg);
}

.mnav-language-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 140px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 100;
    overflow: hidden;
}

.mnav-language-switcher.active .mnav-language-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mnav-lang-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s ease;
}

.mnav-lang-item:hover {
    background: #f5f5f5;
}

.mnav-lang-item.active {
    background: #f0f0f0;
    font-weight: 500;
}

.mnav-lang-name {
    font-size: 14px;
}

/* ============================================
   INLINE SEARCH
   ============================================ */
.mnav-search-inline {
    margin-bottom: 15px;
}

.mnav-search-form-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #f5f5f5;
    border-radius: 8px;
}

.mnav-search-icon-inline {
    display: flex;
    align-items: center;
    color: #888;
}

.mnav-search-icon-inline i,
.mnav-search-icon-inline svg {
    width: 18px;
    height: 18px;
}

.mnav-search-input-inline {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 15px;
    outline: none;
    padding: 0;
}

.mnav-search-input-inline::placeholder {
    color: #999;
}

/* ============================================
   NAVIGATION / MENU
   ============================================ */
.mnav-nav {
    flex: 1;
    overflow-y: auto;
}

.mnav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mnav-menu>li {
    border-bottom: 1px solid #eee;
}

.mnav-menu>li:last-child {
    border-bottom: none;
}

.mnav-menu>li>a {
    display: block;
    padding: 12px 0;
    text-decoration: none;
    color: inherit;
    font-weight: 500;
    transition: color 0.3s ease;
}

.mnav-menu-item-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.mnav-menu-item-wrapper>a {
    flex: 1;
    display: block;
    padding: 12px 0;
    text-decoration: none;
    color: inherit;
    font-weight: 500;
    transition: color 0.3s ease;
}

/* Dropdown Toggle Button */
.mnav-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: #f5f5f5;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    padding: 0;
}

.mnav-dropdown-toggle:hover {
    background: #e8e8e8;
}

.mnav-dropdown-toggle:focus {
    outline: 2px solid #4a6fa5;
    outline-offset: 2px;
}

.mnav-dropdown-toggle svg {
    transition: transform 0.3s ease;
}

.mnav-dropdown-toggle.active {
    background: rgba(74, 111, 165, 0.1);
}

.mnav-dropdown-toggle.active svg {
    transform: rotate(180deg);
}

/* Submenu */
.mnav-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    padding-left: 15px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.mnav-submenu.active {
    max-height: 1000px;
    padding-top: 5px;
    padding-bottom: 10px;
}

.mnav-submenu li {
    margin-bottom: 5px;
}

.mnav-submenu li:last-child {
    margin-bottom: 0;
}

.mnav-submenu a {
    display: block;
    padding: 8px 12px;
    text-decoration: none;
    color: #555;
    font-size: 14px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.mnav-submenu a:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #4a6fa5;
}

/* Nested Submenu */
.mnav-submenu .mnav-submenu {
    padding-left: 15px;
}

/* No Menu Message */
.mnav-no-menu {
    padding: 20px 0;
    text-align: center;
    color: #888;
    font-size: 14px;
}

/* ============================================
   FOOTER
   ============================================ */
.mnav-footer {
    margin-top: auto;
    padding: 20px;
    margin: 15px -20px -20px -20px;
    border-top: 1px solid #eee;
}

.mnav-footer-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Contact Info */
.mnav-contact-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.mnav-contact-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    font-size: 14px;
    transition: color 0.3s ease;
}

.mnav-contact-item:hover {
    color: #4a6fa5;
}

.mnav-contact-item svg {
    flex-shrink: 0;
    margin-top: 2px;
}

/* Social Links */
.mnav-social {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.mnav-social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

.mnav-social-link:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.mnav-social-link i,
.mnav-social-link svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   SEARCH OVERLAY
   ============================================ */
.mnav-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.98);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10002;
}

.mnav-search-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mnav-search-overlay-inner {
    width: 100%;
    max-width: 600px;
    padding: 20px;
    text-align: center;
}

.mnav-search-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mnav-search-close:hover {
    background: #e0e0e0;
    transform: rotate(90deg);
}

.mnav-search-close i,
.mnav-search-close svg {
    width: 20px;
    height: 20px;
}

.mnav-search-form {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 2px solid #ddd;
    transition: border-color 0.3s ease;
}

.mnav-search-form:focus-within {
    border-bottom-color: #4a6fa5;
}

.mnav-search-icon {
    display: flex;
    align-items: center;
    color: #888;
}

.mnav-search-icon i,
.mnav-search-icon svg {
    width: 24px;
    height: 24px;
}

.mnav-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 20px;
    outline: none;
    padding: 0;
}

.mnav-search-input::placeholder {
    color: #999;
}

/* ============================================
   BODY LOCK (prevent scroll when open)
   ============================================ */
body.mnav-body-locked {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 480px) {
    .mnav-sidebar {
        width: 100% !important;
        max-width: 100%;
    }

    .mnav-header {
        flex-wrap: wrap;
    }

    .mnav-header-actions {
        order: 1;
        width: auto;
    }

    .mnav-search-input {
        font-size: 18px;
    }
}

/* ============================================
   ELEMENTOR EDITOR STYLES
   ============================================ */
.elementor-editor-active .mnav-sidebar {
    position: absolute;
    transform: translateX(0);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.elementor-editor-active .mnav-overlay {
    display: none;
}

.elementor-editor-active .mnav-search-overlay {
    position: absolute;
    display: none;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {

    .mnav-sidebar,
    .mnav-overlay,
    .mnav-search-overlay,
    .mnav-dropdown-toggle svg,
    .mnav-submenu,
    .mnav-language-dropdown {
        transition: none;
    }
}

/* Focus visible for keyboard navigation */
.mnav-trigger:focus-visible,
.mnav-close:focus-visible,
.mnav-dropdown-toggle:focus-visible,
.mnav-header-icon:focus-visible,
.mnav-search-close:focus-visible {
    outline: 2px solid #4a6fa5;
    outline-offset: 2px;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .mobile-nav-bar-section {
        display: none !important;
    }
}