/* ========================================
   RESPONSIVE.CSS - VERSIÓN UNIFICADA
======================================== */

/* ========================================
   BREAKPOINTS Y VARIABLES RESPONSIVAS
======================================== */

/* Mobile Small (≤575px) */
@media (max-width: 575.98px) {
  :root {
    /* Escala tipográfica móvil */
    --text-5xl: 2rem;
    --text-4xl: 1.75rem;
    --text-3xl: 1.5rem;
    --text-2xl: 1.25rem;
    --text-xl: 1.125rem;
    
    /* Espaciado compacto */
    --space-20: 3rem;
    --space-16: 2.5rem;
    --space-12: 2rem;
    --space-10: 1.5rem;
  }
}

/* Mobile Medium/Tablets (576px - 991px) */
@media (min-width: 576px) and (max-width: 991.98px) {
  :root {
    --text-5xl: 2.5rem;
    --text-4xl: 2rem;
    --text-3xl: 1.75rem;
  }
}

/* ========================================
   LAYOUT RESPONSIVO GENERAL
======================================== */

/* Container adaptativo */
@media (max-width: 575.98px) {
  .container {
    padding: 0 var(--space-4);
  }
}

@media (min-width: 576px) and (max-width: 991.98px) {
  .container {
    padding: 0 var(--space-6);
  }
}

@media (min-width: 1200px) {
  .container {
    max-width: 1400px;
    padding: 0 var(--space-6);
  }
}

/* Secciones adaptativas */
@media (max-width: 575.98px) {
  .section {
    padding: var(--space-12) 0;
  }
}

@media (min-width: 576px) and (max-width: 991.98px) {
  .section {
    padding: var(--space-16) 0;
  }
}

/* ========================================
   TIPOGRAFÍA RESPONSIVA
======================================== */

/* Títulos móviles */
@media (max-width: 575.98px) {
  .h1 {
    font-size: var(--text-4xl);
    line-height: 1.2;
  }
  
  .h2 {
    font-size: var(--text-3xl);
    line-height: 1.3;
  }
  
  .h3 {
    font-size: var(--text-2xl);
    line-height: 1.4;
  }
  
  .lead {
    font-size: var(--text-lg);
    line-height: 1.6;
  }
  
  /* Prevenir zoom automático en iOS */
  body {
    font-size: 16px;
  }
  
  input,
  textarea,
  select {
    font-size: 16px;
  }
}

/* ========================================
   GRID SYSTEM RESPONSIVO
======================================== */

