/**
 * Hamburger Menu Styles - Modern Version
 * Mobile menu for screens under 1024px with improved animations and accessibility
 */

/* Hamburger Icon - Modern Design */
.hamburger-icon {
    display: none;
    position: relative;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    z-index: 1000;
    border-radius: var(--border-radius-sm);
    transition: background-color var(--transition-fast);
    margin-left: var(--spacing-sm);
}

.hamburger-icon:hover {
    background-color: var(--color-background-light);
}

.hamburger-icon:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--color-primary-light);
}

/* Modern hamburger icon with better spacing and proportions */
.hamburger-icon span {
    display: block;
    position: absolute;
    height: 2px;
    width: 22px;
    background-color: var(--color-text);
    border-radius: 4px;
    opacity: 1;
    left: 4px;
    transform: rotate(0deg);
    transition: transform 0.25s ease-in-out, 
                opacity 0.25s ease-in-out,
                width 0.25s ease-in-out,
                left 0.25s ease-in-out,
                background-color 0.25s ease-in-out;
}

/* Position the three lines with better spacing */
.hamburger-icon span:nth-child(1) {
    top: 8px;
}

.hamburger-icon span:nth-child(2) {
    top: 14px;
    width: 16px; /* Shorter middle line for modern look */
    left: 7px; /* Center the shorter line */
}

.hamburger-icon span:nth-child(3) {
    top: 20px;
}

/* Hover effect for a more interactive feel */
.hamburger-icon:hover span {
    background-color: var(--color-primary);
}

.hamburger-icon:hover span:nth-child(2) {
    width: 22px; /* Expand middle line on hover */
    left: 4px;
}

/* Mobile Menu Container */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 900;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 400px;
    height: 100%;
    background-color: var(--color-background);
    z-index: 950;
    overflow-y: auto;
    transition: right 0.4s ease;
    padding: 60px 20px 20px;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
}

html[dir="rtl"] .mobile-menu {
    right: auto;
    left: -100%;
    transition: left 0.4s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

/* Active States - Improved animation for the hamburger icon */
.mobile-menu-active .mobile-menu-overlay {
    opacity: 1;
    visibility: visible;
}

.mobile-menu-active .mobile-menu {
    right: 0;
}

html[dir="rtl"] .mobile-menu-active .mobile-menu {
    left: 0;
    right: auto;
}

/* Smooth X animation for the hamburger icon when active */
.mobile-menu-active .hamburger-icon span:nth-child(1) {
    top: 14px;
    transform: rotate(45deg);
    width: 22px;
}

.mobile-menu-active .hamburger-icon span:nth-child(2) {
    opacity: 0;
    width: 0;
}

.mobile-menu-active .hamburger-icon span:nth-child(3) {
    top: 14px;
    transform: rotate(-45deg);
    width: 22px;
}

/* Prevent body scrolling when menu is open */
body.mobile-menu-active {
    overflow: hidden;
}

/* Mobile Menu Content */
.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.mobile-menu-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--color-text);
    z-index: 1000;
}

html[dir="rtl"] .mobile-menu-close {
    right: auto;
    left: 20px;
}

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

.mobile-nav-item {
    margin-bottom: 15px;
}

.mobile-nav-link {
    display: block;
    font-size: 18px;
    color: var(--color-text);
    text-decoration: none;
    padding: 10px 0;
    font-weight: 500;
    transition: color 0.3s ease;
}

.mobile-nav-link:hover,
.mobile-nav-link:focus {
    color: var(--color-primary);
}

.mobile-auth-buttons {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-auth-buttons .btn {
    width: 100%;
    text-align: center;
}

/* Media Queries */
@media (max-width: 1023px) {
    .hamburger-icon {
        display: block;
    }
    
    .main-nav .nav-menu {
        display: none;
    }
}

@media (min-width: 1024px) {
    .mobile-menu-overlay,
    .mobile-menu {
        display: none;
    }
}