/* TFA chatbot widget styles. Self-contained, prefixed with .tfa-bot. */

.tfa-bot-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9000;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #003087, #001f5c);
  color: #fff;
  border: 0;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 31, 92, 0.35), 0 2px 6px rgba(0,0,0,0.12);
  display: grid;
  place-items: center;
  transition: transform .2s ease, box-shadow .2s ease;
  font-family: 'Inter', system-ui, sans-serif;
}
.tfa-bot-launcher:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(0,31,92,.4); }
.tfa-bot-launcher svg { width: 28px; height: 28px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tfa-bot-launcher .badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #B4091A;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 100px;
  border: 2px solid #fff;
  min-width: 18px;
  text-align: center;
}

.tfa-bot-panel {
  position: fixed;
  right: 20px;
  bottom: 96px;
  z-index: 9001;
  width: min(380px, calc(100vw - 32px));
  height: min(580px, calc(100vh - 140px));
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,.18), 0 4px 14px rgba(0,0,0,.08);
  overflow: hidden;
  display: none;
  flex-direction: column;
  transform-origin: bottom right;
  font-family: 'Inter', system-ui, sans-serif;
  color: #2d3940;
}
.tfa-bot-panel.open { display: flex; animation: tfaBotIn .25s cubic-bezier(.2,.8,.2,1); }
@keyframes tfaBotIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.tfa-bot-header {
  background: linear-gradient(135deg, #003087, #001f5c);
  color: #fff;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.tfa-bot-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: grid;
  place-items: center;
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}
.tfa-bot-title { flex: 1; }
.tfa-bot-title .name { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 0.98rem; letter-spacing: 0.02em; }
.tfa-bot-title .status { font-size: 0.74rem; opacity: 0.85; display: flex; align-items: center; gap: 6px; }
.tfa-bot-title .status::before { content:''; width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 6px rgba(74,222,128,.6); }
.tfa-bot-close { background: transparent; border: 0; color: #fff; opacity: 0.7; cursor: pointer; padding: 4px; }
.tfa-bot-close:hover { opacity: 1; }

.tfa-bot-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 12px;
  background: linear-gradient(180deg, #fafbfc 0%, #ffffff 80px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tfa-bot-msg { max-width: 84%; line-height: 1.45; font-size: 0.9rem; padding: 10px 14px; border-radius: 14px; word-wrap: break-word; }
.tfa-bot-msg.bot { background: #eef2f7; color: #1f2937; border-bottom-left-radius: 4px; align-self: flex-start; }
.tfa-bot-msg.user { background: #003087; color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; }
.tfa-bot-msg.system { background: transparent; color: #6b7280; font-size: 0.78rem; align-self: center; text-align: center; }
.tfa-bot-typing { display: inline-flex; gap: 4px; padding: 12px 16px; }
.tfa-bot-typing span { width: 6px; height: 6px; border-radius: 50%; background: #94a3b8; animation: tfaBotDot 1.2s infinite; }
.tfa-bot-typing span:nth-child(2){animation-delay:.15s}
.tfa-bot-typing span:nth-child(3){animation-delay:.3s}
@keyframes tfaBotDot { 0%,80%,100%{opacity:.3;transform:translateY(0)} 40%{opacity:1;transform:translateY(-3px)} }

.tfa-bot-handoff {
  margin-top: 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.84rem;
  color: #92400e;
}
.tfa-bot-handoff h4 { margin: 0 0 6px; font-family: 'Montserrat', sans-serif; font-size: 0.84rem; font-weight: 700; color: #9a3412; }
.tfa-bot-handoff-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.tfa-bot-handoff-actions a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: #fff;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  font-size: 0.82rem;
  color: #B4091A;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s ease;
}
.tfa-bot-handoff-actions a:hover { background: #fef3c7; }
.tfa-bot-handoff-actions a span { color: #6b7280; font-weight: 500; font-size: 0.76rem; }

.tfa-bot-connect-btn {
  width: 100%;
  background: linear-gradient(135deg, #003087, #001f5c);
  color: #fff;
  border: 0;
  padding: 11px 16px;
  border-radius: 8px;
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.86rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
  box-shadow: 0 4px 12px rgba(0,31,92,.18);
}
.tfa-bot-connect-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,31,92,.28); }
.tfa-bot-connect-btn:disabled { opacity: 0.7; cursor: wait; }
.tfa-bot-handoff-error { margin-top: 10px; font-size: 0.78rem; color: #991b1b; }

.tfa-bot-input {
  padding: 12px 14px 14px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}
.tfa-bot-input form { display: flex; gap: 8px; align-items: flex-end; }
.tfa-bot-input textarea {
  flex: 1;
  resize: none;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  max-height: 100px;
  min-height: 40px;
  outline: none;
  transition: border .15s ease;
}
.tfa-bot-input textarea:focus { border-color: #003087; box-shadow: 0 0 0 3px rgba(0,48,135,.12); }
.tfa-bot-input button {
  background: #B4091A;
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
  font-family: 'Montserrat', sans-serif;
  transition: background .15s ease;
}
.tfa-bot-input button:hover:not(:disabled) { background: #9e1e28; }
.tfa-bot-input button:disabled { opacity: 0.5; cursor: not-allowed; }
.tfa-bot-disclaimer { font-size: 0.7rem; color: #9ca3af; text-align: center; margin-top: 8px; }

@media (max-width: 480px) {
  .tfa-bot-panel { right: 8px; bottom: 88px; width: calc(100vw - 16px); height: calc(100vh - 120px); border-radius: 14px; }
  .tfa-bot-launcher { right: 12px; bottom: 12px; }
}
