/**
 * Estilos y Micro-Animaciones - Tema Luminoso Editorial
 * Climatización Alicante - climatizacionalicante.com.es
 */

:root {
  --color-primary: #0369a1;
  --color-primary-light: #38bdf8;
  --color-primary-ice: #f0f9ff;
  --color-accent: #ea580c;
  --color-text-main: #0f172a;
  --color-text-body: #334155;
  --color-text-muted: #475569;
  --border-card: #e2e8f0;
  --bg-surface: #ffffff;
  --bg-subtle: #f8fafc;
}

html {
  scroll-behavior: smooth;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background-color: #ffffff;
  color: var(--color-text-body);
}

h1, h2, h3, h4, h5, h6, .font-heading {
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  letter-spacing: -0.02em;
  color: var(--color-text-main);
}

html, body {
  overflow-x: hidden;
  max-width: 100%;
}

/* Header 100% Sólido y Opaco (Cero transparencias ni solapamientos) */
header {
  background-color: #ffffff !important;
  opacity: 1 !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: 0 4px 15px -3px rgba(15, 23, 42, 0.08) !important;
}

.header-solid {
  background-color: #ffffff !important;
  opacity: 1 !important;
}

/* Contenedor Header */
/* Contenedor Header y Logo - Mobile First Escalable y Optimizado */
.header-inner-container {
  height: 68px;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand-logo {
  height: 52px !important;
  max-height: 56px !important;
  width: auto !important;
  max-width: calc(100vw - 84px) !important;
  object-fit: contain !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  display: block;
  transition: transform 0.2s ease, filter 0.2s ease;
}

@media (min-width: 640px) {
  .header-inner-container {
    height: 76px;
    min-height: 76px;
  }
  .header-brand-logo {
    height: 62px !important;
    max-height: 66px !important;
    max-width: 280px !important;
  }
}

@media (min-width: 1024px) {
  .header-inner-container {
    min-height: 86px !important;
    height: 86px !important;
  }
  .header-brand-logo {
    height: 74px !important;
    max-height: 78px !important;
    max-width: 340px !important;
  }
  /* Ajuste quirúrgico en PC: navegación agrupada junto al logo (casi al texto) y CTA a la derecha */
  .header-inner-container > nav {
    margin-right: auto !important;
    margin-left: 1.75rem !important;
  }
}

.header-brand-logo:hover {
  transform: scale(1.02);
  filter: brightness(1.03);
}

.footer-brand-logo {
  height: 56px !important;
  max-height: 60px !important;
  width: auto !important;
  max-width: 260px !important;
  object-fit: contain !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  display: block;
  transition: transform 0.2s ease;
}

.footer-brand-logo:hover {
  transform: scale(1.02);
}

/* Margen de scroll para evitar que el menú tape títulos */
section[id], div[id] {
  scroll-margin-top: 6rem;
}

/* Patrón Suave de Brisa Fresca */
.hero-light-bg {
  background: 
    radial-gradient(circle at 10% 20%, rgba(224, 242, 254, 0.7) 0%, transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(240, 249, 255, 0.8) 0%, transparent 35%),
    radial-gradient(circle at 50% 90%, rgba(241, 245, 249, 0.6) 0%, transparent 50%),
    #ffffff;
}

.grid-subtle-pattern {
  background-image: 
    linear-gradient(to right, rgba(226, 232, 240, 0.4) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(226, 232, 240, 0.4) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* Slider Frigorías en Tema Claro */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  background: #e2e8f0;
  border-radius: 9999px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #0284c7;
  cursor: pointer;
  border: 3px solid #ffffff;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.35);
  transition: transform 0.15s ease, background 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: #0369a1;
}

/* Tarjetas Limpias con Elevación Sutil */
.clean-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 1.25rem;
  box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.03), 0 2px 4px -2px rgba(15, 23, 42, 0.03);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.clean-card:hover {
  border-color: #7dd3fc;
  box-shadow: 0 16px 30px -5px rgba(2, 132, 199, 0.08), 0 6px 12px -4px rgba(2, 132, 199, 0.04);
  transform: translateY(-2px);
}

/* ===================================================
   CUADROS SEPARADOS Y TÍTULOS RESALTADOS (BLOG & GUÍAS)
   =================================================== */

/* Tarjetas individuales de blog: cuadros independientes y clicables */
.blog-card-box {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 1.25rem;
  padding: 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.04), 0 2px 4px -2px rgba(15, 23, 42, 0.02);
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.blog-card-box:hover {
  border-color: #0284c7;
  box-shadow: 0 20px 25px -5px rgba(2, 132, 199, 0.12), 0 8px 10px -6px rgba(2, 132, 199, 0.06);
  transform: translateY(-4px);
}

/* Caja de título destacada dentro de cada tarjeta */
.blog-card-box .title-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #0284c7;
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  transition: all 0.2s ease;
}

