/* Optimizaciones específicas para móviles */

/* Header oculto en scroll móvil */
.header.hidden {
    transform: translateY(-100%);
}

.header.scrolled {
    background: rgba(12, 36, 61, 0.9);
    backdrop-filter: blur(10px);
}

/* Estados de hover y focus mejorados */
.keyboard-navigation *:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.mobile-device .service-card:hover {
    transform: none;
}

.service-card.active {
    transform: scale(1.02);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

/* Mejoras para pantallas táctiles */
@media (hover: none) and (pointer: coarse) {
    .service-card {
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }
    
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .social-links a {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Estados de carga */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Mejoras de accesibilidad */
.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;
}

/* Reducir animaciones para usuarios con preferencias de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Mejoras para contraste alto */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0052a3;
        --secondary-color: #cc4400;
        --text-color: #000000;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
    
    .service-card {
        border: 1px solid #ccc;
    }
}

/* Soporte para modo oscuro */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --text-color: #ffffff;
        --primary-color: #4da6ff;
        --secondary-color: #ff8533;
    }
    
    body {
        background: var(--bg-color);
        color: var(--text-color);
    }
    
    .header {
        background: rgba(26, 26, 26, 0.95);
    }
    
    .service-card {
        background: #2a2a2a;
        color: var(--text-color);
    }
    
    .footer {
        background: #0f0f0f;
    }
}

/* Optimizaciones de rendimiento */
.service-card img {
    will-change: transform;
    backface-visibility: hidden;
}

.header {
    will-change: transform;
    backface-visibility: hidden;
}

/* PWA styles */
.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--primary-color);
    color: white;
    padding: 1rem;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 1001;
}

.pwa-install-banner.show {
    transform: translateY(0);
}

.pwa-install-banner .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.footer-grid { grid-template-columns: 1fr; }
@media (min-width: 768px) {
    .footer-grid { grid-template-columns: 1fr 1fr 1fr; }
    .footer-col:nth-child(1) { justify-content: flex-start; }
    .footer-col:nth-child(2) { justify-content: center; }
    .footer-col:nth-child(3) { justify-content: flex-end; }
}

.pwa-install-banner button {
    background: white;
    color: var(--primary-color);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
}

/* Optimizaciones para viewport dinámico en móviles */
.hero {
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height */
}

/* Mejoras para pantallas pequeñas */
@media (max-width: 320px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .service-card {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* Orientación landscape en móviles */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: 100vh;
        padding: 2rem 0;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .header {
        padding: 0.5rem 0;
    }
}