/**
 * CashFlow Mobile Menu Styles
 * תפריט נייד מקצועי עם אנימציות
 */

/* Desktop Menu */
.desktop-menu {
    display: flex;
    gap: 0.5rem;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 10px;
    transition: background 0.3s ease;
    pointer-events: auto; /* מוודא שהכפתור לחיץ */
    touch-action: manipulation; /* שיפור למובייל */
}

.mobile-menu-btn:hover {
    background: rgba(139, 92, 246, 0.1);
}

.mobile-menu-btn:focus {
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}

.hamburger {
    width: 30px;
    height: 24px;
    position: relative;
    transform: rotate(0deg);
    transition: 0.2s ease-in-out;
    margin: auto;
}

.hamburger span {
    display: block;
    position: absolute;
    height: 3px;
    width: 100%;
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    border-radius: 3px;
    opacity: 1;
    right: 0;
    transform: rotate(0deg);
    transition: 0.15s ease-in-out;
}

.hamburger span:nth-child(1) {
    top: 0px;
}

.hamburger span:nth-child(2),
.hamburger span:nth-child(3) {
    top: 10px;
}

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

/* Hamburger Animation - Active State */
.mobile-menu-btn.active .hamburger span:nth-child(1) {
    top: 10px;
    width: 0%;
    right: 50%;
}

.mobile-menu-btn.active .hamburger span:nth-child(2) {
    transform: rotate(45deg);
}

.mobile-menu-btn.active .hamburger span:nth-child(3) {
    transform: rotate(-45deg);
}

.mobile-menu-btn.active .hamburger span:nth-child(4) {
    top: 10px;
    width: 0%;
    right: 50%;
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none; /* חשוב! לא לחסום קליקים כשהוא סגור */
}

.mobile-menu-overlay.active {
    opacity: 1;
    pointer-events: auto; /* מאפשר קליקים רק כשהוא פתוח */
}

/* Mobile Menu */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    right: -100%;
    width: min(320px, 85vw);
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    border-left: 2px solid rgba(139, 92, 246, 0.5);
    z-index: 1000;
    padding: 1.5rem;
    overflow-y: auto;
    transition: right 0.25s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: -10px 0 40px rgba(139, 92, 246, 0.3);
    pointer-events: auto; /* תמיד מאפשר קליקים על התפריט עצמו */
}

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

/* Mobile Menu Header */
.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(139, 92, 246, 0.3);
}

.mobile-menu-title {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.mobile-menu-close {
    width: 45px;
    height: 45px;
    border: none;
    background: rgba(239, 68, 68, 0.2);
    border-radius: 12px;
    color: #f87171;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.mobile-menu-close:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: rotate(90deg);
}

.mobile-menu-close:focus {
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}

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

.mobile-menu .nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.2rem 1.5rem !important;
    margin-bottom: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: all 0.2s ease;
    text-align: center;
    font-size: 1.15rem;
    font-weight: 500;
    text-decoration: none;
    color: white;
    position: relative;
    overflow: hidden;
}

.mobile-menu .nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    transform: translateX(-4px);
    transition: transform 0.2s ease;
}

.mobile-menu .nav-link:hover::before,
.mobile-menu .nav-link:focus::before {
    transform: translateX(0);
}

.mobile-menu .nav-link:hover,
.mobile-menu .nav-link:focus {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.5);
    transform: scale(1.02);
}

.mobile-menu .nav-link:active {
    transform: scale(0.98);
}

.mobile-menu .nav-link:focus {
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}

.mobile-menu .nav-link::after {
    display: none;
}

/* Scrollbar for mobile menu */
.mobile-menu::-webkit-scrollbar {
    width: 6px;
}

.mobile-menu::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.mobile-menu::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.5);
    border-radius: 3px;
}

.mobile-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.7);
}

/* Responsive */
@media (max-width: 992px) {
    .desktop-menu {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    .mobile-menu,
    .mobile-menu-overlay {
        display: block;
    }
}

/* Animation for menu items */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.mobile-menu.active .nav-link {
    animation: slideInRight 0.25s ease forwards;
}

.mobile-menu.active .nav-link:nth-child(1) {
    animation-delay: 0.05s;
}

.mobile-menu.active .nav-link:nth-child(2) {
    animation-delay: 0.08s;
}

.mobile-menu.active .nav-link:nth-child(3) {
    animation-delay: 0.11s;
}

.mobile-menu.active .nav-link:nth-child(4) {
    animation-delay: 0.14s;
}

.mobile-menu.active .nav-link:nth-child(5) {
    animation-delay: 0.17s;
}

.mobile-menu.active .nav-link:nth-child(6) {
    animation-delay: 0.2s;
}

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

/* Tablet adjustments */
@media (min-width: 576px) and (max-width: 992px) {
    .mobile-menu {
        width: 350px;
    }

    .mobile-menu .nav-link {
        font-size: 1.15rem;
        padding: 1.3rem 1.5rem !important;
    }
}

/* Small mobile */
@media (max-width: 375px) {
    .mobile-menu {
        width: 90vw;
    }

    .mobile-menu .nav-link {
        font-size: 1rem;
        padding: 1rem 1.2rem !important;
    }
}

/* Print */
@media print {
    .mobile-menu,
    .mobile-menu-overlay,
    .mobile-menu-btn {
        display: none !important;
    }

    .desktop-menu {
        display: flex !important;
    }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .mobile-menu,
    .mobile-menu-overlay,
    .hamburger span,
    .mobile-menu .nav-link {
        transition: none;
        animation: none;
    }
}

