/* TEF AI Chat Widget */
#tef-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#tef-chat-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #0d6efd;
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 22px;
  box-shadow: 0 4px 18px rgba(13,110,253,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s, background .2s;
}
#tef-chat-toggle:hover {
  background: #0a58ca;
  transform: scale(1.08);
}

#tef-chat-panel {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 340px;
  max-height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(0);
  opacity: 0;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s;
  pointer-events: none;
}
#tef-chat-panel.tef-open {
  transform: scale(1);
  opacity: 1;
  pointer-events: all;
}

#tef-chat-header {
  background: #0d6efd;
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
#tef-chat-header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
#tef-chat-header-info {
  flex: 1;
  min-width: 0;
}
#tef-chat-header-title {
  font-size: 13.5px;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
}
#tef-chat-header-sub {
  font-size: 11px;
  opacity: .82;
  margin: 0;
  line-height: 1.3;
}
#tef-chat-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  opacity: .75;
  flex-shrink: 0;
}
#tef-chat-close:hover {
  opacity: 1;
}

#tef-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 180px;
  scroll-behavior: smooth;
}

.tef-msg {
  max-width: 84%;
  font-size: 13.5px;
  line-height: 1.48;
  padding: 9px 12px;
  border-radius: 14px;
  word-break: break-word;
}
.tef-msg-bot {
  background: #f0f4ff;
  color: #1a1a2e;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.tef-msg-user {
  background: #0d6efd;
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

#tef-chat-typing {
  padding: 6px 14px 8px;
  display: none;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}
.tef-dot {
  width: 7px;
  height: 7px;
  background: #0d6efd;
  border-radius: 50%;
  animation: tef-bounce .9s infinite ease-in-out;
}
.tef-dot:nth-child(2) { animation-delay: .15s; }
.tef-dot:nth-child(3) { animation-delay: .30s; }
@keyframes tef-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .6; }
  40%            { transform: translateY(-6px); opacity: 1; }
}

#tef-chat-input-row {
  display: flex;
  border-top: 1px solid #e8ecf0;
  padding: 10px;
  gap: 7px;
  flex-shrink: 0;
}
#tef-chat-input {
  flex: 1;
  border: 1px solid #dde2ea;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: border-color .2s;
  min-width: 0;
}
#tef-chat-input:focus {
  border-color: #0d6efd;
}
#tef-chat-send {
  background: #0d6efd;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 8px 15px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: background .2s;
  flex-shrink: 0;
}
#tef-chat-send:hover  { background: #0a58ca; }
#tef-chat-send:disabled { background: #9db8f4; cursor: not-allowed; }

@media (max-width: 480px) {
  #tef-chat-widget { bottom: 16px; right: 16px; }
  #tef-chat-panel  { width: calc(100vw - 32px); right: -4px; max-height: 72vh; }
}
