/* ==========================================================
   EL ELEFANTE AZUL - v3.1 (base original) + Chat modernizado
   ========================================================== */

/* --------- RESETEO Y VARIABLES --------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  background: #0e1f3a;
  color: #e6ecf4;
  scroll-behavior: smooth;
}

:root {
  --blue: #163a6b;
  --blue-dark: #0f2d53;
  --accent: #1f7aeb;
  --accent-dark: #116bd1;
  --green: #25D366;
  --card-bg: #ffffff;
}

/* --------- CONTENEDORES --------- */
.container {
  width: min(1100px, 92%);
  margin: auto;
}

/* ==========================================================
   CABECERA
   ========================================================== */
.site-header {
  background: linear-gradient(180deg, #0f2d53, #0e1f3a);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 18px 0;
}

.header-grid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(145deg, #1a75ff, #0fb0ff);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.brand-text h1 {
  font-size: 1.4rem;
  font-weight: 800;
}

.cta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.25s ease;
}

.btn-primary {
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  color: #fff;
  box-shadow: 0 8px 18px rgba(31, 122, 235, 0.35);
}

.btn-primary:hover {
  filter: brightness(1.15);
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ==========================================================
   HERO PRINCIPAL
   ========================================================== */
.hero {
  background: radial-gradient(1200px 500px at 80% -10%, rgba(255, 255, 255, 0.08), transparent),
              linear-gradient(180deg, #0e1f3a, #0c1a30);
  padding: 60px 0 40px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 26px;
  align-items: center;
}

.hero-text h2 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 10px;
  color: #fff;
}

.hero-text p {
  font-size: 1.05rem;
  opacity: 0.9;
  margin-bottom: 14px;
  line-height: 1.6;
}

.badges {
  list-style: none;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.badges li {
  background: rgba(255, 255, 255, 0.08);
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.hero-art {
  height: 260px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03)),
              radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.12), transparent 60%);
  background-blend-mode: overlay, normal;
  background-size: cover;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35) inset;
}

/* ==========================================================
   SERVICIOS
   ========================================================== */
