#tdai-chatbot,
#tdai-chatbot * {
  box-sizing: border-box;
}

#tdai-chatbot {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 999999;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

#tdai-chatbot .tdai-bubble {
  width: 52px;
  height: 52px;
  border-radius: 26px;
  background: var(--tdai-color, #9f241c);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(0,0,0,.22);
}

#tdai-chatbot .tdai-panel {
  width: 360px;
  max-width: 92vw;
  height: 460px;
  max-height: calc(100dvh - 120px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0,0,0,.25);
  overflow: hidden;
  display: none;
  flex-direction: column;
}

#tdai-chatbot .tdai-header {
  padding: 12px 14px;
  background: var(--tdai-color, #9f241c);
  color: #fff;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#tdai-chatbot .tdai-header-actions {
  display: flex;
  gap: 8px;
}

#tdai-chatbot .tdai-header button {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

#tdai-chatbot .tdai-log {
  flex: 1;
  padding: 12px 14px;
  overflow-y: auto;
  overflow-x: hidden;
  font-size: 14px;
  color: #111;
}

#tdai-chatbot .tdai-log .bot {
  margin: 10px 0;
  padding: 10px;
  background: #f3f4f6;
  border-radius: 10px;
}

#tdai-chatbot .tdai-log .you {
  margin: 10px 0;
  text-align: right;
  color: #1f2937;
}

#tdai-chatbot .tdai-credit {
  font-size: 10px;
  color: #999;
  text-align: center;
  padding: 4px 0;
}

#tdai-chatbot .tdai-input {
  padding: 10px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 8px;
}

#tdai-chatbot .tdai-input input {
  min-width: 0;
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font-size: 14px;
}

#tdai-chatbot .tdai-input button {
  padding: 10px 12px;
  border-radius: 10px;
  border: none;
  background: var(--tdai-color, #9f241c);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}

#tdai-chatbot .tdai-log,
#tdai-chatbot .tdai-log .bot,
#tdai-chatbot .tdai-log .you {
  overflow-wrap: anywhere;
  word-break: break-word;
}

#tdai-chatbot .tdai-sources {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #ddd;
  font-size: 13px;
}

#tdai-chatbot .tdai-source {
  margin-top: 6px;
}

#tdai-chatbot .tdai-source a {
  color: var(--tdai-color, #9f241c);
  text-decoration: none;
  font-weight: 600;
}

#tdai-chatbot .tdai-source a:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  #tdai-chatbot {
    left: 4vw;
    right: auto;
    bottom: 90px;
    width: 92vw;
  }

  #tdai-chatbot .tdai-panel {
    width: 92vw;
    height: min(520px, calc(100dvh - 170px));
  }

  #tdai-chatbot .tdai-input input {
    font-size: 16px;
  }
}

#tdai-chatbot .tdai-search-mode {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #ececec;
  background: #fafafa;
}

#tdai-chatbot .tdai-mode {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--tdai-color, #9f241c);
  border-radius: 8px;
  background: #fff;
  color: var(--tdai-color, #9f241c);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s ease;
}

#tdai-chatbot .tdai-mode:hover {
  background: rgba(159, 36, 28, .08);
}

#tdai-chatbot .tdai-mode.active {
  background: var(--tdai-color, #9f241c);
  color: #fff;
}

#tdai-chatbot.tdai-chatbot--pro .tdai-panel {
  height: 520px;
}

#tdai-chatbot .tdai-mode.is-disabled,
#tdai-chatbot .tdai-mode:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#tdai-chatbot .tdai-product-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

#tdai-chatbot .tdai-product-card {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e2e2;
}

#tdai-chatbot .tdai-product-card img {
  width: 78px;
  height: 78px;
  object-fit: cover;
  border-radius: 8px;
}

#tdai-chatbot .tdai-product-card-body {
  min-width: 0;
}

#tdai-chatbot .tdai-product-title {
  display: block;
  font-weight: 700;
  color: var(--tdai-color, #9f241c);
  text-decoration: none;
  margin-bottom: 4px;
}

#tdai-chatbot .tdai-product-price {
  font-weight: 700;
  margin-bottom: 4px;
}

#tdai-chatbot .tdai-product-stock {
  font-size: 13px;
  color: #666;
  margin-bottom: 8px;
}

#tdai-chatbot .tdai-product-button {
  display: inline-block;
  padding: 6px 10px;
  background: var(--tdai-color, #9f241c);
  color: #fff;
  border-radius: 7px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

#tdai-chatbot .tdai-product-button:hover {
  opacity: .9;
}

@media (max-width: 480px) {
  #tdai-chatbot .tdai-product-card {
    grid-template-columns: 64px 1fr;
  }

  #tdai-chatbot .tdai-product-card img {
    width: 64px;
    height: 64px;
  }

  #tdai-chatbot .tdai-mode {
    padding: 8px 9px;
    font-size: 12px;
  }
}