/* ============================================================
   Chatbot UI — Tesis Aslan
   Se carga con:
   <link rel="stylesheet" href="css/chatbot.css"
         media="print" onload="this.media='all'">
   ============================================================ */

/* ── FAB (botón flotante) ─────────────────────────────────── */
#ta-cb-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: #641B2E;
  color: #FBDB93;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
  transition: transform .2s, box-shadow .2s;
}
#ta-cb-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .4);
}
#ta-cb-fab.ta-cb-fab-hidden { display: none; }

/* ── Panel del chat ───────────────────────────────────────── */
#ta-cb-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  width: 380px;
  max-height: 520px;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .25);
  font-family: 'Pridi', 'Merriweather', serif;
  transition: opacity .25s, transform .25s;
}
#ta-cb-panel.ta-cb-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(.96);
}

/* ── Header ───────────────────────────────────────────────── */
#ta-cb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #641B2E;
  color: #fff;
}
#ta-cb-header-info { display: flex; flex-direction: column; gap: 2px; }
#ta-cb-header-info strong { font-family: 'Teko', sans-serif; font-size: 1.15rem; letter-spacing: .5px; }
#ta-cb-header-info span { font-size: .72rem; opacity: .75; }
#ta-cb-close {
  background: none;
  border: none;
  color: #FBDB93;
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}
#ta-cb-close:hover { opacity: .7; }

/* ── Área de mensajes ─────────────────────────────────────── */
#ta-cb-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 200px;
  max-height: 320px;
  background: #f8f6f4;
}

/* ── Burbujas ─────────────────────────────────────────────── */
.ta-cb-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: .85rem;
  line-height: 1.45;
  word-wrap: break-word;
  animation: ta-cb-fade-in .25s ease;
}
.ta-cb-bot {
  align-self: flex-start;
  background: #eee7df;
  color: #333;
  border-bottom-left-radius: 4px;
}
.ta-cb-user {
  align-self: flex-end;
  background: #641B2E;
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* ── Typing indicator ─────────────────────────────────────── */
.ta-cb-typing { display: flex; gap: 5px; padding: 12px 18px; }
.ta-cb-typing span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #999;
  animation: ta-cb-bounce .6s infinite alternate;
}
.ta-cb-typing span:nth-child(2) { animation-delay: .2s; }
.ta-cb-typing span:nth-child(3) { animation-delay: .4s; }

@keyframes ta-cb-bounce {
  to { transform: translateY(-6px); opacity: .5; }
}
@keyframes ta-cb-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Escape a WhatsApp ────────────────────────────────────── */
#ta-cb-wa {
  padding: 8px 16px;
  background: #f0ede9;
  border-top: 1px solid #e0dbd5;
}
#ta-cb-wa a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #25D366;
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .2s;
}
#ta-cb-wa a:hover { background: #1ebe5a; }
#ta-cb-wa a svg { flex-shrink: 0; }

/* ── Formulario de entrada ────────────────────────────────── */
#ta-cb-form {
  display: flex;
  padding: 10px 12px;
  gap: 8px;
  background: #fff;
  border-top: 1px solid #e8e4df;
}
#ta-cb-input {
  flex: 1;
  border: 1px solid #d5d0ca;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: .85rem;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
}
#ta-cb-input:focus { border-color: #641B2E; }
#ta-cb-form button[type="submit"] {
  background: #641B2E;
  color: #FBDB93;
  border: none;
  border-radius: 8px;
  width: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
#ta-cb-form button[type="submit"]:hover { background: #8A2D3B; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 480px) {
  #ta-cb-panel {
    bottom: 0;
    right: 0;
    width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
  }
  #ta-cb-messages { max-height: 55dvh; }
  #ta-cb-fab { bottom: 16px; right: 16px; }
}

/* ── Accesibilidad: prefers-reduced-motion ────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ta-cb-msg,
  #ta-cb-panel,
  #ta-cb-fab,
  .ta-cb-typing span { animation: none !important; transition: none !important; }
}
