/*
* WaterSoft - Responsive Fixes & Optimizations
* Mejoras específicas para dispositivos móviles
* iPhone 15 Pro Max, Samsung Galaxy S25, Tablets
*/

/* ===== VARIABLES RESPONSIVAS ===== */
:root {
    /* Breakpoints específicos */
    --mobile-small: 320px;
    --mobile-medium: 375px;
    --mobile-large: 414px;
    --tablet-small: 768px;
    --tablet-large: 1024px;
    --desktop: 1200px;
    
    /* Espaciado fluido */
    --spacing-fluid-xs: clamp(0.25rem, 2vw, 0.5rem);
    --spacing-fluid-sm: clamp(0.5rem, 3vw, 1rem);
    --spacing-fluid-md: clamp(1rem, 4vw, 2rem);
    --spacing-fluid-lg: clamp(1.5rem, 5vw, 3rem);
    --spacing-fluid-xl: clamp(2rem, 6vw, 5rem);
    
    /* Tipografía fluida */
    --font-size-h1: clamp(2rem, 5vw, 3rem);
    --font-size-h2: clamp(1.5rem, 4vw, 2.5rem);
    --font-size-h3: clamp(1.25rem, 3vw, 1.75rem);
    --font-size-body: clamp(0.9rem, 2.5vw, 1rem);
    --font-size-small: clamp(0.8rem, 2vw, 0.9rem);
}

/* ===== MEJORAS GENERALES DE RESPONSIVIDAD ===== */

/* Contenedor principal más fluido */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 clamp(1rem, 4vw, 2rem);
}

/* Tipografía responsiva mejorada */
h1 {
    font-size: var(--font-size-h1);
    line-height: 1.2;
}

h2 {
    font-size: var(--font-size-h2);
    line-height: 1.3;
}

h3 {
    font-size: var(--font-size-h3);
    line-height: 1.4;
}

body {
    font-size: var(--font-size-body);
    line-height: 1.6;
}

/* ===== HERO SECTION - OPTIMIZACIONES ESPECÍFICAS ===== */

/* iPhone 15 Pro Max (430x932px) y similares */
@media screen and (max-width: 430px) and (min-height: 800px) {
    .hero {
        min-height: 100vh;
        height: auto;
        padding: 0;
    }
    
    .hero-content {
        padding: 2rem 1rem 1rem;
        max-width: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-height: calc(100vh - 80px);
    }
    
    .hero-brand {
        margin-top: 1rem;
        margin-bottom: 1rem;
    }
    
    .hero-main-logo {
        max-width: min(250px, 70vw);
        height: auto;
    }
    
    .phrase-container {
        height: auto;
        min-height: 80px;
        margin-bottom: 1rem;
    }
    
    .phrase-item h2 {
        font-size: clamp(1rem, 4vw, 1.2rem);
        line-height: 1.3;
        padding: 0 0.5rem;
    }
    
    .hero-buttons {
        gap: 0.75rem;
        margin: 1rem 0;
    }
    
    .btn-hero {
        min-width: min(280px, 85vw);
        padding: 14px 20px;
        font-size: 1rem;
        margin: 0.25rem 0;
    }
    
    .hero-trust {
        gap: 0.5rem;
        margin-top: 1rem;
    }
    
    .trust-item {
        font-size: 0.75rem;
        padding: 4px 8px;
        white-space: nowrap;
    }
}

/* Samsung Galaxy S25 (360x800px) y similares */
@media screen and (max-width: 390px) {
    .hero-main-logo {
        max-width: min(220px, 65vw);
    }
    
    .btn-hero {
        min-width: min(260px, 90vw);
        padding: 12px 18px;
        font-size: 0.95rem;
    }
    
    .phrase-item h2 {
        font-size: clamp(0.9rem, 3.5vw, 1.1rem);
    }
    
    .trust-item {
        font-size: 0.7rem;
        padding: 3px 6px;
    }
}

