/**
 * A&Y Pressure Washing LLC - Mobile Responsive Optimization
 * Version: 2.0.0
 * Date: October 30, 2025
 * 
 * Este archivo contiene SOLO optimizaciones móviles sin afectar desktop
 * Agregar DESPUÉS de todos los demás CSS en el HTML
 */

/* ======================
   MOBILE MENU ENHANCED
   Solo afecta pantallas <= 768px
   ====================== */

@media (max-width: 768px) {
  
  /* Header móvil optimizado */
  .header {
    height: var(--header-height-mobile);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  }
  
  .header .container {
    position: relative;
    padding: 0 var(--spacing-md);
  }
  
  /* Logo móvil - tamaño optimizado */
  .header__logo img {
    height: var(--logo-height-mobile);
    max-width: 180px;
  }
  
  /* Language Switcher - reposicionado para móvil */
  .lang-switcher {
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001;
  }
  
  .lang-switcher button {
    padding: 6px 12px;
    font-size: 13px;
    min-width: 40px;
    min-height: 36px;
  }
  
  /* Menu Toggle - Hamburger mejorado */
  .menu-toggle {
    display: flex !important;
    flex-direction: column;
    justify-content: space-between;
    width: 32px;
    height: 26px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    position: relative;
    z-index: 1002;
    transition: transform 0.3s ease;
  }
  
  .menu-toggle:active {
    transform: scale(0.95);
  }
  
  .menu-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: var(--color-primary);
    border-radius: 3px;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform-origin: center;
  }
  
  /* Animación a X cuando está activo */
  .menu-toggle.active span:nth-child(1) {
    transform: translateY(11.5px) rotate(45deg);
    background-color: var(--color-secondary-vibrant);
  }
  
  .menu-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
  }
  
  .menu-toggle.active span:nth-child(3) {
    transform: translateY(-11.5px) rotate(-45deg);
    background-color: var(--color-secondary-vibrant);
  }
  
  /* Navegación móvil - Slide down desde arriba */
  .nav {
    position: fixed;
    top: var(--header-height-mobile);
    left: 0;
    right: 0;
    background-color: var(--color-white);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    max-height: calc(100vh - var(--header-height-mobile));
    overflow-y: auto;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
  }
  
  .nav.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  
  /* Lista de navegación móvil */
  .nav__list {
    flex-direction: column;
    padding: var(--spacing-xl) var(--spacing-lg);
    gap: 0;
    width: 100%;
  }
  
  .nav__list li {
    width: 100%;
    border-bottom: 1px solid var(--color-gray);
    animation: slideInFromLeft 0.4s ease-out backwards;
  }
  
  .nav__list li:last-child {
    border-bottom: none;
  }
  
  /* Links de navegación móvil */
  .nav__link {
    display: flex;
    align-items: center;
    width: 100%;
    padding: var(--spacing-lg) var(--spacing-md);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-darker-gray);
    transition: all 0.3s ease;
  }
  
  .nav__link::before {
    content: '›';
    font-size: 24px;
    margin-right: var(--spacing-sm);
    color: var(--color-primary);
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
  }
  
  .nav__link:active {
    background-color: var(--color-light-gray);
  }
  
  .nav__link.active,
  .nav__link:hover {
    color: var(--color-primary);
    padding-left: var(--spacing-lg);
  }
  
  .nav__link.active::before,
  .nav__link:hover::before {
    opacity: 1;
    transform: translateX(0);
  }
  
  .nav__link::after {
    display: none; /* Quitar underline en móvil */
  }
  
  /* CTA Button en navegación móvil */
  .nav__cta {
    margin: var(--spacing-lg) 0 0 0;
    padding: 0 var(--spacing-md);
    width: 100%;
  }
  
  .nav__cta .btn {
    width: 100%;
    justify-content: center;
    padding: var(--spacing-lg) var(--spacing-xl);
    font-size: var(--font-size-lg);
    box-shadow: 0 4px 15px rgba(151, 39, 90, 0.3);
  }
  
  /* Animación de entrada para los items del menú */
  @keyframes slideInFromLeft {
    from {
      opacity: 0;
      transform: translateX(-30px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }
  
  .nav.active .nav__list li:nth-child(1) { animation-delay: 0.05s; }
  .nav.active .nav__list li:nth-child(2) { animation-delay: 0.10s; }
  .nav.active .nav__list li:nth-child(3) { animation-delay: 0.15s; }
  .nav.active .nav__list li:nth-child(4) { animation-delay: 0.20s; }
  .nav.active .nav__list li:nth-child(5) { animation-delay: 0.25s; }
  
  /* Overlay cuando el menú está abierto */
  body.menu-open {
    overflow: hidden;
  }
  
  body.menu-open::before {
    content: '';
    position: fixed;
    top: var(--header-height-mobile);
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    animation: fadeIn 0.3s ease;
  }
  
  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }
}