/* Móviles: Todo a 1 columna */
@media (max-width: 575.98px) {
  .grid-2,
  .grid-3,
  .grid-4,
  .grid-auto-fit {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
}

/* Tablets: 2 columnas para grids grandes */
@media (min-width: 576px) and (max-width: 991.98px) {
  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid-auto-fit {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

/* Desktop: Grid completo */
@media (min-width: 992px) {
  .grid-auto-fit {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }
}

/* ========================================
   COMPONENTES RESPONSIVOS
======================================== */

/* Botones móviles */
@media (max-width: 575.98px) {
  .btn {
    padding: var(--space-4) var(--space-6);
    min-height: 48px;
    font-size: var(--text-base);
  }
  
  .btn-lg {
    padding: var(--space-5) var(--space-8);
    min-height: 56px;
  }
  
  .btn-block-mobile {
    width: 100%;
  }
}

/* Cards móviles */
@media (max-width: 575.98px) {
  .card {
    padding: var(--space-6);
    margin-bottom: var(--space-4);
    /* Simplificar sombras en móvil */
    box-shadow: var(--shadow-md);
  }
  
  .card:hover {
    box-shadow: var(--shadow-lg);
    transform: none; /* Sin transform en móvil */
  }
}

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

@media (max-width: 991.98px) {
  .navbar {
    padding: var(--space-3) 0;
  }
  
  .navbar-nav {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100vh;
    background: var(--white);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: left var(--transition-base);
    z-index: 999;
    box-shadow: var(--shadow-2xl);
  }
  
  .navbar-nav.active {
    left: 0;
  }
  
  .navbar-nav a {
    font-size: var(--text-xl);
    padding: var(--space-4);
  }
}

/* ========================================
   HERO SECTION RESPONSIVO
======================================== */

@media (max-width: 575.98px) {
  .hero {
    min-height: 100vh;
    padding: var(--space-20) 0;
    text-align: center;
  }
  
  .hero .h1 {
    font-size: 2.5rem;
    margin-bottom: var(--space-6);
  }
  
  /* Ocultar patrones complejos en móvil */
  .hero::before {
    display: none;
  }
}

@media (min-width: 576px) and (max-width: 991.98px) {
  .hero .h1 {
    font-size: 3rem;
  }
}

/* Landscape móvil */
@media (max-width: 991.98px) and (orientation: landscape) {
  .hero {
    min-height: 70vh;
    padding: var(--space-12) 0;
  }
  
  .section {
    padding: var(--space-10) 0;
  }
}

/* ========================================
   CONTACT PAGE ESPECÍFICO
======================================== */

/* Tablets y móvil (768px y abajo) */
@media (max-width: 768px) {
  .contact-content {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }
  
  .contact-info-section {
    order: 2;
  }
  
  .contact {
    padding: var(--space-12) 0;
  }
  
  .contact-form-container {
    padding: var(--space-8);
  }
  
  .contact-info-container {
    padding: var(--space-6);
  }
  
  /* Títulos escalables */
  .section-title {
    font-size: clamp(2rem, 8vw, 3rem);
  }
  
  .section-subtitle {
    font-size: var(--text-lg);
  }
  
  .form-title {
    font-size: var(--text-xl);
  }
  
  .info-title {
    font-size: var(--text-lg);
  }
}

/* Móviles específicos (480px y abajo) */
@media (max-width: 480px) {
  /* Formulario a 1 columna */
  .form-row {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  
  /* Espaciado compacto */
  .contact {
    padding: var(--space-8) 0;
  }
  
  .contact-header {
    margin-bottom: var(--space-8);
  }
  
  .contact-form-container,
  .contact-info-container {
    padding: var(--space-6);
  }
  
  .contact-faq {
    padding: var(--space-6);
  }
  
  /* Inputs táctiles */
  .form-input,
  .form-select,
  .form-textarea {
    min-height: 48px;
    font-size: 16px;
  }
  
  .form-textarea {
    min-height: 100px;
  }
  
  .form-submit-btn {
    min-height: 48px;
    font-size: var(--text-base);
  }
  
  /* Métodos de contacto compactos */
  .contact-method {
    padding: var(--space-3);
    gap: var(--space-3);
  }
  
  .contact-method:hover {
    transform: none;
  }
  
  .method-icon {
    width: 40px;
    height: 40px;
  }
  
  .method-icon i {
    font-size: var(--text-base);
  }
  
  /* Secciones info compactas */
  .contact-schedule,
  .contact-location {
    padding: var(--space-4);
  }
  
  /* FAQ compacta */
  .faq-item summary {
    padding: var(--space-3);
    padding-right: var(--space-10);
    font-size: var(--text-sm);
  }
  
  .faq-item p {
    padding: 0 var(--space-3) var(--space-3);
  }
  
  /* Títulos más pequeños */
  .section-title {
    font-size: clamp(1.75rem, 6vw, 2.5rem);
    margin-bottom: var(--space-3);
  }
  
  .section-subtitle {
    font-size: var(--text-base);
  }
  
  /* Sin hover effects en móvil */
  .form-input:hover,
  .form-select:hover,
  .form-textarea:hover {
    transform: none;
  }
}

/* Móviles muy pequeños (360px y abajo) */
@media (max-width: 360px) {
  .container {
    padding: 0 var(--space-3);
  }
  
  .contact-form-container,
  .contact-info-container,
  .contact-faq {
    padding: var(--space-4);
  }
  
  .section-title {
    font-size: 1.75rem;
  }
  
  .form-title,
  .info-title {
    font-size: var(--text-lg);
  }
  
  .form-checkbox-container {
    gap: var(--space-2);
  }
  
  .form-checkbox {
    width: 18px;
    height: 18px;
  }
  
  .form-checkbox-text {
    font-size: 0.8rem;
  }
}

/* ========================================
   FOOTER RESPONSIVO
======================================== */

/* Tablets */
@media (max-width: 991.98px) {
  .footer-content {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
  }
  
  .footer-brand {
    grid-column: 1 / -1;
    max-width: none;
    text-align: center;
    margin-bottom: var(--space-8);
  }
  
  .footer-contact {
    grid-column: 1 / -1;
  }
}

/* Móviles */
@media (max-width: 575.98px) {
  .footer-content {
    grid-template-columns: 1fr;
    gap: var(--space-6);
    padding: var(--space-12) 0 var(--space-8);
  }
  
  .footer-brand,
  .footer-links,
  .footer-contact {
    text-align: center;
  }
  
  .footer-bottom {
    flex-direction: column;
    gap: var(--space-4);
    text-align: center;
  }
  
  .footer-certifications {
    justify-content: center;
    gap: var(--space-4);
  }
  
  /* Newsletter móvil */
  .newsletter-input-group {
    flex-direction: column;
    gap: var(--space-3);
  }
  
  .newsletter-btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Cookies banner móvil */
  .cookies-content {
    flex-direction: column;
    gap: var(--space-4);
    text-align: center;
  }
  
  .cookies-actions {
    justify-content: center;
  }
}

/* ========================================
   CALL TO ACTION FLOTANTE
======================================== */

@media (max-width: 575.98px) {
  .floating-cta {
    display: block;
    bottom: 16px;
    right: 16px;
  }
}

@media (min-width: 576px) and (max-width: 991.98px) {
  .floating-cta {
    display: block;
  }
}

@media (min-width: 992px) {
  .floating-cta {
    display: none;
  }
}

/* ========================================
   ANIMACIONES RESPONSIVAS
======================================== */

/* Animaciones suaves para móvil */
@media (max-width: 575.98px) {
  @keyframes fadeInUpMobile {
    from {
      opacity: 0;
      transform: translateY(15px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  @keyframes fadeInLeftMobile {
    from {
      opacity: 0;
      transform: translateX(-15px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }
  
  @keyframes fadeInRightMobile {
    from {
      opacity: 0;
      transform: translateX(15px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }
  
  .animate-fadeInUp {
    animation: fadeInUpMobile 0.6s ease-out;
  }
  
  .animate-fadeInLeft {
    animation: fadeInLeftMobile 0.6s ease-out;
  }
  
  .animate-fadeInRight {
    animation: fadeInRightMobile 0.6s ease-out;
  }
}

/* Efectos hover solo en desktop */
@media (min-width: 992px) {
  .card:hover {
    transform: translateY(-6px);
  }
  
  .btn:hover {
    transform: translateY(-2px);
  }
}

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

/* Visibilidad */
@media (max-width: 575.98px) {
  .hidden-mobile { display: none !important; }
  .visible-mobile { display: block !important; }
}

@media (min-width: 576px) {
  .hidden-desktop { display: none !important; }
  .visible-desktop { display: block !important; }
  .visible-mobile { display: none !important; }
}

/* Flexbox responsivo */
@media (max-width: 575.98px) {
  .flex-mobile-col {
    flex-direction: column;
  }
  
  .justify-mobile-center {
    justify-content: center;
  }
  
  .items-mobile-center {
    align-items: center;
  }
  
  .text-mobile-center {
    text-align: center;
  }
}

/* Espaciado responsivo */
@media (max-width: 575.98px) {
  .mb-mobile-4 { margin-bottom: var(--space-4) !important; }
  .mb-mobile-6 { margin-bottom: var(--space-6) !important; }
  .mt-mobile-4 { margin-top: var(--space-4) !important; }
  .mt-mobile-6 { margin-top: var(--space-6) !important; }
  
  .px-mobile-4 { 
    padding-left: var(--space-4) !important;
    padding-right: var(--space-4) !important;
  }
  
  .py-mobile-6 {
    padding-top: var(--space-6) !important;
    padding-bottom: var(--space-6) !important;
  }
}

/* ========================================
   ACCESIBILIDAD MÓVIL
======================================== */

@media (max-width: 575.98px) {
  /* Área táctil mínima */
  .btn,
  .navbar-nav a,
  .card {
    min-height: 44px;
  }
  
  /* Focus mejorado */
  .btn:focus,
  input:focus,
  textarea:focus {
    outline: 3px solid var(--primary-blue);
    outline-offset: 2px;
  }
}

/* Touch devices */
@media (pointer: coarse) {
  .btn {
    min-height: 48px;
    padding: var(--space-4) var(--space-6);
  }
  
  .navbar-nav a {
    padding: var(--space-4) var(--space-3);
  }
  
  /* Eliminar hover effects */
  .card:hover {
    transform: none;
    box-shadow: var(--shadow-lg);
  }
  
  .btn:hover {
    transform: none;
  }
}

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

@media (max-width: 575.98px) {
  /* GPU optimization */
  .card,
  .btn {
    backface-visibility: hidden;
    perspective: 1000;
    transform: translate3d(0, 0, 0);
  }
}

/* Reducir animaciones para usuarios con preferencia */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  html {
    scroll-behavior: auto;
  }
}

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

@media (prefers-color-scheme: dark) {
  :root {
    --white: #0f172a;
    --light-gray: #1e293b;
    --medium-gray: #94a3b8;
    --dark-gray: #f1f5f9;
    --black: #f8fafc;
    --gradient-subtle: linear-gradient(135deg, var(--light-gray) 0%, #334155 100%);
  }
  
  body {
    background-color: var(--white);
    color: var(--dark-gray);
  }
  
  .navbar {
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid rgb(255 255 255 / 0.1);
  }
  
  .card {
    background: var(--light-gray);
    border: 1px solid rgb(255 255 255 / 0.1);
  }
  
  .section-gray {
    background: var(--light-gray);
  }
}

/* ========================================
   HIGH DPI DISPLAYS
======================================== */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .hero::before {
    background-size: 25px 25px;
  }
  
  .card,
  .btn {
    border-width: 0.5px;
  }
}

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

@media print {
  * {
    background: transparent !important;
    color: black !important;
    box-shadow: none !important;
  }
  
  .navbar,
  .floating-cta,
  .btn {
    display: none !important;
  }
  
  .hero {
    min-height: auto;
    padding: 2rem 0;
  }
  
  .section {
    padding: 1rem 0;
    page-break-inside: avoid;
  }
  
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }
  
  .card {
    border: 1px solid #ddd;
    page-break-inside: avoid;
    margin-bottom: 1rem;
  }
}