/* ============================================
   MEJORAS PARA EXPERIENCIA MÓVIL - MADERAS AMÉRICA
   ============================================ */

/* Variables para breakpoints móviles más específicos */
:root {
    --mobile-xs: 320px;
    --mobile-sm: 375px;
    --mobile-md: 414px;
    --tablet-sm: 768px;
    --tablet-md: 1024px;
}

/* ============================================
   OPTIMIZACIONES GENERALES MÓVILES
   ============================================ */

/* Prevenir zoom accidental en inputs en iOS */
@media screen and (max-width: 768px) {
    input, textarea, select {
        font-size: 16px !important;
        transform: scale(1);
    }
    
    /* Mejorar el tap target size según guías de Material Design */
    button, .hero-btn, .nav-plank, .contact-btn {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ============================================
   HEADER Y NAVEGACIÓN MÓVIL MEJORADA
   ============================================ */

@media (max-width: 768px) {
    /* Header más compacto en móvil */
    header {
        padding: 1rem 1rem !important;
        background: rgba(58, 99, 122, 0.95);
        backdrop-filter: blur(10px);
    }
    
    /* Logo más pequeño y centrado */
    header img {
        height: 50px !important;
        max-height: 50px;
    }
    
    /* Menu toggle más accesible */
    .menu-toggle-btn {
        width: 44px !important;
        height: 44px !important;
        padding: 8px !important;
        border-radius: 8px;
        background: rgba(255,255,255,0.1);
        backdrop-filter: blur(5px);
    }
    
    /* Navegación móvil optimizada */
    .menu-container {
        padding: 1rem !important;
        justify-content: center !important;
        align-items: flex-start !important;
        padding-top: 100px !important;
    }
    
    .nav-plank {
        width: 90vw !important;
        max-width: 350px !important;
        padding: 1rem 1.5rem !important;
        font-size: 1.2rem !important;
        text-align: center !important;
        margin-bottom: 1rem !important;
    }
}

/* ============================================
   SECCIÓN HERO MÓVIL OPTIMIZADA
   ============================================ */

@media (max-width: 768px) {
    .full-section {
        min-height: 100vh !important;
        padding: 2rem 1rem !important;
    }
    
    /* Título principal responsive */
    .hero-section h1 {
        font-size: 2.5rem !important;
        line-height: 1.1 !important;
        margin-bottom: 1rem !important;
        text-align: center;
    }
    
    /* Subtítulo más legible */
    .hero-section p {
        font-size: 1.1rem !important;
        line-height: 1.4 !important;
        margin-bottom: 2rem !important;
        padding: 0 1rem;
    }
    
    /* Botones hero stack verticalmente */
    .hero-buttons {
        flex-direction: column !important;
        gap: 1.5rem !important;
        width: 100%;
        max-width: 320px;
    }
    
    .hero-btn {
        width: 100% !important;
        padding: 1rem 2rem !important;
        font-size: 1rem !important;
        min-height: 56px;
    }
}

/* ============================================
   SECCIÓN MISIÓN Y VISIÓN MÓVIL
   ============================================ */

@media (max-width: 768px) {
    #mission {
        padding: 4rem 1rem !important;
    }
    
    #mission h2 {
        font-size: 2.2rem !important;
        line-height: 1.2 !important;
        margin-bottom: 2rem !important;
        padding: 0 1rem;
    }
    
    .mission-card, .vision-card {
        padding: 1.5rem !important;
        margin-bottom: 2rem !important;
    }
    
    .mission-card h3, .vision-card h3 {
        font-size: 1.8rem !important;
        margin-bottom: 1rem !important;
    }
    
    .mission-card p, .vision-card p {
        font-size: 1rem !important;
        line-height: 1.5 !important;
    }
    
    .mission-icon svg, .vision-icon svg {
        width: 2.5rem !important;
        height: 2.5rem !important;
    }
}

/* ============================================
   SECCIÓN CONTACTO MÓVIL
   ============================================ */