/* ======================
   HERO SECTION MOBILE
   ====================== */

@media (max-width: 768px) {
  .hero {
    min-height: 90vh;
    padding-top: calc(var(--header-height-mobile) + var(--spacing-3xl));
    padding-bottom: var(--spacing-3xl);
    background-attachment: scroll; /* Mejor rendimiento en móvil */
  }
  
  .hero__content {
    text-align: center;
    max-width: 100%;
  }
  
  .hero__title {
    font-size: 2.25rem; /* 36px */
    line-height: 1.2;
    margin-bottom: var(--spacing-xl);
  }
  
  .hero__subtitle {
    font-size: 1.125rem; /* 18px */
    line-height: 1.6;
    margin-bottom: var(--spacing-2xl);
    padding: 0 var(--spacing-sm);
  }
  
  .hero__cta {
    flex-direction: column;
    gap: var(--spacing-md);
    width: 100%;
  }
  
  .hero__cta .btn {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    justify-content: center;
    padding: var(--spacing-lg) var(--spacing-2xl);
    font-size: var(--font-size-lg);
    min-height: 54px;
  }
}

/* ======================
   SERVICES SECTION MOBILE
   ====================== */

@media (max-width: 768px) {
  .section {
    padding: var(--spacing-3xl) 0;
  }
  
  .section__header {
    margin-bottom: var(--spacing-2xl);
  }
  
  .section__subtitle {
    font-size: 0.8125rem; /* 13px */
    letter-spacing: 1.2px;
  }
  
  .section__title {
    font-size: 1.875rem; /* 30px */
    margin-bottom: var(--spacing-md);
  }
  
  .section__description {
    font-size: 1rem; /* 16px */
    padding: 0 var(--spacing-sm);
  }
  
  /* Grid responsive */
  .grid {
    grid-template-columns: 1fr !important;
    gap: var(--spacing-xl);
  }
  
  /* Cards optimizadas */
  .card {
    padding: var(--spacing-xl);
  }
  
  .card__image-wrapper {
    height: 220px;
    margin-bottom: var(--spacing-lg);
    border-radius: var(--radius-md);
    overflow: hidden;
  }
  
  .card__image {
    background-size: cover;
    background-position: center;
    height: 100%;
    transition: transform 0.3s ease;
  }
  
  .card:active .card__image {
    transform: scale(1.05);
  }
  
  .card__title {
    font-size: 1.375rem; /* 22px */
    margin-bottom: var(--spacing-md);
  }
  
  .card__description {
    font-size: 1rem; /* 16px */
    line-height: 1.7;
  }
  
  /* Remover hover effects en móvil para mejor performance */
  .card:hover {
    transform: none;
    box-shadow: var(--shadow-md);
  }
}

/* ======================
   ABOUT SECTION MOBILE
   ====================== */

@media (max-width: 768px) {
  .grid-cols-4 {
    grid-template-columns: 1fr !important;
    gap: var(--spacing-lg);
  }
  
  .grid-cols-2 {
    grid-template-columns: 1fr !important;
  }
  
  .card[style*="text-align: center"] {
    padding: var(--spacing-xl) var(--spacing-lg);
  }
  
  .card[style*="text-align: center"] i,
  .card[style*="text-align: center"] .icon-secondary {
    margin: 0 auto var(--spacing-lg) auto;
  }
}

/* ======================
   CTA SECTION MOBILE
   ====================== */