.services {
  background: #0c1a30;
  padding: 50px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.services h3 {
  margin-bottom: 24px;
  font-size: 1.7rem;
  color: #fff;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.card {
  background: linear-gradient(145deg, #1f7aeb, #116bd1);
  color: #fff;
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 8px 18px rgba(31, 122, 235, 0.35);
}

.card img {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  object-fit: contain;
  margin-bottom: 10px;
  background: #fff;
}

/* ==========================================================
   FORMULARIO PROFESIONAL
   ========================================================== */
.form-section {
  background: linear-gradient(180deg, #0c1a30, #0e1f3a);
  padding: 70px 20px;
  color: #e6ecf4;
  text-align: center;
}

.form-container {
  max-width: 950px;
  margin: 0 auto;
}

form {
  background: #f8f9fc;
  color: #0f1b2c;
  border-radius: 18px;
  padding: 15px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  border: 1px solid #e7eef6;
  text-align: left;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
}

.form-group label {
  font-weight: 600;
  color: #1c2c4b;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

input,
textarea {
  border: 1px solid #d7e2ef;
  border-radius: 10px;
  padding: 12px 14px;
  font: inherit;
  width: 100%;
}

textarea {
  resize: vertical;
  min-height: 110px;
}

form button[type="submit"],
form .btn-primary {
  /*display: inline-block;*/
  background: linear-gradient(145deg, #1f7aeb, #0c5dc0);
  border: none;
  color: #fff;
  padding: 14px 28px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(31, 122, 235, 0.45);
  transition: all 0.25s ease;
  text-align: center;
}

form button[type="submit"]:hover,
form .btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 10px 25px rgba(31, 122, 235, 0.5);
}



/* ==========================================================
   FORMULARIO DE PRESUPUESTO RÁPIDO (v3.2 adaptado)
   ========================================================== */
.form-section {
  background: linear-gradient(180deg, #0c1a30, #0e1f3a);
  padding: 70px 20px;
  color: #e6ecf4;
  text-align: center;
}

.form-container {
  max-width: 950px;
  margin: 0 auto;
  /*background: var(--card-bg);*/
  border-radius: 20px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  padding: 10px;
  transition: 0.3s ease;
}

.form-container:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.35);
}

.form-container h2 {
  color: var(--blue-dark);
  font-weight: 800;
  margin-bottom: 10px;
  font-size: 1.9rem;
}

.form-container p {
  color: #bac7dd;
  margin-bottom: 20px;
  font-size: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 25px;
}

/* Campos individuales */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-weight: 600;
  color: var(--blue-dark);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Inputs y textarea */
input[type="text"],
input[type="email"],
input[type="tel"],
textarea {
  border: 1.5px solid #c9d4e3;
  border-radius: 10px;
  padding: 12px 15px;
  font-size: 15px;
  font-family: inherit;
  transition: 0.3s ease;
  color: #0e1f3a;
  background: #fff;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 122, 235, 0.15);
  outline: none;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

/* Subida de archivos */
input[type="file"] {
  border: 1.5px dashed #b4c2d4;
  background: #f9fafc;
  border-radius: 10px;
  padding: 10px;
  font-size: 0.9rem;
  color: #1c2c4b;
  cursor: pointer;
}

input[type="file"]::file-selector-button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.25s;
}

input[type="file"]::file-selector-button:hover {
  background: var(--accent-dark);
}

/* Botón principal */
form button[type="submit"],
form .btn-primary {
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  border: none;
  color: #fff;
  padding: 14px 28px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(31, 122, 235, 0.45);
  transition: all 0.25s ease;
  text-align: center;
}

form button[type="submit"]:hover,
form .btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 10px 25px rgba(31, 122, 235, 0.5);
}

/* Texto de ayuda */
.small-text {
  text-align: center;
  color: #666;
  font-size: 13px;
  margin-top: 10px;
}

/* ==========================================================
   RESPONSIVE (ADAPTADO A MÓVILES)
   ========================================================== */
@media (max-width: 768px) {
  .form-container {
    padding: 25px 22px;
    width: 94%;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .form-container h2 {
    font-size: 1.6rem;
  }

  .form-container p {
    font-size: 0.95rem;
  }

  input,
  textarea {
    font-size: 0.95rem;
  }

  form button[type="submit"],
  form .btn-primary {
    width: 100%;
  }
}


/* ==========================================================
   FOOTER
   ========================================================== */
.site-footer {
  background: #0c1830;
  color: #e6ecf4;
  padding: 28px 0;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 10px;
}

/* ==========================================================
   BOTONES FLOTANTES
   ========================================================== */
.wa-float,
.chatbot-float {
  position: fixed;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  z-index: 999;
}

.wa-float {
  right: 25px;
  bottom: 25px;
  background: #25D366;
  font-size: 28px;
}

.chatbot-float {
  right: 25px;
  bottom: 95px;
  background: linear-gradient(145deg, #1f7aeb, #0c5dc0);
  font-size: 22px;
}

/* ==========================================================
   CHATBOT MODAL
   ========================================================== */
.chatbot-modal {
  display: none;
  position: fixed;
  right: 25px;
  bottom: 160px;
  width: clamp(300px, 90vw, 360px);
  max-height: 70vh;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  z-index: 1100;
  flex-direction: column;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

.chatbot-header {
  background: linear-gradient(145deg, #1f7aeb, #0c5dc0);
  color: #fff;
  padding: 10px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.chatbot-header .close,
.chatbot-header .chatbot-close,
.chatbot-header button {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.2s ease, color 0.2s ease;
}

.chatbot-header .close:hover,
.chatbot-header .chatbot-close:hover,
.chatbot-header button:hover {
  color: #e3e3e3;
  transform: rotate(90deg);
}

.chatbot-messages {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  background: #f6f8fb;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bot-msg {
  background: #ffffff;
  color: #1c1c1c;
  align-self: flex-start;
  padding: 10px 14px;
  border-radius: 14px 14px 14px 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  max-width: 85%;
  word-wrap: break-word;
}

.user-msg {
  background: #1f7aeb;
  color: #fff;
  align-self: flex-end;
  padding: 10px 14px;
  border-radius: 14px 14px 4px 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  max-width: 85%;
  word-wrap: break-word;
}

.chatbot-input {
  display: flex;
  border-top: 1px solid #e0e4ec;
  background: #fff;
}

.chatbot-input input {
  flex: 1;
  padding: 12px 14px;
  border: none;
  outline: none;
  font-size: 15px;
}

.chatbot-input button {
  background: linear-gradient(145deg, #1f7aeb, #0c5dc0);
  color: #fff;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  margin: 6px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(31, 122, 235, 0.35);
  transition: all 0.25s ease;
}

.chatbot-input button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(31, 122, 235, 0.45);
  filter: brightness(1.1);
}

.chatbot-modal i,
.chatbot-modal svg {
  font-family: "Font Awesome 6 Free", "Material Icons", sans-serif !important;
  font-weight: 900;
}

/* ==========================================================
   RESPONSIVE FINAL
   ========================================================== */
@media (max-width: 768px) {
  .header-grid {
    flex-direction: column;
    text-align: center;
  }

  .brand,
  .cta {
    justify-content: center;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-art {
    margin: 0 auto;
    width: 80%;
    height: 200px;
  }

  .chatbot-float {
    bottom: 95px !important;
  }

  .chatbot-modal {
    right: 10px;
    bottom: 120px;
    width: 92vw;
    max-height: 70vh;
  }
}


/* ==========================================================
   OPTIMIZACIÓN RESPONSIVE (MÓVIL Y TABLET)
   ========================================================== */

/* ---- Tablets horizontales y pantallas medianas ---- */
@media (max-width: 1200px) {

  /* Centrar los badges (Respuesta rápida, Piezas originales, etc.) */
  .badges {
    justify-content: center;
    text-align: center;
  }

  .badges li {
    margin-bottom: 8px;
  }

  /* Ajuste de hero para tablets */
  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-art {
    margin: 0 auto;
    width: 80%;
    height: 220px;
  }

  .hero-text h2 {
    font-size: 2rem;
  }

  .hero-text p {
    font-size: 1rem;
  }

  /* Formularios centrados y más equilibrados */
  .form-container {
    width: 92%;
    margin: 0 auto;
  }

  form {
    padding: 30px 24px;
  }

  .form-grid {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }

  /* Centrar el botón del formulario */
  form button[type="submit"],
  form .btn-primary {
    display: block;
    margin: 10px auto 0;
  }
}

/* ---- Móviles y pantallas pequeñas ---- */
@media (max-width: 768px) {

  /* Ajustes generales */
  .header-grid {
    flex-direction: column;
    text-align: center;
  }

  .brand,
  .cta {
    justify-content: center;
  }

  /* Hero y texto */
  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-text h2 {
    font-size: 1.7rem;
    line-height: 1.3;
  }

  .hero-text p {
    font-size: 1rem;
  }

  /* Centrar badges */
  .badges {
    justify-content: center;
    text-align: center;
  }

  .badges li {
    margin-bottom: 8px;
  }

  /* Formularios */
  .form-container {
    width: 95%;
  }

  form {
    padding: 25px 18px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  input,
  textarea {
    font-size: 0.95rem;
  }

  /* Botón centrado */
  form button[type="submit"],
  form .btn-primary {
    display: block;
    margin: 0 auto;
  }

  /* Tarjetas de servicios */
  .cards {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .card {
    max-width: 340px;
    margin: 0 auto;
  }

  /* Chat y botones flotantes */
  .chatbot-float {
    bottom: 95px !important;
  }

  .chatbot-modal {
    right: 10px;
    bottom: 120px;
    width: 92vw;
    max-height: 70vh;
  }
}



/* ==========================================================
   CHATBOT - VERSIÓN MÓVIL / TABLET OPTIMIZADA (V4.0)
   ========================================================== */

@media (max-width: 768px) {
  /* Chat ocupa toda la pantalla */
  .chatbot-modal {
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
    display: none; /* sigue oculto hasta abrirlo */
    flex-direction: column;
  }

  /* Cabecera del chat más amplia */
  .chatbot-header {
    padding: 16px;
    font-size: 16px;
    border-radius: 0;
  }

  /* Área de mensajes más cómoda */
  .chatbot-messages {
    padding: 16px;
    font-size: 15px;
    line-height: 1.5;
  }

  /* Campo de entrada táctil */
  .chatbot-input {
    padding: 10px;
    background: #fff;
    border-top: 1px solid #e0e4ec;
  }

  .chatbot-input input {
    font-size: 16px;
    padding: 14px;
  }

  /* Botón de enviar más grande */
  .chatbot-input button {
    width: 56px;
    height: 56px;
    font-size: 22px;
    margin: 4px;
  }

  /* Ajuste de los botones flotantes */
  .chatbot-float {
    bottom: 85px !important;
    right: 15px;
  }

  .wa-float {
    right: 15px;
    bottom: 15px;
  }
}

@media (max-width: 480px) {
  /* Móviles pequeños: mejor centrado y tamaño */
  .chatbot-header {
    font-size: 15px;
    padding: 14px;
  }

  .chatbot-input input {
    font-size: 15px;
  }

  .chatbot-input button {
    width: 50px;
    height: 50px;
  }

  .bot-msg,
  .user-msg {
    font-size: 14px;
    line-height: 1.4;
  }
}


/* ==========================================================
   BOTÓN DE CIERRE DEL CHAT - MEJORA VISUAL
   ========================================================== */
.chatbot-header button {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 22px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s ease, transform 0.2s ease;
}

.chatbot-header button:hover {
  background: rgba(255,255,255,0.25);
  transform: rotate(90deg);
}

/* En móviles: botón más grande y cómodo */
@media (max-width: 768px) {
  .chatbot-header button {
    width: 46px;
    height: 46px;
    font-size: 26px;
    background: rgba(255,255,255,0.2);
  }
}




/* ==========================================================
   CHAT — ADAPTACIÓN TOTAL A MÓVIL/TABLET (full-screen seguro)
   ========================================================== */

@media (max-width: 992px) {
  /* La ventana del chat ocupa toda la pantalla sin saltos */
  .chatbot-modal {
    position: fixed;
    inset: 0;                  /* top/right/bottom/left: 0 */
    width: 100%;
    height: 100dvh;            /* altura real del viewport en móvil */
    max-height: none;
    border-radius: 0;
    box-shadow: none;
    background: #fff;
    display: none;             /* se muestra con JS -> flex */
    flex-direction: column;
    overscroll-behavior: contain;
  }

  /* Cabecera fija arriba, visible siempre */
  .chatbot-header {
    position: sticky;
    top: 0;
    z-index: 3;
    padding: 16px;
    font-size: 16px;
    border-radius: 0;
  }

  /* Área de mensajes: ocupa todo el espacio disponible */
  .chatbot-messages {
    flex: 1;                   /* <- clave para que crezca */
    min-height: 0;             /* evita “saltos” iOS */
    overflow-y: auto;
    padding: 14px 14px 8px;
    font-size: 15px;
    line-height: 1.5;
    -webkit-overflow-scrolling: touch;
  }

  /* Burbujas un poco más compactas en móvil */
  .bot-msg,
  .user-msg {
    font-size: 14.5px;
    max-width: 88vw;
  }

  /* Área de entrada fija abajo, sin tapar por la barra del sistema */
  .chatbot-input {
    position: sticky;
    bottom: 0;
    z-index: 3;
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0));
    background: #fff;
    border-top: 1px solid #e0e4ec;
  }

  .chatbot-input input {
    flex: 1;
    height: 48px;
    padding: 12px 14px;
    font-size: 16px;           /* evita zoom de iOS al enfocar */
  }

  .chatbot-input button {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    font-size: 22px;
    margin: 0;
  }

  /* Botones flotantes recolocados */
  .chatbot-float { right: 16px; bottom: 92px !important; }
  .wa-float      { right: 16px; bottom: 20px; }
}

/* Soporte adicional para navegadores sin dvh */
@supports not (height: 100dvh) {
  @media (max-width: 992px) {
    .chatbot-modal { height: 100svh; }
  }
}



/* ==========================================================
   CHATBOT — Ajuste móvil y scroll seguro
   ========================================================== */
.chatbot-modal {
  display: none;
  position: fixed;
  right: 25px;
  bottom: 100px;
  width: clamp(300px, 95vw, 380px);
  max-height: 80vh;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
  overflow: hidden;
  flex-direction: column;
  z-index: 1100;
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: #f6f8fb;
  -webkit-overflow-scrolling: touch;
}

/* En móviles, ocupar altura completa del viewport visible */
@media (max-width: 768px) {
  .chatbot-modal {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100vw;
    height: 100dvh; /* clave: altura dinámica del viewport visible */
    max-height: none;
    border-radius: 0;
  }
}


/* ==========================================================
   CHATBOT — Campo de entrada fijo y visual mejorado
   ========================================================== */

/* Contenedor del input (parte inferior del chat) */
.chatbot-input {
  position: sticky;          /* permanece visible al hacer scroll */
  bottom: 0;                 /* fijado al fondo del contenedor */
  background: #fff;          /* fondo blanco para resaltar */
  border-top: 1px solid #e0e4ec;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  z-index: 5;
}

/* Campo de texto */
.chatbot-input input {
  flex: 1;
  border: 1px solid #d8deeb;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  outline: none;
  background: #f7f9fc;
  color: #222;
  transition: all 0.25s ease;
}

.chatbot-input input:focus {
  background: #fff;
  border-color: #1f7aeb;
  box-shadow: 0 0 0 2px rgba(31,122,235,0.15);
}

/* Botón enviar */
.chatbot-input button {
  background: linear-gradient(145deg, #1f7aeb, #0c5dc0);
  color: #fff;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(31, 122, 235, 0.35);
  transition: all 0.25s ease;
}

.chatbot-input button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(31, 122, 235, 0.45);
}

/* Sombra superior sutil (para separar del chat) */
.chatbot-input::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(to top, rgba(0,0,0,0.05), transparent);
  pointer-events: none;
}

/* En móvil: asegúrate de que siempre sea visible */
@media (max-width: 768px) {
  .chatbot-input {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 0;
    padding: 10px;
    border-top: 1px solid #e0e4ec;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
  }
}


/* ==========================================================
   CORRECCIÓN FINAL — Scroll funcional del área de mensajes
   ========================================================== */
.chatbot-modal {
  display: none;
  flex-direction: column;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
  overflow: hidden;
  z-index: 1100;
  width: clamp(300px, 95vw, 380px);
  max-height: 80vh;
  position: fixed;
  right: 25px;
  bottom: 100px;
}

/* 🔹 El área de mensajes debe ocupar todo el espacio restante */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px 80px; /* espacio extra para que el input no tape texto */
  background: #f6f8fb;
  -webkit-overflow-scrolling: touch;
  height: 100%;
  max-height: calc(80vh - 60px); /* margen dinámico según el header/input */
}

/* 🔹 Ajuste móvil: ocupa toda la altura visible */
@media (max-width: 768px) {
  .chatbot-modal {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100vw;
    height: 100dvh; /* altura real visible incluso con teclado */
    border-radius: 0;
    max-height: none;
  }

  .chatbot-messages {
    max-height: calc(100dvh - 110px); /* ajusta según header + input */
    padding-bottom: 100px; /* evita que el último mensaje se tape */
  }
}


:root {
  /* altura de la caja de escribir por defecto (se sobrescribe via JS) */
  --chat-input-h: 76px;
}

/* El modal sigue como lo tienes, importante que sea flex column */
.chatbot-modal {
  display: none;
  position: fixed;
  right: 25px;
  bottom: 100px;
  width: clamp(300px, 95vw, 380px);
  max-height: 80vh;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
  overflow: hidden;
  flex-direction: column;
  z-index: 1100;
}

/* Área de mensajes: reserva SIEMPRE espacio para el input */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 12px calc(var(--chat-input-h) + env(safe-area-inset-bottom) + 12px) 12px;
  background: #f6f8fb;
}

/* Caja de escribir: fija y por encima de los mensajes */
.chatbot-input {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(0px, env(safe-area-inset-bottom));
  z-index: 1200;
  background: #fff;
  border-top: 1px solid #e0e4ec;
  display: flex;
  gap: 8px;
  padding: 10px;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.06);
}

/* En móvil, el modal a pantalla completa y sin radios */
@media (max-width: 768px) {
  .chatbot-modal {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100dvh;   /* altura real visible con teclado */
    max-height: none;
    border-radius: 0;
  }
}



/* ===============================
   ESTILO FORMULARIO — EL ELEFANTE AZUL
   =============================== */

/* Contenedor general del formulario */
#formulario {
  background: rgba(255, 255, 255, 0.05);
  padding: 20px;
  border-radius: 15px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(8px);
  color: #fff;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

/* Campos del formulario */
#formulario input,
#formulario textarea,
#formulario button {
  width: 100%;
  padding: 12px 15px 12px 45px;
  margin-bottom: 15px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  outline: none;
  transition: 0.3s ease;
}

#formulario input::placeholder,
#formulario textarea::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

/* Efecto al enfocar campos */
#formulario input:focus,
#formulario textarea:focus {
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 10px #007bff;
}

/* Íconos de cada campo */
.form-group {
  position: relative;
}

.form-group i {
  position: absolute;
  top: 50%;
  left: 15px;
  transform: translateY(-50%);
  color: #00b7ff;
  font-size: 18px;
}

/* Botón de envío */
#formulario button {
  background: linear-gradient(90deg, #007bff, #00c6ff);
  color: white;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.3s ease;
}

#formulario button:hover {
  background: linear-gradient(90deg, #00a2ff, #0095ff);
}

/* Estado del formulario */
#formStatus {
  text-align: center;
  margin-top: 10px;
  font-weight: 600;
  font-size: 15px;
  min-height: 24px;
}

#formStatus .success {
  color: #4af626;
  animation: fadeIn 0.6s ease;
}
#formStatus .error {
  color: #ff4c4c;
  animation: fadeIn 0.6s ease;
}
#formStatus .sending {
  color: #00b7ff;
  animation: fadeIn 0.6s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* reCAPTCHA centrado y adaptado */
.g-recaptcha {
  display: flex;
  justify-content: center;
  margin: 10px 0 20px;
}

/* Ajuste móvil */
@media (max-width: 480px) {
  .g-recaptcha {
    transform: scale(0.9);
    transform-origin: center;
  }
  #formulario {
    padding: 15px;
  }
  #formulario input,
  #formulario textarea {
    font-size: 14px;
  }
}


/* ===== CÓDIGOS DUPLICADOS / REVISAR =====
   (No se han detectado duplicados activos; se ha mantenido el bloque
   original tal cual y solo se ha sustituido la sección del chat,
   con selectores específicos para no afectar al resto.)
*/
