/* ===== MOBILE FINAL ENHANCEMENTS ===== */

/* ===== NAVBAR SCROLLED STATE ===== */
.mobile-navbar.scrolled {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.95) 100%);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* ===== ENHANCED TOUCH INTERACTIONS ===== */
.mobile-navbar,
.mobile-assistance-btn,
.mobile-sos-btn,
.mobile-hamburger,
.mobile-menu-link,
.mobile-cta-primary,
.mobile-team-member,
.certification-link {
    -webkit-tap-highlight-color: rgba(59, 130, 246, 0.3);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* ===== SAFE AREA INSETS FOR NOTCHED DEVICES ===== */
@supports (padding-top: env(safe-area-inset-top)) {
    .mobile-navbar {
        padding-top: env(safe-area-inset-top);
    }
    
    .mobile-navbar-container {
        padding-top: 0;
    }
    
    .mobile-main {
        padding-top: calc(70px + env(safe-area-inset-top));
    }
}

/* ===== ENHANCED BUTTON STATES ===== */
.mobile-assistance-btn:active,
.mobile-sos-btn:active,
.mobile-hamburger:active {
    transform: scale(0.95);
}

.mobile-cta-primary:active {
    transform: translateY(1px) scale(0.98);
}

/* ===== IMPROVED FOCUS STYLES ===== */
.mobile-assistance-btn:focus,
.mobile-sos-btn:focus,
.mobile-hamburger:focus,
.mobile-menu-link:focus,
.mobile-cta-primary:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* ===== HIGH CONTRAST MODE SUPPORT ===== */
@media (prefers-contrast: high) {
    .mobile-navbar {
        background: rgba(0, 0, 0, 0.95);
        border-bottom: 2px solid #ffffff;
    }
    
    .logo-text {
        color: #ffffff;
        background: none;
        -webkit-text-fill-color: #ffffff;
    }
    
    .mobile-assistance-btn,
    .mobile-sos-btn {
        border: 2px solid #ffffff;
    }
    
    .mobile-menu {
        background: rgba(0, 0, 0, 0.98);
        border-top: 2px solid #ffffff;
    }
    
    .mobile-menu-link {
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }
}

/* ===== DARK MODE DETECTION ===== */
@media (prefers-color-scheme: dark) {
    /* Already optimized for dark mode */
}

/* ===== REDUCED DATA MODE ===== */
@media (prefers-reduced-data: reduce) {
    .mobile-home-background video {
        display: none;
    }
    
    /* Lazy loading is handled in HTML, not CSS */
    .mobile-member-image img,
    .certification-logo {
        opacity: 0.8;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .mobile-navbar,
    .mobile-menu,
    .mobile-cta-primary {
        display: none !important;
    }
    
    .mobile-main {
        padding-top: 0 !important;
    }
    
    .mobile-home-section {
        min-height: auto;
        padding: 2rem 0;
    }
    
    .mobile-home-background {
        display: none;
    }
    
    .mobile-home-content,
    .mobile-chi-siamo-container {
        color: #000000 !important;
        background: #ffffff !important;
    }
}

/* ===== LANDSCAPE ORIENTATION OPTIMIZATIONS ===== */
@media (max-height: 500px) and (orientation: landscape) {
    .mobile-navbar-container {
        height: 60px;
        padding: 0.5rem 1.5rem;
    }
    
    .logo-text {
        font-size: 1.5rem;
    }
    
    .mobile-assistance-btn,
    .mobile-sos-btn,
    .mobile-hamburger {
        width: 40px;
        height: 40px;
    }
    
    .mobile-main {
        padding-top: 60px;
    }
    
    .mobile-home-section {
        min-height: 100vh;
    }
    
    .mobile-home-content {
        padding: 1rem 1.5rem;
    }
    
    .mobile-home-title {
        margin-bottom: 1rem;
    }
    
    .title-line-1,
    .title-line-2 {
        font-size: clamp(1.8rem, 6vw, 2.5rem);
    }
    
    .mobile-home-description {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
}

/* ===== VERY SMALL SCREENS (< 320px) ===== */
@media (max-width: 280px) {
    .mobile-navbar-container {
        padding: 0.5rem 0.75rem;
        height: 60px;
    }
    
    .logo-text {
        font-size: 1.4rem;
    }
    
    .mobile-header-actions {
        gap: 0.4rem;
    }
    
    .mobile-assistance-btn,
    .mobile-sos-btn,
    .mobile-hamburger {
        width: 36px;
        height: 36px;
    }
    
    .mobile-sos-btn {
        font-size: 0.7rem;
        padding: 0.4rem 0.6rem;
        min-width: 40px;
    }
    
    .mobile-main {
        padding-top: 60px;
    }
    
    .title-line-1,
    .title-line-2 {
        font-size: 1.6rem;
    }
    
    .mobile-home-description {
        font-size: 0.85rem;
    }
    
    .mobile-cta-primary {
        padding: 0.7rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .mobile-section-title {
        font-size: 24px;
        font-weight: 800;
        color: #ffffff;
        margin: 0 0 15px 0;
        line-height: 1.2;
    }
    
    .mobile-section-title .highlight-blue {
        background: linear-gradient(135deg, #3b82f6, #1d4ed8);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    .mobile-section-description {
        font-size: 16px;
        color: rgba(255, 255, 255, 0.8);
        line-height: 1.6;
        margin: 0;
    }    .mobile-team-member {
        padding: 1.2rem 0.8rem;
        max-width: 200px;
    }
    
    .mobile-member-image {
        width: 80px;
        height: 100px;
    }
    
    .member-name {
        font-size: 1rem;
    }
    
    .member-role {
        font-size: 0.7rem;
    }
}

/* ===== LARGE MOBILE SCREENS (481px - 600px) ===== */
@media (min-width: 481px) and (max-width: 600px) {
    .mobile-team-members {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 2rem;
    }
    
    .mobile-team-member {
        max-width: 250px;
        flex: 0 1 45%;
    }
    
    .mobile-certifications-grid {
        gap: 3rem;
    }
    
    .certification-logo {
        width: 100px;
        height: 100px;
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
@media (prefers-reduced-motion: reduce) {
    .mobile-navbar {
        transition: none;
    }
    
    .mobile-menu {
        transition: none;
    }
    
    .mobile-hamburger span {
        transition: none;
    }
    
    .mobile-assistance-btn,
    .mobile-sos-btn,
    .mobile-cta-primary,
    .mobile-team-member,
    .certification-link {
        transition: none;
    }
    
    .mobile-assistance-btn:hover,
    .mobile-sos-btn:hover,
    .mobile-cta-primary:hover,
    .mobile-team-member:hover,
    .certification-link:hover {
        transform: none;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
.mobile-home-background,
.mobile-chi-siamo-section {
    contain: layout style paint;
    will-change: transform;
}

.mobile-navbar {
    contain: layout style;
    will-change: transform, background-color;
}

.mobile-menu {
    contain: layout style paint;
    will-change: transform, opacity;
}

/* Force GPU acceleration for smooth animations */
.mobile-assistance-btn,
.mobile-sos-btn,
.mobile-hamburger,
.mobile-cta-primary,
.mobile-team-member {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* ===== ERROR FALLBACKS ===== */
.mobile-home-background video:not([src]) + .mobile-home-overlay {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
}

.mobile-member-image img[src=""],
.mobile-member-image img:not([src]) {
    display: none;
}

.mobile-member-image img[src=""]:after,
.mobile-member-image img:not([src]):after {
    content: "\f007";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}