/* Pantallas muy pequeñas (320px) */
@media screen and (max-width: 320px) {
    .container {
        padding: 0 0.75rem;
    }
    
    .hero-content {
        padding: 1.5rem 0.5rem 1rem;
    }
    
    .hero-main-logo {
        max-width: min(200px, 60vw);
    }
    
    .btn-hero {
        min-width: min(240px, 95vw);
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .phrase-item h2 {
        font-size: clamp(0.85rem, 3vw, 1rem);
        padding: 0 0.25rem;
    }
}

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

/* Header responsivo optimizado */
@media screen and (max-width: 768px) {
    header {
        padding: 10px 0;
        background-color: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
    }
    
    .header-inner {
        padding: 0 1rem;
    }
    
    .logo img {
        height: clamp(50px, 8vw, 60px);
    }
    
    .mobile-menu-btn {
        width: 40px;
        height: 40px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 8px;
    }
    
    .mobile-menu-btn span {
        width: 24px;
        height: 2px;
        margin: 2px 0;
    }
    
    .mobile-nav {
        width: min(85vw, 350px);
        padding-top: 80px;
    }
    
    .mobile-nav ul {
        padding: 0 1.5rem;
    }
    
    .mobile-nav li {
        margin-bottom: 1.5rem;
    }
    
    .mobile-nav a {
        font-size: 1.1rem;
        padding: 0.5rem 0;
        display: block;
    }
}

/* ===== SECCIONES PRINCIPALES RESPONSIVAS ===== */

/* Beneficios grid mejorado */
@media screen and (max-width: 768px) {
    .beneficios-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 0 1rem;
    }
    
    .beneficio-card {
        height: auto;
        min-height: 200px;
    }
    
    .card-front,
    .card-back {
        padding: 1.5rem;
    }
}

@media screen and (max-width: 480px) {
    .beneficios-grid {
        gap: 1rem;
        padding: 0 0.5rem;
    }
    
    .beneficio-card {
        min-height: 180px;
    }
    
    .card-front .icon {
        font-size: 2rem;
    }
    
    .card-front h3 {
        font-size: 1.2rem;
    }
}

/* Productos grid responsivo */
@media screen and (max-width: 768px) {
    .productos-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .producto-image img {
        max-height: 200px;
    }
    
    .producto-info {
        padding: 1.5rem;
    }
}

