/* =========================================================
   EMBEDDED CHATBOT (HERO / PAGE)
========================================================= */

#tcd-bot-hero .tcd-hero-bot {
  max-width: 560px;
  margin-top: 20px;
}

#tcd-bot-hero .tcd-hero-messages {
  margin-bottom: 12px;
}

#tcd-bot-hero .tcd-msg {
  margin-bottom: 10px;
  line-height: 1.5;
}

#tcd-bot-hero .tcd-user {
  text-align: right;
  font-weight: 600;
}

#tcd-bot-hero .tcd-bot {
  opacity: 0.9;
}

#tcd-bot-hero .tcd-hero-inputbar {
  display: flex;
  gap: 8px;
}

#tcd-bot-hero .tcd-hero-inputbar textarea {
  flex: 1;
  resize: none;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid #ddd;
  background: #ffffff;
}

#tcd-bot-hero .tcd-hero-inputbar button {
  padding: 12px 18px;
  min-height: 44px;
  border-radius: 10px;
  border: none;
  background: #F8B84A;
  color: #000;
  font-weight: 700;
  cursor: pointer;
}

#tcd-bot-hero .tcd-typing span {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #000;
  border-radius: 50%;
  margin-right: 4px;
  animation: blink 1.4s infinite both;
}

@keyframes blink {
  0%   { opacity: .2; }
  20%  { opacity: 1;  }
  100% { opacity: .2; }
}

/* ---------------------------------------------------------
   HERO CHAT PANEL
--------------------------------------------------------- */

#tcd-bot-hero .tcd-hero-chat-panel {
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 12px;
  border-radius: 12px;
}

#tcd-bot-hero .tcd-hero-chat-panel.is-empty {
  display: none;
}

#tcd-bot-hero .tcd-hero-chat-panel.is-active {
  display: block;
  background: #ffffff;
  padding: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}

/* =========================================================
   FLOATING CHATBOT (GLOBAL)
========================================================= */

#tcd-assistant {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483647;
}

#tcd-assistant .tcd-panel {
  display: none;
  position: fixed;
  right: 20px;
  bottom: 110px;
  width: 380px;
  height: clamp(520px, 75vh, 720px);
  flex-direction: column;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.22);
  font-family: system-ui, -apple-system, sans-serif;
  overflow: hidden;
  box-sizing: border-box;
}

#tcd-assistant .tcd-panel.is-open {
  display: flex;
}

/* =========================================================
   HEADER
========================================================= */

#tcd-assistant .tcd-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1F1F25;
  padding: 14px 16px;
  color: #ffffff;
  border-radius: 16px 16px 0 0;
}

#tcd-assistant .tcd-bot-logo {
  height: 28px;
  width: auto;
}

#tcd-assistant .tcd-actions {
  display: flex;
  gap: 8px;
}

#tcd-assistant .tcd-close {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

#tcd-assistant .tcd-reset {
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 16px;
  opacity: 0.7;
  color: #ffffff;
  padding: 4px;
}

#tcd-assistant .tcd-reset:hover {
  opacity: 1;
}

/* =========================================================
   STICKY QUICK-ACTION BUTTONS
========================================================= */

#tcd-assistant .tcd-sticky-btns {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #f5f5f5;
  border-bottom: 1px solid #ebebeb;
}

#tcd-assistant .tcd-sticky-btn {
  flex: 1;
  display: block;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  text-align: center;
  border-radius: 8px;
  background: #ffffff;
  color: #1F1F25;
  border: 1px solid #ddd;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#tcd-assistant .tcd-sticky-btn:hover {
  background: #f0f0f0;
  border-color: #bbb;
  color: #1F1F25;
}

#tcd-assistant .tcd-sticky-btn--primary {
  background: #FD8F14;
  color: #1F1F25;
  border-color: #FD8F14;
}

#tcd-assistant .tcd-sticky-btn--primary:hover {
  background: #e07c0d;
  border-color: #e07c0d;
  color: #1F1F25;
}

/* =========================================================
   MESSAGE AREA
========================================================= */

#tcd-assistant .tcd-chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #fafafa;
}

#tcd-assistant .tcd-msg {
  margin-bottom: 10px;
  padding: 12px;
  border-radius: 12px;
  font-size: 15px;
  max-width: 85%;
  line-height: 1.5;
  word-wrap: break-word;
}

#tcd-assistant .tcd-msg.tcd-user {
  background: #FFBB46;
  margin-left: auto;
}

#tcd-assistant .tcd-msg.tcd-bot {
  background: #ffffff;
  border: 1px solid #eee;
}

/* =========================================================
   INPUT BAR
========================================================= */

#tcd-assistant .tcd-inputbar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  background: #ffffff;
  border-top: 1px solid #eeeeee;
}

#tcd-assistant .tcd-inputbar textarea {
  flex: 1;
  border: 1px solid #e4e4e4;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px;
  resize: none;
  font-family: inherit;
  line-height: 1.4;
}

#tcd-assistant .tcd-inputbar textarea:focus {
  outline: none;
  border-color: #FD8F14;
}

#tcd-assistant .tcd-send {
  background: #FD8F14;
  color: #1F1F25;
  font-weight: 700;
  border-radius: 12px;
  padding: 12px 15px;
  border: none;
  cursor: pointer;
  font-size: 15px;
  transition: background 0.18s ease;
  white-space: nowrap;
}

#tcd-assistant .tcd-send:hover {
  background: #e07c0d;
}

/* =========================================================
   BUBBLE TRIGGER
========================================================= */

#tcd-assistant .tcd-bubble {
  width: 80px !important;
  height: 80px !important;
  min-width: 80px !important;
  min-height: 80px !important;
  padding: 0 !important;
  border: none !important;
  background: none !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#tcd-assistant .tcd-bubble-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* =========================================================
   TYPING INDICATOR
========================================================= */

.tcd-loading {
  opacity: 0.8;
}

.tcd-typing {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.tcd-typing span {
  width: 8px;
  height: 8px;
  background: #999;
  border-radius: 50%;
  display: inline-block;
  animation: tcd-bounce 1.4s infinite ease-in-out both;
}

.tcd-typing span:nth-child(1) { animation-delay: -0.32s; }
.tcd-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes tcd-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40%            { transform: scale(1); }
}

/* =========================================================
   MOBILE ADJUSTMENTS
========================================================= */

@media (max-width: 768px) {

  /* Fullscreen panel on mobile */
  #tcd-assistant .tcd-panel {
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    border-radius: 0 !important;
  }

  #tcd-assistant .tcd-panel-header {
    border-radius: 0 !important;
  }

  /* Hero bot: stack input */
  #tcd-bot-hero .tcd-hero-inputbar {
    flex-direction: column;
    gap: 10px;
  }

  #tcd-bot-hero #tcd-hero-send {
    width: 100%;
    padding: 14px 18px;
    font-size: 16px;
    min-height: 48px;
  }

  #tcd-bot-hero .tcd-reset {
    align-self: flex-end;
    padding: 8px 12px;
    font-size: 15px;
    min-height: 36px;
    opacity: 0.6;
    background: none;
    border: none;
  }

  #tcd-bot-hero .tcd-reset:hover {
    opacity: 1;
  }

  /* Sticky buttons: full-width stack on very small screens */
  #tcd-assistant .tcd-sticky-btns {
    flex-direction: column;
    gap: 6px;
  }
}
