/* ================================================================
   chatbot.css — Estilos del asesor virtual EndoTraining
   Enlazado desde chatbot_widget.php
================================================================= */

:root {
    --et-primary: #05323c;
    /* verde petróleo profundo (color de marca) */
    --et-primary-soft: #47616a;
    /* texto suave de marca */
    --et-secondary: #529aab;
    /* azul-verdoso de acento (color de marca) */
    --et-secondary-dk: #3d7d8c;
    /* acento oscurecido para hover */
    --et-paper: #ffffff;
    --et-mist: #f4f3f2;
    /* fondo cálido de marca */
    --et-line: rgba(5, 50, 60, .12);
    /* borde de marca */
    --et-user: #05323c;
    --et-font: 'Inter', system-ui, sans-serif;
    --et-font-display: 'Montserrat', sans-serif;
  }

  #et-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99998;
    /* Botón con texto para captar más atención que el de WhatsApp. */
    height: 60px;
    border-radius: 50px;
    background: var(--et-secondary);
    color: #fff;
    border: 1px solid var(--et-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 22px 0 20px;
    cursor: pointer;
    box-shadow: 0 12px 34px rgba(5, 50, 60, .34);
    transition: transform .18s ease, box-shadow .18s ease;
    font-size: 22px;
    font-family: var(--et-font);
    animation: etPulse 2.4s ease-in-out infinite;
  }

  #et-launcher .et-launcher-text {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    font-family: var(--et-font-display);
  }

  @keyframes etPulse {

    0%,
    100% {
      transform: translateY(0);
      box-shadow: 0 12px 34px rgba(5, 50, 60, .34);
    }

    50% {
      transform: translateY(-5px);
      box-shadow: 0 18px 42px rgba(5, 50, 60, .42);
    }
  }

  #et-launcher:hover {
    animation: none;
    transform: translateY(-3px);
    box-shadow: 0 18px 44px rgba(5, 50, 60, .44);
  }

  #et-launcher:focus-visible {
    outline: 2px solid var(--et-secondary);
    outline-offset: 3px;
  }

  #et-panel {
    position: fixed;
    bottom: 96px;
    right: 24px;
    z-index: 99999;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 130px);
    background: var(--et-paper);
    border: 1px solid var(--et-line);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(5, 50, 60, .16);
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: var(--et-font);
  }

  #et-panel.et-open {
    display: flex;
    animation: etIn .22s ease;
  }

  @keyframes etIn {
    from {
      opacity: 0;
      transform: translateY(10px);
    }

    to {
      opacity: 1;
      transform: none;
    }
  }

  .et-head {
    background: var(--et-primary);
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .et-head .et-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #fff;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .et-avatar-img {
    width: 26px;
    height: 26px;
    object-fit: contain;
    display: block;
  }

  .et-head .et-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .2px;
  }

  .et-head .et-sub {
    font-size: 12px;
    opacity: .75;
    font-family: var(--et-font);
  }

  .et-head .et-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    opacity: .8;
  }

  .et-head .et-close:hover {
    opacity: 1;
  }

  .et-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    background: var(--et-mist);
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .et-msg {
    max-width: 82%;
    padding: 11px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    font-family: var(--et-font);
    white-space: pre-wrap;
    word-wrap: break-word;
  }

  .et-bot {
    background: #fff;
    color: var(--et-primary);
    border: 1px solid var(--et-line);
    border-bottom-left-radius: 4px;
    align-self: flex-start;
  }

  .et-bot strong {
    font-weight: 600;
    color: var(--et-primary);
  }

  .et-bot em {
    font-style: italic;
  }

  .et-user {
    background: var(--et-user);
    color: #fff;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
  }

  .et-typing {
    display: flex;
    gap: 4px;
    padding: 12px 14px;
    align-self: flex-start;
  }

  .et-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--et-primary-soft);
    opacity: .4;
    animation: etBlink 1.2s infinite;
  }

  .et-typing span:nth-child(2) {
    animation-delay: .2s;
  }

  .et-typing span:nth-child(3) {
    animation-delay: .4s;
  }

  @keyframes etBlink {

    0%,
    60%,
    100% {
      opacity: .25;
    }

    30% {
      opacity: .9;
    }
  }

  /* Formulario de lead */
  .et-lead {
    background: #fff;
    border: 1px solid var(--et-line);
    border-radius: 14px;
    padding: 14px;
    align-self: stretch;
    font-family: var(--et-font);
  }

  .et-lead h4 {
    margin: 0 0 4px;
    font-family: var(--et-font-display);
    color: var(--et-primary);
    font-size: 14px;
  }

  .et-lead p {
    margin: 0 0 10px;
    font-size: 12px;
    color: var(--et-primary-soft);
  }

  .et-lead input {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 8px;
    padding: 9px 11px;
    border: 1px solid var(--et-line);
    border-radius: 9px;
    font-size: 13px;
  }

  .et-lead input:focus {
    outline: none;
    border-color: var(--et-secondary);
  }

  .et-lead button {
    width: 100%;
    padding: 10px;
    background: var(--et-secondary);
    color: var(--et-primary);
    border: none;
    border-radius: 9px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    font-family: var(--et-font-display);
  }

  .et-lead button:hover {
    background: var(--et-secondary-dk);
    color: #fff;
  }

  .et-lead .et-ok {
    color: #1a7d4a;
    font-size: 13px;
    text-align: center;
    padding: 6px;
  }

  .et-foot {
    border-top: 1px solid var(--et-line);
    background: #fff;
    padding: 10px 12px;
    display: flex;
    gap: 8px;
    align-items: flex-end;
  }

  .et-foot textarea {
    flex: 1;
    resize: none;
    border: 1px solid var(--et-line);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: var(--et-font);
    max-height: 100px;
    line-height: 1.4;
  }

  .et-foot textarea:focus {
    outline: none;
    border-color: var(--et-secondary);
  }

  .et-foot .et-send {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 10px;
    background: var(--et-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 15px;
  }

  .et-foot .et-send:hover {
    background: #1b3149;
  }

  .et-foot .et-send:disabled {
    opacity: .5;
    cursor: default;
  }

  @media (max-width:600px) {
    /* Bloquea el scroll de la web de fondo cuando el chat está abierto. */
    body.et-no-scroll {
      overflow: hidden;
    }

    /* En móvil, el chat ocupa toda la pantalla (estilo WhatsApp). */
    #et-panel {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: auto;
      width: 100%;
      max-width: 100%;
      height: 100dvh;
      max-height: none;
      border-radius: 0;
      border: none;
    }

    /* Cabecera fija arriba, sin recortes. */
    .et-head {
      padding: 14px 16px;
      padding-top: max(14px, env(safe-area-inset-top));
      flex-shrink: 0;
    }

    /* Botón de cerrar grande y cómodo de tocar. */
    .et-head .et-close {
      font-size: 24px;
      padding: 4px 8px;
    }

    /* El cuerpo ocupa el espacio central y hace scroll. */
    .et-body {
      flex: 1;
      -webkit-overflow-scrolling: touch;
    }

    /* Input fijo abajo, respetando la zona segura del móvil. */
    .et-foot {
      flex-shrink: 0;
      padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    /* Botón flotante compacto (círculo). */
    #et-launcher {
      right: 16px;
      bottom: 16px;
      width: 58px;
      padding: 0;
      justify-content: center;
    }

    #et-launcher .et-launcher-text {
      display: none;
    }

    /* Evita el zoom automático de Safari iOS: los campos deben tener
       al menos 16px de fuente para que el navegador no haga zoom al enfocarlos. */
    .et-foot textarea,
    .et-lead input {
      font-size: 16px;
    }
  }
