/**
 * RocketWeaver Mobile Menu Styles
 * Hamburger menu styles
 */

/* ========================================
   Hamburger Button
======================================== */
.rw-mobile-menu-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    padding: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
    z-index: 10001;
    transition: all 0.3s ease;
}

.rw-mobile-menu-toggle:hover {
    opacity: 0.7;
}

.rw-mobile-menu-toggle:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

/* Hamburger icon lines */
.rw-hamburger-line {
    display: block;
    width: 28px;
    height: 3px;
    background-color: currentColor;
    border-radius: 2px;
    transition: all 0.3s ease;
    margin: 3px 0;
}

/* Icon when menu is open (X mark) */
.rw-mobile-menu-toggle.is-open .rw-hamburger-line:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.rw-mobile-menu-toggle.is-open .rw-hamburger-line:nth-child(2) {
    opacity: 0;
}

.rw-mobile-menu-toggle.is-open .rw-hamburger-line:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* ========================================
   Overlay (Background)
======================================== */
.rw-mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 9999;
}

.rw-mobile-menu-overlay.is-open {
    background-color: rgba(0, 0, 0, 0.5);
    visibility: visible;
    opacity: 1;
}

/* ========================================
   Menu Content
======================================== */
.rw-mobile-menu-content {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    max-width: 85%;
    height: 100%;
    background-color: #ffffff;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    z-index: 10000;
    padding: 60px 20px 20px;
}

/* Right-aligned menu */
.rw-mobile-menu-content.rw-menu-right {
    left: auto;
    right: 0;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
}

.rw-mobile-menu-overlay.is-open .rw-mobile-menu-content {
    transform: translateX(0);
}

/* Close button for right-aligned menu */
.rw-mobile-menu-content.rw-menu-right .rw-mobile-menu-close {
    right: auto;
    left: 10px;
}

/* Close button */
.rw-mobile-menu-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    color: #333;
    transition: color 0.2s ease;
}

.rw-mobile-menu-close:hover {
    color: #4f46e5;
}

.rw-mobile-menu-close:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

/* ========================================
   Menu List
======================================== */
.rw-mobile-menu-content .menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rw-mobile-menu-content .menu-item {
    margin: 0;
    border-bottom: 1px solid #e5e7eb;
}

.rw-mobile-menu-content .menu-item a {
    display: block;
    padding: 15px 10px;
    color: #333;
    text-decoration: none;
    font-size: 16px;
    transition: all 0.2s ease;
}

.rw-mobile-menu-content .menu-item a:hover,
.rw-mobile-menu-content .menu-item a:focus {
    color: #4f46e5;
    background-color: #f3f4f6;
    padding-left: 15px;
}

.rw-mobile-menu-content .current-menu-item a {
    color: #4f46e5;
    font-weight: 600;
}

/* Submenu */
.rw-mobile-menu-content .sub-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    background-color: #f9fafb;
}

.rw-mobile-menu-content .sub-menu .menu-item a {
    padding-left: 30px;
    font-size: 14px;
}

.rw-mobile-menu-content .sub-menu .menu-item a:hover {
    padding-left: 35px;
}

/* ========================================
   Body Scroll Control
======================================== */
body.rw-mobile-menu-open {
    overflow: hidden;
}

/* ========================================
   Responsive
======================================== */
@media (min-width: 768px) {
    /* Hide hamburger menu on tablet and above if needed */
    .rw-wp-menu.rw-menu-mobile {
        /* Hide if necessary */
    }
}

/* ========================================
   Builder Preview
======================================== */
/* Relative position in builder (contained within canvas) */
.rw-mobile-menu-overlay.rw-builder-preview {
    position: absolute !important; /* absolute in builder */
}

.rw-mobile-menu-overlay.rw-builder-preview .rw-mobile-menu-content {
    position: absolute !important; /* absolute in builder */
}

/* Fixed position on frontend (fullscreen) */
.rw-mobile-menu-overlay:not(.rw-builder-preview) {
    position: fixed !important; /* fixed on frontend */
}

.rw-mobile-menu-overlay:not(.rw-builder-preview) .rw-mobile-menu-content {
    position: fixed !important; /* fixed on frontend */
}

/* ========================================
   Accessibility
======================================== */
.rw-mobile-menu-toggle:focus-visible,
.rw-mobile-menu-close:focus-visible {
    outline: 3px solid #4f46e5;
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .rw-hamburger-line {
        height: 4px;
    }

    .rw-mobile-menu-content {
        border: 2px solid currentColor;
    }
}

/* Reduced motion mode */
@media (prefers-reduced-motion: reduce) {
    .rw-mobile-menu-toggle,
    .rw-hamburger-line,
    .rw-mobile-menu-overlay,
    .rw-mobile-menu-content,
    .rw-mobile-menu-content .menu-item a {
        transition: none;
    }
}