.blog-card-box:hover .title-box {
  background: #f0f9ff;
  border-color: #bae6fd;
  border-left-color: #0284c7;
}

.blog-card-box .title-box h2,
.blog-card-box .title-box h3 {
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 800;
  font-size: 1.125rem;
  line-height: 1.35;
  color: #0f172a;
  margin: 0;
}

.blog-card-box:hover .title-box h2,
.blog-card-box:hover .title-box h3 {
  color: #0369a1;
}

/* En el cuerpo de las guías técnicas: erradicar aspecto lineal con cuadros y títulos resaltados */
.prose h2 {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 5px solid #0284c7;
  border-radius: 0.875rem;
  padding: 0.95rem 1.25rem;
  font-size: 1.35rem !important;
  font-weight: 800 !important;
  color: #0f172a !important;
  margin-top: 2.25rem !important;
  margin-bottom: 1.15rem !important;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.03);
}

.prose h3 {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-left: 4px solid #38bdf8;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 1.125rem !important;
  font-weight: 700 !important;
  color: #0369a1 !important;
  margin-top: 1.75rem !important;
  margin-bottom: 0.85rem !important;
}

.prose p {
  line-height: 1.75;
  margin-bottom: 1.15rem;
}

/* Cuadro de aviso técnico / parámetro clave dentro de las guías */
.technical-callout {
  background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 100%);
  border: 1px solid #bae6fd;
  border-left: 5px solid #0ea5e9;
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  box-shadow: 0 4px 6px -1px rgba(14, 165, 233, 0.05);
}

/* Tarjeta destacada de zona local */
.zone-card-box {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 1.25rem;
  padding: 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.04);
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.zone-card-box:hover {
  border-color: #0ea5e9;
  box-shadow: 0 16px 25px -5px rgba(14, 165, 233, 0.12);
  transform: translateY(-3px);
}



/* ===================================================
   OPTIMIZACIÓN RESPONSIVA MÓVIL: USO COMPLETO DE PANTALLA
   (Cero desbordamientos, cero márgenes muertos)
   =================================================== */

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
  width: 100% !important;
  -webkit-text-size-adjust: 100%;
}

img, svg, video, canvas, audio, iframe, embed, object {
  max-width: 100%;
  height: auto;
}

