/**
 * Full-Screen Mobile Navigation Menu
 * PETGAS - Mobile Responsive Optimization
 * Task 2.2: Full-screen mobile navigation with iOS-style animations
 */

/* ===== MOBILE MENU BASE STYLES ===== */

.mobile-menu-toggle {
    display: none; /* Hidden by default, shown in mobile */
    position: relative;
    width: 44px;
    height: 44px;
    padding: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1200;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

.menu-icon {
    position: relative;
    width: 24px;
    height: 18px;
}

.menu-line {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: #fff;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.menu-line:nth-child(1) { top: 0; }
.menu-line:nth-child(2) { top: 8px; }
.menu-line:nth-child(3) { bottom: 0; }

.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    z-index: 1100;
    background: var(--primary-color);
    transform: translateX(100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Performance optimizations */
    will-change: transform, opacity;
    contain: layout style;
    overflow-y: auto;
}

/* ===== MENU ANIMATION STATES ===== */

.mobile-menu[aria-hidden="false"],
.mobile-menu.menu-open {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
}

.mobile-menu.menu-closing {
    transform: translateX(100%);
    opacity: 0;
}

/* ===== MOBILE MENU OVERLAY ===== */

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1099;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none; /* Allow clicks to pass through when hidden */
}

.mobile-menu-overlay.overlay-active {
    opacity: 1;
    visibility: visible;
    pointer-events: none; /* Always allow clicks to pass through */
}

/* ===== MOBILE MENU HEADER ===== */

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.close-menu {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.close-menu:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    color: #ffffff;
    transform: scale(1.1) rotate(90deg);
}

.close-menu:active {
    transform: scale(0.95) rotate(90deg);
    background: rgba(255, 255, 255, 0.3);
}

/* ===== MOBILE NAVIGATION CONTAINER ===== */

.mobile-nav {
    display: flex;
    flex-direction: column;
    padding: 2rem 0;
    height: calc(100vh - 120px);
    height: calc(100dvh - 120px);
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

/* ===== MOBILE NAVIGATION LINKS ===== */

.mobile-nav-link {
    display: block;
    padding: 1.2rem 2rem;
    margin: 0.5rem 1.5rem;
    color: white;
    text-decoration: none;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(0);
    opacity: 1;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.mobile-nav-link:hover,
.mobile-nav-link:focus {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.mobile-nav-link:active {
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.15);
}

.mobile-nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    font-weight: 700;
}

/* ===== NAVIGATION LINK ANIMATIONS ===== */

.mobile-nav-link.nav-link-animate-in {
    transform: translateX(0);
    opacity: 1;
    transition-delay: 0.1s;
}

.mobile-nav-link.nav-link-animate-out {
    transform: translateX(100px);
    opacity: 0;
    transition-delay: 0s;
}

/* ===== NAVIGATION LINK HOVER/ACTIVE STATES ===== */

.mobile-nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.1), 
        transparent);
    transition: left 0.6s ease;
}

.mobile-nav-link:hover::before,
.mobile-nav-link:active::before {
    left: 100%;
}

.mobile-nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2),
                0 0 20px rgba(255, 255, 255, 0.1);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.mobile-nav-link:active,
.mobile-nav-link.touch-feedback {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(0) scale(0.98);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.mobile-nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.mobile-nav-link.active::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 8px;
    transform: translateX(-50%);
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #ffffff, transparent);
    border-radius: 1px;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

/* ===== MOBILE LANGUAGE SELECTOR ===== */

.mobile-language-selector {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.mobile-language-selector .lang-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.mobile-language-selector .lang-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    color: #ffffff;
    transform: scale(1.05);
}

.mobile-language-selector .lang-btn.active {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

/* ===== BODY SCROLL LOCK ===== */

body.mobile-menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */

/* Small mobile devices (iPhone SE) */
@media screen and (max-width: 389px) {
    .mobile-nav-link {
        width: calc(100% - 2rem);
        font-size: 1rem;
        padding: 0.875rem 1.5rem;
        min-height: 52px;
    }
    
    .mobile-menu-header {
        padding: 1rem 1.5rem;
    }
    
    .mobile-language-selector {
        bottom: 1.5rem;
        padding: 0.5rem 1rem;
    }
}

/* Large mobile devices */
@media screen and (min-width: 390px) and (max-width: 767px) {
    .mobile-nav-link {
        font-size: 1.2rem;
        min-height: 60px;
    }
}

/* Tablet devices - hide mobile menu */
@media screen and (min-width: 1024px) {
    .mobile-menu-enhanced,
    .mobile-menu-overlay {
        display: none !important;
    }
}

/* ===== LANDSCAPE ORIENTATION ===== */

@media screen and (max-width: 1023px) and (orientation: landscape) {
    .mobile-nav {
        padding: 1rem 0;
        gap: 0.25rem;
        justify-content: flex-start;
        overflow-y: auto;
    }
    
    .mobile-nav-link {
        min-height: 48px;
        font-size: 1rem;
        padding: 0.75rem 1.5rem;
        margin: 0.125rem 0;
    }
    
    .mobile-language-selector {
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        margin-top: 1rem;
    }
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */

/* Focus styles */
.mobile-nav-link:focus,
.close-menu:focus,
.mobile-language-selector .lang-btn:focus {
    outline: 3px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
    border-radius: 16px;
}

.mobile-nav-link:focus-visible,
.close-menu:focus-visible,
.mobile-language-selector .lang-btn:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.9);
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.2);
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== HIGH CONTRAST MODE ===== */

@media (prefers-contrast: high) {
    .mobile-menu-enhanced {
        background: #000000 !important;
        border: 2px solid #ffffff;
    }
    
    .mobile-nav-link {
        background: #000000 !important;
        border: 2px solid #ffffff !important;
        color: #ffffff !important;
    }
    
    .mobile-nav-link:hover,
    .mobile-nav-link:active,
    .mobile-nav-link.active {
        background: #ffffff !important;
        color: #000000 !important;
    }
    
    .close-menu {
        background: #000000 !important;
        border: 2px solid #ffffff !important;
        color: #ffffff !important;
    }
    
    .close-menu:hover {
        background: #ffffff !important;
        color: #000000 !important;
    }
}

/* ===== REDUCED MOTION ===== */

@media (prefers-reduced-motion: reduce) {
    .mobile-menu-enhanced,
    .mobile-nav-link,
    .close-menu,
    .mobile-language-selector .lang-btn {
        transition: none !important;
        animation: none !important;
    }
    
    .mobile-nav-link:hover,
    .close-menu:hover {
        transform: none !important;
    }
    
    .mobile-nav-link::before {
        display: none;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */

/* GPU acceleration */
.mobile-menu-enhanced,
.mobile-nav-link,
.close-menu {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Optimize for touch devices */
@media (pointer: coarse) {
    .mobile-nav-link,
    .close-menu,
    .mobile-language-selector .lang-btn {
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
        tap-highlight-color: rgba(255, 255, 255, 0.1);
    }
}

/* ===== DARK MODE SUPPORT ===== */

@media (prefers-color-scheme: dark) {
    .mobile-menu-enhanced {
        background: linear-gradient(135deg, 
            rgba(15, 23, 42, 0.98) 0%, 
            rgba(30, 41, 59, 0.96) 30%,
            rgba(51, 65, 85, 0.94) 70%,
            rgba(71, 85, 105, 0.92) 100%);
    }
}

/* ===== PRINT STYLES ===== */

@media print {
    .mobile-menu-enhanced,
    .mobile-menu-overlay {
        display: none !important;
    }
}