@media (max-width: 768px) {
  .cta-section {
    background-attachment: scroll; /* No fixed en móvil */
    min-height: auto;
    padding: var(--spacing-4xl) var(--spacing-lg);
  }
  
  .cta-section h2 {
    font-size: 1.875rem !important; /* 30px */
    line-height: 1.3;
    margin-bottom: var(--spacing-lg) !important;
  }
  
  .cta-section p {
    font-size: 1.125rem !important; /* 18px */
    line-height: 1.6;
    margin-bottom: var(--spacing-xl) !important;
    padding: 0 var(--spacing-sm);
  }
  
  .cta-section .btn {
    width: 100%;
    max-width: 400px;
    margin: 0 auto var(--spacing-md) auto;
    display: flex;
    justify-content: center;
    padding: var(--spacing-lg) var(--spacing-2xl);
    font-size: var(--font-size-lg);
    min-height: 54px;
  }
}

/* ======================
   CONTACT SECTION MOBILE
   ====================== */

@media (max-width: 768px) {
  #contact .grid {
    grid-template-columns: 1fr !important;
    gap: var(--spacing-2xl);
  }
  
  /* Contact Info Cards */
  .card[style*="gap: var(--spacing-md)"] {
    padding: var(--spacing-xl);
  }
  
  .card i {
    font-size: 2rem;
  }
  
  .card h3 {
    font-size: 1.25rem;
  }
  
  .card p, .card a {
    font-size: 1rem;
  }
}

/* ======================
   FORMS MOBILE
   ====================== */

@media (max-width: 768px) {
  .form-group {
    margin-bottom: var(--spacing-lg);
  }
  
  .form-label {
    font-size: 0.9375rem; /* 15px */
    margin-bottom: var(--spacing-sm);
  }
  
  /* Prevenir zoom en iOS */
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="date"],
  input[type="time"],
  textarea,
  select {
    font-size: 16px !important; /* Mínimo 16px para evitar zoom en iOS */
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
  }
  
  textarea {
    min-height: 120px;
  }
  
  /* Grid en forms */
  div[style*="grid-template-columns: 1fr 1fr"] {
    display: flex !important;
    flex-direction: column;
    gap: var(--spacing-lg) !important;
  }
}

/* ======================
   FOOTER MOBILE
   ====================== */

