/* Mobile Navigation Block Styles */

.mobile-navigation-block {
    position: relative;
}

/* Toggle Button */
.mobile-nav-toggle {
    display: none;
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: currentColor;
    z-index: 1;
}

.mobile-nav-toggle-icon {
    display: block;
    width: 24px;
    height: 18px;
    position: relative;
}

.mobile-nav-toggle-icon span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: currentColor;
    position: absolute;
    left: 0;
}

.mobile-nav-toggle-icon span:nth-child(1) {
    top: 0;
}

.mobile-nav-toggle-icon span:nth-child(2) {
    top: 50%;
    transform: translateY(-50%);
}

.mobile-nav-toggle-icon span:nth-child(3) {
    bottom: 0;
}

/* Active state - X icon */
.mobile-nav-toggle.active .mobile-nav-toggle-icon span:nth-child(1) {
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}

.mobile-nav-toggle.active .mobile-nav-toggle-icon span:nth-child(2) {
    opacity: 0;
}

.mobile-nav-toggle.active .mobile-nav-toggle-icon span:nth-child(3) {
    bottom: 50%;
    transform: translateY(50%) rotate(-45deg);
}

/* Navigation Wrapper */
.mobile-nav-wrapper {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100vw;
    height: 88vh;
    max-height: 100vh;
    z-index: 99999999;
    display: flex;
    flex-direction: column;
    background-color: var(--wp--preset--color--background-dark);
    overflow: hidden;
    transition: right 0.3s ease !important;
    transform: none !important;
}

/* Prevent header transform from affecting navigation */
header.is-hidden .mobile-nav-wrapper {
    transform: none !important;
}

/* Admin bar adjustment */

.mobile-navigation-block {
  transition: none !important;
}


.mobile-nav-wrapper.active {
    right: 0;
}

/* Navigation Header */
.mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--wp--preset--color--background-dark);
    padding: 15px 20px;
    position: relative;
    z-index: 9999999;
    gap: 12px;
    flex-shrink: 0;
}

