/**
 * Yasa Mobile Menu Enhancer for Oxygen Builder
 * Main CSS file
 */

/* Container and overlay */
.yasa-mobile-menu-container {
    position: relative;
}

.yasa-mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    opacity: 0.7;
    z-index: 999998;
    display: none;
}

/* Mobile menu wrapper */
.yasa-mobile-menu-wrapper {
    position: fixed;
    top: 0;
    right: -320px; /* Default width, will be overridden by JS */
    height: 100%;
    width: 320px; /* Default width, will be overridden by JS */
    z-index: 999999;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transition: transform 0.3s ease;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
}

/* When menu is open */
body.yasa-mobile-menu-open {
    overflow: hidden;
}

body.yasa-mobile-menu-open .yasa-mobile-menu-wrapper {
    transform: translateX(-320px); /* Default width, will be overridden by JS */
}

/* Menu header */
.yasa-mobile-menu-header {
    display: flex;
    justify-content: flex-end;
    padding: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.yasa-mobile-menu-close {
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 5px 10px;
}

/* Menu styles */
.yasa-mobile-menu {
    padding: 15px 0;
}

.yasa-mobile-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.yasa-mobile-menu li {
    position: relative;
}

.yasa-mobile-menu a {
    display: block;
    padding: 12px 20px;
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background-color 0.2s ease;
}

.yasa-mobile-menu a:hover,
.yasa-mobile-menu a:focus {
    background-color: rgba(0, 0, 0, 0.03);
}

/* Sub-menu styles */
.yasa-mobile-menu ul ul {
    display: none; /* Hide submenus by default */
    background-color: rgba(0, 0, 0, 0.02);
}

.yasa-mobile-menu ul ul a {
    padding-left: 40px;
}

.yasa-mobile-menu ul ul ul a {
    padding-left: 60px;
}

/* Sub-menu toggle button */
.yasa-submenu-toggle {
    position: absolute;
    right: 0;
    top: 0;
    width: 50px;
    height: 46px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    /* Increase touch target size for mobile */
    min-height: 50px;
    min-width: 50px;
}

/* Down arrow icon for submenu toggle */
.yasa-submenu-icon {
    display: block;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #01e7ff; /* Arrow color */
    transition: transform 0.3s ease;
}

/* Rotate arrow when submenu is open */
.yasa-submenu-toggle.active .yasa-submenu-icon {
    transform: rotate(180deg);
}

/* Add a background to make the toggle more visible */
.yasa-submenu-toggle:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    z-index: -1;
}

.yasa-submenu-toggle:hover:before {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Toggle button styles */
.yasa-mobile-toggle {
    display: none;
    width: 40px;
    height: 40px;
    position: relative;
    cursor: pointer;
    z-index: 999997;
}

/* Only show toggle on mobile */
@media (max-width: 992px) {
    .yasa-mobile-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
}

/* Hamburger style */
.yasa-toggle-hamburger span {
    display: block;
    width: 30px;
    height: 3px;
    margin: 3px 0;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.yasa-toggle-hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.yasa-toggle-hamburger.active span:nth-child(2) {
    opacity: 0;
}

.yasa-toggle-hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Arrow style */
.yasa-toggle-arrow span {
    display: block;
    width: 20px;
    height: 3px;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.yasa-toggle-arrow span:nth-child(1) {
    transform: rotate(45deg);
}

.yasa-toggle-arrow span:nth-child(2) {
    transform: rotate(-45deg);
    margin-top: -3px;
}

.yasa-toggle-arrow.active span:nth-child(1) {
    transform: rotate(-45deg);
}

.yasa-toggle-arrow.active span:nth-child(2) {
    transform: rotate(45deg);
}

/* Dots style */
.yasa-toggle-dots span {
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin: 3px 0;
    transition: all 0.3s ease;
}

.yasa-toggle-dots.active span {
    width: 6px;
    height: 6px;
}

/* Animation classes */
.yasa-fade-in {
    animation: yasaFadeIn 0.3s ease forwards;
}

.yasa-fade-out {
    animation: yasaFadeOut 0.3s ease forwards;
}

.yasa-slide-in {
    animation: yasaSlideIn 0.3s ease forwards;
}

.yasa-slide-out {
    animation: yasaSlideOut 0.3s ease forwards;
}

/* Animations */
@keyframes yasaFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes yasaFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes yasaSlideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes yasaSlideOut {
    from { transform: translateX(0); }
    to { transform: translateX(100%); }
}

/* Accessibility */
.yasa-screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

/* Touch-friendly adjustments */
@media (pointer: coarse) {
    .yasa-mobile-menu a,
    .yasa-mobile-menu-close {
        min-height: 44px; /* Minimum touch target size */
    }
    
    /* Make submenu toggle even larger on touch devices */
    .yasa-submenu-toggle {
        min-height: 56px;
        min-width: 56px;
    }
    
    /* Increase arrow size for better visibility */
    .yasa-submenu-icon {
        border-left-width: 10px;
        border-right-width: 10px;
        border-top-width: 10px;
    }
    
    /* Increase background size */
    .yasa-submenu-toggle:before {
        width: 42px;
        height: 42px;
    }
}