@media (max-width: 768px) {
    #connect {
        padding: 3rem 1rem !important;
    }
    
    #connect h2 {
        font-size: 2rem !important;
        margin-bottom: 1.5rem !important;
    }
    
    #connect p {
        font-size: 1rem !important;
        margin-bottom: 2rem !important;
        padding: 0 1rem;
    }
    
    /* Grid de contacto en una columna */
    #connect .grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
        max-width: 300px !important;
    }
    
    .contact-btn {
        padding: 1rem 1.5rem !important;
        font-size: 1rem !important;
        min-height: 56px;
        justify-content: center;
    }
    
    .contact-btn svg {
        width: 1.5rem !important;
        height: 1.5rem !important;
        margin-right: 0.75rem !important;
    }
}

/* ============================================
   FOOTER MÓVIL OPTIMIZADO
   ============================================ */

@media (max-width: 768px) {
    .footer {
        padding: 2rem 1rem !important;
    }
    
    .footer .grid {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
        text-align: center !important;
    }
    
    .footer h4 {
        font-size: 1.2rem !important;
        margin-bottom: 1rem !important;
    }
    
    .footer ul {
        margin-bottom: 1.5rem;
    }
    
    .footer img {
        height: 60px !important;
        margin-bottom: 1rem !important;
    }
    
    .social-icon svg {
        width: 2rem !important;
        height: 2rem !important;
    }
}

/* ============================================
   WHATSAPP FAB MÓVIL
   ============================================ */

@media (max-width: 768px) {
    .whatsapp-fab {
        bottom: 1rem !important;
        right: 1rem !important;
        width: 56px !important;
        height: 56px !important;
        box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    }
    
    .whatsapp-fab svg {
        width: 1.75rem !important;
        height: 1.75rem !important;
    }
}

/* ============================================
   SCROLL DOWN BUTTON MÓVIL
   ============================================ */

@media (max-width: 768px) {
    .scroll-down-btn {
        bottom: 1rem !important;
    }
    
    .scroll-down-btn svg {
        width: 2rem !important;
        height: 2rem !important;
    }
}

/* ============================================
   MEJORAS PARA DISPOSITIVOS TÁCTILES
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    /* Eliminar efectos hover en dispositivos táctiles */
    .hero-btn:hover, .nav-plank:hover, .mission-card:hover, 
    .vision-card:hover, .contact-btn:hover {
        transform: none !important;
        background: none !important;
    }
    
    /* Agregar estados de focus/active para dispositivos táctiles */
    .hero-btn:active, .nav-plank:active, .contact-btn:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    /* Focus visible para navegación por teclado */
    .hero-btn:focus-visible, .nav-plank:focus-visible, .contact-btn:focus-visible {
        outline: 3px solid var(--brand-orange);
        outline-offset: 2px;
    }
}

/* ============================================
   OPTIMIZACIONES PARA PANTALLAS PEQUEÑAS
   ============================================ */

@media (max-width: 375px) {
    /* Ajustes para móviles muy pequeños */
    .hero-section h1 {
        font-size: 2rem !important;
    }
    
    .hero-section p {
        font-size: 1rem !important;
        padding: 0 0.5rem;
    }
    
    #mission h2 {
        font-size: 1.8rem !important;
    }
    
    .nav-plank {
        width: 95vw !important;
        padding: 0.875rem 1rem !important;
        font-size: 1.1rem !important;
    }
}

/* ============================================
   ANIMACIONES REDUCIDAS PARA USUARIOS QUE LAS PREFIEREN
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   MEJORAS ESPECÍFICAS PARA iOS SAFARI
   ============================================ */

@supports (-webkit-touch-callout: none) {
    /* Ajustar para la barra de navegación de Safari en iOS */
    .full-section {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
    
    html {
        height: -webkit-fill-available;
    }
    
    /* Prevenir el comportamiento de bounce en iOS */
    body {
        position: fixed;
        overflow: hidden;
        width: 100%;
        height: 100%;
    }
    
    #page-container {
        overflow: auto;
        height: 100vh;
        height: -webkit-fill-available;
    }
}

/* ============================================
   MODO LANDSCAPE PARA MÓVILES
   ============================================ */

@media (max-height: 500px) and (orientation: landscape) {
    .full-section {
        min-height: auto !important;
        padding: 1rem !important;
    }
    
    .hero-section h1 {
        font-size: 2rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .hero-section p {
        font-size: 1rem !important;
        margin-bottom: 1rem !important;
    }
    
    .hero-buttons {
        flex-direction: row !important;
        gap: 1rem !important;
    }
    
    .hero-btn {
        padding: 0.75rem 1.5rem !important;
        font-size: 0.9rem !important;
    }
}
