/* ========================================
       CHATBOT FLOTANTE
       ======================================== */

    /* Burbuja de apertura */
    .chat-bubble {
      position: fixed;
      bottom: 28px;
      right: 28px;
      z-index: 9999;
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 12px;
    }

    /* Tooltip inicial */
    .chat-bubble__tooltip {
      background: #1a1a2e;
      border: 1px solid rgba(102,126,234,0.25);
      border-radius: 12px 12px 4px 12px;
      padding: 10px 14px;
      max-width: 200px;
      animation: tooltipIn 0.4s ease 1.5s both;
      cursor: pointer;
    }
    .chat-bubble__tooltip p {
      font-size: 0.8rem;
      color: rgba(255,255,255,0.85);
      line-height: 1.4;
      margin: 0;
    }
    .chat-bubble__tooltip strong {
      color: #00E6A8;
      font-weight: 600;
    }
    @keyframes tooltipIn {
      from { opacity: 0; transform: translateY(8px) scale(0.95); }
      to   { opacity: 1; transform: translateY(0) scale(1); }
    }

    /* Botón principal */
    .chat-bubble__btn {
      width: 58px;
      height: 58px;
      border-radius: 50%;
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      border: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 4px 24px rgba(102,126,234,0.45);
      transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.3s ease;
      position: relative;
    }
    .chat-bubble__btn:hover {
      transform: scale(1.1);
      box-shadow: 0 8px 32px rgba(102,126,234,0.6);
    }
    .chat-bubble__btn svg {
      width: 26px; height: 26px;
      transition: transform 0.3s ease, opacity 0.3s ease;
    }
    .chat-bubble__btn .icon-chat  { position: absolute; }
    .chat-bubble__btn .icon-close { position: absolute; opacity: 0; transform: rotate(-90deg); }

    /* Estado abierto */
    .chat-bubble__btn.is-open .icon-chat  { opacity: 0; transform: rotate(90deg); }
    .chat-bubble__btn.is-open .icon-close { opacity: 1; transform: rotate(0deg); }

    /* Punto de notificación */
    .chat-bubble__dot {
      position: absolute;
      top: 2px; right: 2px;
      width: 12px; height: 12px;
      background: #00E6A8;
      border-radius: 50%;
      border: 2px solid #09090b;
      animation: dotPulse 2s ease-in-out infinite;
    }
    @keyframes dotPulse {
      0%,100% { box-shadow: 0 0 0 0 rgba(0,230,168,0.4); }
      50%      { box-shadow: 0 0 0 5px rgba(0,230,168,0); }
    }

    /* ── Ventana del chat ── */
    .chat-window {
      position: fixed;
      bottom: 100px;
      right: 28px;
      width: 340px;
      max-height: 520px;
      background: #0e0e16;
      border: 1px solid rgba(102,126,234,0.2);
      border-radius: 20px;
      overflow: hidden;
      z-index: 9998;
      display: flex;
      flex-direction: column;
      box-shadow: 0 24px 64px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
      transform: scale(0.92) translateY(16px);
      opacity: 0;
      pointer-events: none;
      transform-origin: bottom right;
      transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.25s ease;
    }
    .chat-window.is-open {
      transform: scale(1) translateY(0);
      opacity: 1;
      pointer-events: all;
    }

    /* Header */
    .chat-window__header {
      padding: 16px 18px;
      background: linear-gradient(135deg, rgba(102,126,234,0.15) 0%, rgba(118,75,162,0.1) 100%);
      border-bottom: 1px solid rgba(255,255,255,0.06);
      display: flex;
      align-items: center;
      gap: 12px;
    }
    .chat-header__avatar {
      width: 40px; height: 40px;
      border-radius: 50%;
      background: linear-gradient(135deg, #667eea, #764ba2);
      display: flex; align-items: center; justify-content: center;
      font-size: 1.1rem;
      flex-shrink: 0;
      position: relative;
    }
    .chat-header__avatar::after {
      content: '';
      position: absolute;
      bottom: 1px; right: 1px;
      width: 9px; height: 9px;
      background: #00E6A8;
      border-radius: 50%;
      border: 2px solid #0e0e16;
    }
    .chat-header__info { flex: 1; }
    .chat-header__name {
      font-size: 0.875rem;
      font-weight: 700;
      color: #fff;
      margin: 0 0 2px;
    }
    .chat-header__status {
      font-size: 0.7rem;
      color: #00E6A8;
      margin: 0;
      display: flex; align-items: center; gap: 4px;
    }
    .chat-header__status::before {
      content: '';
      width: 5px; height: 5px;
      background: #00E6A8;
      border-radius: 50%;
      display: inline-block;
    }

    /* Mensajes */
    .chat-window__messages {
      flex: 1;
      overflow-y: auto;
      padding: 16px 14px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      scrollbar-width: thin;
      scrollbar-color: rgba(255,255,255,0.1) transparent;
    }

    .msg {
      max-width: 82%;
      animation: msgIn 0.3s ease both;
    }
    @keyframes msgIn {
      from { opacity: 0; transform: translateY(6px); }
      to   { opacity: 1; transform: translateY(0); }
    }
    .msg--bot { align-self: flex-start; }
    .msg--user { align-self: flex-end; }

    .msg__bubble {
      padding: 9px 13px;
      border-radius: 16px;
      font-size: 0.82rem;
      line-height: 1.5;
    }
    .msg--bot .msg__bubble {
      background: rgba(255,255,255,0.07);
      color: rgba(255,255,255,0.88);
      border-radius: 4px 16px 16px 16px;
    }
    .msg--user .msg__bubble {
      background: linear-gradient(135deg, #667eea, #764ba2);
      color: #fff;
      border-radius: 16px 4px 16px 16px;
    }
    .msg__time {
      font-size: 0.62rem;
      color: rgba(255,255,255,0.25);
      margin-top: 3px;
      padding: 0 4px;
    }
    .msg--user .msg__time { text-align: right; }

    /* Typing indicator */
    .typing {
      display: flex; align-items: center; gap: 4px;
      padding: 10px 13px;
      background: rgba(255,255,255,0.07);
      border-radius: 4px 16px 16px 16px;
      width: fit-content;
      align-self: flex-start;
    }
    .typing span {
      width: 6px; height: 6px;
      background: rgba(255,255,255,0.4);
      border-radius: 50%;
      animation: typingDot 1.2s ease-in-out infinite;
    }
    .typing span:nth-child(2) { animation-delay: 0.2s; }
    .typing span:nth-child(3) { animation-delay: 0.4s; }
    @keyframes typingDot {
      0%,60%,100% { transform: translateY(0); opacity: 0.4; }
      30%          { transform: translateY(-5px); opacity: 1; }
    }

    /* Opciones rápidas */
    .chat-options {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      padding: 0 14px 4px;
    }
    .chat-option {
      background: rgba(102,126,234,0.1);
      border: 1px solid rgba(102,126,234,0.25);
      border-radius: 20px;
      padding: 6px 12px;
      font-size: 0.75rem;
      color: rgba(255,255,255,0.8);
      cursor: pointer;
      transition: all 0.2s ease;
      font-family: inherit;
    }
    .chat-option:hover {
      background: rgba(102,126,234,0.2);
      border-color: rgba(102,126,234,0.5);
      color: #fff;
      transform: translateY(-1px);
    }
    .chat-option:active { transform: scale(0.97); }

    /* Footer — botón WhatsApp */
    .chat-window__footer {
      padding: 12px 14px 14px;
      border-top: 1px solid rgba(255,255,255,0.05);
    }
    .chat-wa-btn {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      width: 100%;
      padding: 11px;
      background: #25D366;
      color: #fff;
      border: none;
      border-radius: 12px;
      font-family: inherit;
      font-size: 0.85rem;
      font-weight: 700;
      cursor: pointer;
      text-decoration: none;
      transition: all 0.2s ease;
      box-shadow: 0 4px 16px rgba(37,211,102,0.3);
    }
    .chat-wa-btn:hover {
      background: #20bd5a;
      box-shadow: 0 6px 20px rgba(37,211,102,0.45);
      transform: translateY(-1px);
    }
    .chat-wa-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

    /* Responsive móvil */
    @media (max-width: 480px) {
      .chat-window {
        right: 12px;
        bottom: 90px;
        width: calc(100vw - 24px);
      }
      .chat-bubble { right: 16px; bottom: 20px; }
    }