@media (max-width: 639px) {
  /* Aprovechar todo el ancho útil de la pantalla con margen perimetral ergonómico (12px) */
  .max-w-7xl, .max-w-6xl, .max-w-5xl, .max-w-4xl, .max-w-3xl, .container {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Padding interno optimizado en tarjetas para maximizar espacio de lectura */
  .clean-card, .blog-card-box, .zone-card-box {
    padding: 1rem !important;
    border-radius: 1rem !important;
  }

  /* Bloques de contenido y formularios a pantalla completa */
  .bg-white.border.border-slate-200.rounded-3xl,
  .bg-white.border.border-slate-200\/90.rounded-3xl {
    padding: 1.15rem 0.85rem !important;
    border-radius: 1.25rem !important;
  }

  /* Callouts y cajas de aviso en guías y blog */
  .technical-callout {
    padding: 0.85rem 1rem !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    border-radius: 0.75rem !important;
  }

  /* Ajuste tipográfico suave para evitar saltos de línea antiestéticos de una sola palabra */
  h1, .font-heading.text-4xl, .font-heading.text-5xl, .font-heading.text-6xl {
    font-size: clamp(1.85rem, 6.8vw, 2.5rem) !important;
    line-height: 1.15 !important;
  }

  h2, .font-heading.text-3xl {
    font-size: clamp(1.4rem, 5.2vw, 1.85rem) !important;
    line-height: 1.22 !important;
  }

  /* Tablas en guías: desplazamiento horizontal táctil nativo sin romper el layout */
  .prose table, table {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* Menú móvil desplegable a pantalla completa */
  #mobileMenu {
    width: 100% !important;
    max-width: 100vw !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
}


/* UNIVERSAL WHATSAPP & CALLBACK MODAL ANTI-CUTOFF MOBILE FIX */
@media (max-width: 640px) {
  #waWidgetBox, #waChatBox, .wa-chat-box {
    position: fixed !important;
    top: 10px !important;
    bottom: 10px !important;
    left: 10px !important;
    right: 10px !important;
    margin: auto !important;
    width: auto !important;
    max-width: 400px !important;
    height: auto !important;
    max-height: calc(100dvh - 20px) !important;
    max-height: calc(100vh - 20px) !important;
    display: flex !important;
    flex-direction: column !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    z-index: 2147483647 !important;
    transform: none !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45) !important;
  }
  #waWidgetBox.hidden, #waWidgetBox.wa-hidden,
  #waWidgetBox[style*="display: none"], #waWidgetBox[style*="display:none"],
  #waChatBox[hidden], #waChatBox[style*="display: none"], #waChatBox[style*="display:none"],
  .wa-chat-box[hidden], .wa-chat-box[style*="display: none"], .wa-chat-box[style*="display:none"] {
    display: none !important;
  }
  #waWidgetBox > div:first-child, .wa-chat-header, #waChatHeader, .wa-header {
    flex-shrink: 0 !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 30 !important;
    padding: 8px 12px !important;
  }
  #waWidgetBox > div:nth-child(2), .wa-chat-body, #waChatBody, .wa-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    padding: 10px 12px 30px !important;
    box-sizing: border-box !important;
  }
  #waWidgetBox form, .wa-chat-body form, .wa-lead-form, #waForm, #wa-lead-form {
    overflow: visible !important;
    max-height: none !important;
    flex: none !important;
  }
  .wa-chat-box .wa-bubble {
    padding: 8px 10px !important;
    margin-bottom: 8px !important;
  }
  .wa-chat-box .wa-bubble p {
    font-size: 11.5px !important;
    line-height: 1.3 !important;
  }
  #apWaModal, #whatsappModal, #waModal, .modal-overlay {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483647 !important;
    padding: 8px !important;
    box-sizing: border-box !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  #apWaModal.active, #whatsappModal.active, #waModal.active, .modal-overlay.active,
  #apWaModal[style*="display: flex"], #apWaModal[style*="display: block"] {
    display: flex !important;
  }
  #apWaModal > div, #waModal > div, #whatsappModal .modal-window, .modal-window, .modal-dialog {
    max-height: calc(100dvh - 16px) !important;
    max-height: calc(100vh - 16px) !important;
    max-width: 400px !important;
    width: 100% !important;
    margin: auto !important;
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    padding: 14px 12px 28px !important;
    border-radius: 16px !important;
    box-sizing: border-box !important;
  }
  #whatsappModal .modal-window > div:first-of-type {
    margin-bottom: 8px !important;
  }
  #whatsappModal .modal-window > div:first-of-type > div:first-child {
    width: 36px !important;
    height: 36px !important;
    margin: 0 auto 6px !important;
  }
  #whatsappModal .modal-window > div:first-of-type > div:first-child svg {
    width: 20px !important;
    height: 20px !important;
  }
  #whatsappModal #waModalTitle {
    font-size: 1.15rem !important;
    margin-bottom: 2px !important;
  }
  #whatsappModal p {
    font-size: 0.76rem !important;
    margin-top: 2px !important;
    margin-bottom: 6px !important;
    line-height: 1.25 !important;
  }
  #whatsappModal .form-field {
    margin-bottom: 5px !important;
  }
  #whatsappModal .form-field label {
    font-size: 11px !important;
    margin-bottom: 1px !important;
  }
  #waWidgetBox input, #waWidgetBox select, #waWidgetBox textarea,
  #waChatBox input, #waChatBox select, #waChatBox textarea,
  .wa-chat-box input, .wa-chat-box select, .wa-chat-box textarea,
  #whatsappModal input, #whatsappModal select, #whatsappModal textarea,
  #apWaModal input, #apWaModal select, #apWaModal textarea,
  #waModal input, #waModal select, #waModal textarea {
    padding: 6px 10px !important;
    font-size: 13px !important;
    height: 34px !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
  }
  #waWidgetBox textarea, #waChatBox textarea, .wa-chat-box textarea,
  #whatsappModal textarea, #apWaModal textarea, #waModal textarea {
    min-height: 40px !important;
    max-height: 52px !important;
    height: 44px !important;
    resize: none !important;
    padding: 6px 10px !important;
  }
  #waSubmitBtn, #waWidgetBox button[type="submit"], #waChatBox button[type="submit"],
  .wa-chat-box button[type="submit"], #whatsappModal button[type="submit"],
  #apWaModal button[type="submit"], #waModal button[type="submit"] {
    margin-top: 6px !important;
    margin-bottom: 8px !important;
    padding: 10px 14px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    border-radius: 10px !important;
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
  }
}