@media (max-width: 768px) {
  .footer {
    padding: var(--spacing-3xl) 0 var(--spacing-2xl);
  }
  
  .footer__content {
    grid-template-columns: 1fr !important;
    gap: var(--spacing-2xl);
    text-align: center;
  }
  
  .footer__brand {
    max-width: 100%;
    padding: 0 var(--spacing-md);
  }
  
  .footer__logo {
    display: flex;
    justify-content: center;
  }
  
  .footer__description {
    text-align: center;
  }
  
  .footer__social {
    justify-content: center;
  }
  
  .footer__section {
    padding: 0 var(--spacing-md);
  }
  
  .footer__section h4 {
    margin-bottom: var(--spacing-md);
  }
  
  .footer__links {
    align-items: center;
    gap: var(--spacing-sm);
  }
  
  .footer__links a {
    padding: var(--spacing-sm) 0;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  
  .footer__bottom {
    padding-top: var(--spacing-xl);
    font-size: 0.8125rem;
  }
  
  .footer__bottom p {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
  }
  
  .footer__bottom span[style*="margin"] {
    display: none;
  }
}

/* ======================
   MODALS MOBILE
   ====================== */

@media (max-width: 768px) {
  .modal {
    padding: var(--spacing-md);
    align-items: flex-end;
  }
  
  .modal__content {
    width: 100%;
    max-width: none;
    max-height: 85vh;
    padding: var(--spacing-xl) var(--spacing-lg);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    animation: slideUp 0.3s ease;
  }
  
  @keyframes slideUp {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }
  
  .modal.active .modal__content {
    transform: translateY(0);
  }
  
  .modal__header {
    margin-bottom: var(--spacing-lg);
  }
  
  .modal__title {
    font-size: 1.5rem;
  }
  
  .modal__close {
    width: 32px;
    height: 32px;
    font-size: var(--font-size-lg);
  }
}

/* ======================
   WHATSAPP BUTTON MOBILE
   ====================== */

@media (max-width: 768px) {
  .whatsapp-float {
    width: 56px;
    height: 56px;
    bottom: 20px;
    right: 20px;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
  }
  
  .whatsapp-float i {
    font-size: 30px;
  }
  
  .whatsapp-tooltip {
    display: none !important;
  }
  
  /* Asegurar que no interfiera con navegación */
  body.menu-open .whatsapp-float {
    opacity: 0.5;
    pointer-events: none;
  }
}

/* ======================
   BUTTONS MOBILE
   ====================== */

@media (max-width: 768px) {
  .btn {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: var(--font-size-base);
    min-height: 48px;
    border-radius: var(--radius-md);
  }
  
  .btn-large {
    padding: var(--spacing-lg) var(--spacing-2xl);
    font-size: var(--font-size-lg);
    min-height: 54px;
  }
  
  .btn-small {
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: var(--font-size-sm);
    min-height: 44px;
  }
  
  /* Touch feedback */
  .btn:active {
    transform: scale(0.98);
    opacity: 0.9;
  }
}

/* ======================
   TOUCH OPTIMIZATIONS
   ====================== */

/* Todos los elementos interactivos deben tener mínimo 44x44px */
@media (max-width: 768px) {
  a, button, .nav__link, .menu-toggle, .lang-btn {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Mejor highlight para touch */
  * {
    -webkit-tap-highlight-color: rgba(11, 126, 185, 0.15);
    -webkit-touch-callout: none;
  }
  
  /* Smooth scroll */
  html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Prevenir selección de texto en elementos interactivos */
  .btn, .nav__link, .menu-toggle, .lang-btn, .card {
    -webkit-user-select: none;
    user-select: none;
  }
}

/* ======================
   LANDSCAPE MOBILE
   ====================== */

@media (max-width: 768px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding-top: calc(var(--header-height-mobile) + var(--spacing-2xl));
    padding-bottom: var(--spacing-2xl);
  }
  
  .hero__title {
    font-size: 2rem;
  }
  
  .hero__subtitle {
    font-size: 1rem;
    margin-bottom: var(--spacing-xl);
  }
  
  .section {
    padding: var(--spacing-2xl) 0;
  }
  
  .nav {
    max-height: 80vh;
  }
}

/* ======================
   SMALL MOBILE (<375px)
   ====================== */

@media (max-width: 375px) {
  .hero__title {
    font-size: 1.875rem; /* 30px */
  }
  
  .section__title {
    font-size: 1.5rem; /* 24px */
  }
  
  .card {
    padding: var(--spacing-lg);
  }
  
  .card__image-wrapper {
    height: 180px;
  }
  
  .btn {
    font-size: 0.9375rem;
    padding: var(--spacing-md) var(--spacing-lg);
  }
  
  .container {
    padding: 0 var(--spacing-md);
  }
}

/* ======================
   PERFORMANCE OPTIMIZATIONS
   ====================== */

/* Reducir animaciones para dispositivos con recursos limitados */
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .nav {
    transition: none;
  }
}

/* Optimizar scroll en móvil */
@media (max-width: 768px) {
  body {
    -webkit-overflow-scrolling: touch;
  }
  
  /* Background fixed disabled para mejor performance */
  .hero--with-image,
  .cta-section {
    background-attachment: scroll !important;
  }
}

/* ======================
   SAFE AREAS (iPhone notch)
   ====================== */

@media (max-width: 768px) {
  .header {
    padding-top: env(safe-area-inset-top);
  }
  
  .footer {
    padding-bottom: calc(var(--spacing-2xl) + env(safe-area-inset-bottom));
  }
  
  .whatsapp-float {
    bottom: calc(20px + env(safe-area-inset-bottom));
  }
}

/* ======================
   ACCESIBILIDAD MOBILE
   ====================== */

@media (max-width: 768px) {
  /* Focus visible para navegación por teclado */
  *:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
  }
  
  /* Contraste mejorado */
  .nav__link,
  .btn,
  .card__title {
    font-weight: var(--font-weight-semibold);
  }
  
  /* Tamaño de fuente mínimo para legibilidad */
  p, li, a, span {
    font-size: 16px !important;
  }
}

/* ======================
   FIN RESPONSIVE MOBILE
   ====================== */