.mobile-nav-title {
    margin: 0;
    flex: 1;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.mobile-nav-title .m-logo {
    max-height: 40px;
    width: auto;
    display: block;
}

/* Back Button */
.mobile-nav-back-button {
    background: transparent;
    border: none;
    padding: 16px 20px;
    cursor: pointer;
    color: white;
    display: none;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    font-size: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    background-color: var(--wp--preset--color--background-dark);
    z-index: 5;
}

.mobile-nav-back-button svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.mobile-nav-back-button:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.mobile-nav-close {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-nav-close svg {
    width: 24px;
    height: 24px;
}

/* Navigation Content */
.mobile-nav-content {
    padding: 0;
    position: relative;
    flex: 1;
    overflow: hidden;
    min-height: 0; /* Important for flex children */
    display: flex;
    flex-direction: column;
}

/* Navigation Panels */
.mobile-nav-panel {
    position: absolute;
    top: 52px;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background-color: var(--wp--preset--color--background-dark);
}

/* Main panel visible by default */
.mobile-nav-main {
    display: block;
}

/* Navigation Lists */
.mobile-nav-list,
.mobile-nav-sublist {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-nav-item {

}

/* Button styling */
.mobile-nav-button {
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

/* Button styling (parent items) */
.mobile-nav-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
    font-size: 1rem;
    color: white;
}

.mobile-nav-button:hover,
.mobile-nav-button:focus {
   
    outline: none;
}

/* Links styling */
.mobile-nav-link {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    color: white;
       text-decoration: underline;
    font-size: 1rem;
}

.mobile-nav-link:hover,
.mobile-nav-link:focus {
 
    outline: none;
}

.mobile-nav-text {
    flex: 1;
 
}

/* Arrow icon */
.mobile-nav-arrow {
    flex-shrink: 0;
    margin-left: 12px;
    color: #999;
}

/* Rotate arrow when submenu is open */
.mobile-nav-button.active .mobile-nav-arrow {
    transform: rotate(90deg);
}

/* Parent Link Style */
.mobile-nav-parent-link .mobile-nav-link {
    font-weight: 600;
    color: var(--wp--preset--color--primary, #0073e6);
}


/* Submenu panels hidden by default */
.mobile-nav-submenu {
    display: none;
}

/* Remove nested indentation since we're using drill-down */
.mobile-nav-sublist .mobile-nav-button,
.mobile-nav-sublist .mobile-nav-link {
    padding-left: 20px;
}


/* Body No Scroll */
body.mobile-nav-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* Responsive - Show mobile nav only on mobile */
@media (max-width: 1024px) {
    .mobile-nav-toggle {
        display: block;
    }
    
    /* Hide default WordPress navigation on mobile when this block is present */
    .mobile-navigation-block ~ .wp-block-navigation {
        display: none;
    }
}

/* Desktop - Hide mobile navigation */
@media (min-width: 1025px) {
    .mobile-navigation-block {
        display: none;
    }
    
    /* Also hide the wrapper which is moved to body */
    .mobile-nav-wrapper {
        display: none !important;
    }
}

/* Additional Mobile Optimizations */
@media (max-width: 400px) {
    .mobile-nav-wrapper {
        max-width: 100%;
    }
}

/* Focus styles for accessibility */
.mobile-nav-button:focus-visible,
.mobile-nav-link:focus-visible,
.mobile-nav-close:focus-visible,
.mobile-nav-toggle:focus-visible,
.mobile-nav-back-button:focus-visible {
    outline: 2px solid var(--wp--preset--color--primary, #0073e6);
    outline-offset: 2px;
}

/* Prevent text selection on button */
.mobile-nav-button {
    -webkit-tap-highlight-color: transparent;
}

/* Smooth scrolling */
.mobile-nav-wrapper {
    scroll-behavior: smooth;
}

/* Mobile Nav Footer */
.mobile-nav-footer {
    position: relative;
    background-color: var(--wp--preset--color--background-dark);
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

/* Footer Links Container */
.mobile-nav-footer-links {
    display: flex;
    justify-content: space-around;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Footer Link Items */
.mobile-nav-footer-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    color: white;
    text-decoration: none;
    font-size: 0.875rem;
    padding: 5px;
    position: relative;
    transition: opacity 0.2s ease;
}

.mobile-nav-footer-link:hover,
.mobile-nav-footer-link:focus {
    opacity: 0.8;
    color: white;
    text-decoration: none;
    outline: none;
}

.mobile-nav-footer-link svg {
    width: 20px;
    height: 20px;
}

/* Cart Count Badge */
.mobile-nav-cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--wp--preset--color--primary, #0073e6);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Member Button */
.mobile-nav-member-button {
    display: block;
    width: 100%;
    padding: 12px 20px;
        background-color: var(--wp--preset--color--light) !important;
       color: var(--wp--preset--color--darktext);
    text-align: center;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 60px;
    transition: background-color 0.2s ease;
}

.mobile-nav-member-button:hover,
.mobile-nav-member-button:focus {
        background-color: var(--wp--preset--color--light) !important;
        color: var(--wp--preset--color--darktext);
    text-decoration: none;
    outline: none;
}

/* Dark Mode Support (if theme has dark mode) */
@media (prefers-color-scheme: dark) {
    .wp-block-site-editor-theme-default-palette-dark .mobile-nav-wrapper,
    body.dark-mode .mobile-nav-wrapper {
        color: #fff;
    }
    
    .wp-block-site-editor-theme-default-palette-dark .mobile-nav-header,
    body.dark-mode .mobile-nav-header {
        border-bottom-color: white;
    }
    
    .wp-block-site-editor-theme-default-palette-dark .mobile-nav-item,
    body.dark-mode .mobile-nav-item {
        border-bottom-color: white;
    }
    
    .wp-block-site-editor-theme-default-palette-dark .mobile-nav-button,
    body.dark-mode .mobile-nav-button,
    .wp-block-site-editor-theme-default-palette-dark .mobile-nav-link,
    body.dark-mode .mobile-nav-link,
    .wp-block-site-editor-theme-default-palette-dark .mobile-nav-close,
    body.dark-mode .mobile-nav-close {
        color: #fff;
    }
    
    .wp-block-site-editor-theme-default-palette-dark .mobile-nav-button:hover,
    body.dark-mode .mobile-nav-button:hover,
    .wp-block-site-editor-theme-default-palette-dark .mobile-nav-link:hover,
    body.dark-mode .mobile-nav-link:hover {
        background-color: inherit;
    }
    
    .wp-block-site-editor-theme-default-palette-dark .mobile-nav-panel,
    body.dark-mode .mobile-nav-panel {
        background-color: #1a1a1a;
    }
}