/* Calculadora responsiva mejorada */
@media screen and (max-width: 768px) {
    .calculator-results {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .result-card {
        padding: 1rem;
    }
    
    .result-value {
        font-size: 1.5rem;
    }
}

@media screen and (max-width: 480px) {
    .calculator-container {
        padding: 1rem;
    }
    
    .form-group input {
        padding: 12px;
        font-size: 1rem;
    }
    
    .result-value {
        font-size: 1.3rem;
    }
}

/* ===== MODALES RESPONSIVOS MEJORADOS ===== */

/* Modal principal optimizado para móviles */
@media screen and (max-width: 480px) {
    .modal-container {
        width: 95vw;
        max-width: none;
        margin: 1rem;
        max-height: 90vh;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-header h3 {
        font-size: 1.1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .input-group input {
        padding: 12px;
        font-size: 1rem;
        border-radius: 8px;
    }
    
    .btn-continue {
        padding: 14px 20px;
        font-size: 1rem;
    }
}

/* Modal calculadora específico */
@media screen and (max-width: 480px) {
    .calculator-results-modal {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .calculator-results-modal .result-card {
        padding: 10px;
    }
    
    .calculator-results-modal .result-value {
        font-size: 1.1rem;
    }
    
    .calculator-results-modal .result-card h3 {
        font-size: 0.8rem;
    }
}

/* ===== BOTONES Y ELEMENTOS INTERACTIVOS ===== */

/* Botones más accesibles en móvil */
@media screen and (max-width: 768px) {
    .btn-primary,
    .btn-secondary {
        min-height: 44px; /* Tamaño mínimo recomendado para touch */
        padding: 12px 20px;
        font-size: 1rem;
    }
    
    .btn-lg {
        min-height: 48px;
        padding: 14px 24px;
        font-size: 1.1rem;
    }
}

/* WhatsApp button optimizado */
@media screen and (max-width: 480px) {
    .whatsapp-float {
        width: 56px;
        height: 56px;
        bottom: 20px;
        right: 20px;
    }
    
    .whatsapp-float i {
        font-size: 1.5rem;
    }
}

/* ===== TABLETS ESPECÍFICOS ===== */

/* iPad y tablets similares (768px - 1024px) */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    .container {
        padding: 0 2rem;
    }
    
    .hero-content {
        max-width: 600px;
        padding-top: 40px;
    }
    
    .hero-main-logo {
        max-width: 300px;
    }
    
    .phrase-item h2 {
        font-size: 1.6rem;
    }
    
    .btn-hero {
        min-width: 200px;
        padding: 16px 24px;
    }
    
    .beneficios-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .productos-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .empresa-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .contacto-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* ===== MEJORAS DE ACCESIBILIDAD TÁCTIL ===== */

/* Áreas de toque más grandes */
@media screen and (max-width: 768px) {
    .faq-question {
        padding: 1rem;
        min-height: 60px;
    }
    
    .nav-links a {
        padding: 0.75rem 0;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .social-icon {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
    }
}

/* ===== OPTIMIZACIONES DE RENDIMIENTO ===== */

/* Reducir animaciones en dispositivos de bajo rendimiento */
@media (prefers-reduced-motion: reduce) {
    .hero-main-logo,
    .bubble,
    .shape,
    .whatsapp-float {
        animation: none !important;
    }
    
    .btn-hero {
        animation: none !important;
    }
    
    * {
        transition-duration: 0.1s !important;
    }
}

/* ===== LANDSCAPE MÓVIL ===== */

/* Optimización para móviles en landscape */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: 100vh;
        padding: 0;
    }
    
    .hero-content {
        padding: 1rem;
        justify-content: center;
    }
    
    .hero-brand {
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    .hero-main-logo {
        max-width: 200px;
    }
    
    .phrase-container {
        height: 60px;
        margin-bottom: 0.5rem;
    }
    
    .phrase-item h2 {
        font-size: 1rem;
    }
    
    .hero-buttons {
        flex-direction: row;
        gap: 1rem;
        margin: 0.5rem 0;
    }
    
    .btn-hero {
        min-width: 180px;
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .hero-trust {
        margin-top: 0.5rem;
    }
}

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

/* Soporte básico para modo oscuro */
@media (prefers-color-scheme: dark) {
    .modal-container {
        background: #1a1a1a;
        color: #ffffff;
    }
    
    .modal-header {
        background: linear-gradient(135deg, #2c5aa0 0%, #1a4480 100%);
    }
    
    .input-group input {
        background: #2a2a2a;
        border-color: #444;
        color: #ffffff;
    }
    
    .input-group input:focus {
        background: #333;
        border-color: var(--primary-blue);
    }
}

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

/* Estilos para impresión */
@media print {
    .hero-video-container,
    .floating-bubbles,
    .geometric-shapes,
    .whatsapp-float,
    .back-to-top,
    .modal-overlay {
        display: none !important;
    }
    
    .hero {
        min-height: auto;
        height: auto;
        page-break-after: always;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
    }
}

/* ===== UTILIDADES RESPONSIVAS ===== */

/* Clases de utilidad para mostrar/ocultar en diferentes tamaños */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

@media screen and (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }
}

/* Espaciado responsivo */
.spacing-responsive {
    padding: var(--spacing-fluid-md);
    margin: var(--spacing-fluid-sm) 0;
}

/* Texto responsivo */
.text-responsive {
    font-size: var(--font-size-body);
    line-height: 1.6;
}

/* ===== FIXES ESPECÍFICOS PARA BUGS CONOCIDOS ===== */

/* Fix para iOS Safari viewport */
@supports (-webkit-touch-callout: none) {
    .hero {
        min-height: -webkit-fill-available;
    }
}

/* Fix para Android Chrome address bar */
@media screen and (max-width: 768px) {
    .hero {
        min-height: calc(100vh - env(keyboard-inset-height, 0px));
    }
}

/* Fix para notch en iPhone X y superiores */
@supports (padding: max(0px)) {
    .hero-content {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    
    .container {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}