/* ===== ZenTechCX Chatbot Widget ===== */

.ztcx-chat-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background-color: var(--orange, #ff7a00);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.4);
  z-index: 1200;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.ztcx-chat-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.5);
}

.ztcx-chat-launcher.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ===== Chat Window (FIXED HEIGHT + FLEX LAYOUT) ===== */

.ztcx-chat-window {
  position: fixed;
  right: 24px;
  bottom: 90px;
  width: 360px;
  max-width: calc(100% - 40px);
  max-height: calc(100vh - 140px);   /* ✅ KEY FIX */
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 22px 45px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;                 /* ✅ CRITICAL */
  z-index: 1199;
  transform: translateY(120%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
  font-family: inherit;
}

.ztcx-chat-window.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ===== Header (ALWAYS VISIBLE) ===== */

.ztcx-chat-header {
  flex-shrink: 0;                   /* ✅ FIX */
  padding: 12px 14px;
  background: var(--footer-bg, #0b1120);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ztcx-chat-title {
  font-size: 0.98rem;
  font-weight: 700;
}

.ztcx-chat-subtitle {
  font-size: 0.78rem;
  color: #9ca3af;
}

.ztcx-chat-close {
  background: transparent;
  border: none;
  color: #9ca3af;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0 4px;
}

/* ===== Body (ONLY THIS SCROLLS) ===== */

.ztcx-chat-body {
  flex: 1;                          /* ✅ FIX */
  padding: 10px 12px 8px;
  overflow-y: auto;                 /* ✅ FIX */
  background: linear-gradient(135deg, #f9fafb, #f3f4f6);
}

/* ===== Messages ===== */

.ztcx-chat-message-row {
  display: flex;
  margin-bottom: 6px;
}

.ztcx-chat-message-row.user {
  justify-content: flex-end;
}

.ztcx-chat-message-row.assistant {
  justify-content: flex-start;
}

.ztcx-chat-message {
  max-width: 80%;
  padding: 8px 11px;
  border-radius: 14px;
  font-size: 0.85rem;
  line-height: 1.4;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.12);
  white-space: pre-line;
}

.ztcx-chat-message.user {
  background: var(--orange, #ff7a00);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.ztcx-chat-message.assistant {
  background: #ffffff;
  color: #111827;
  border-bottom-left-radius: 4px;
}

/* ===== Typing indicator ===== */

.ztcx-chat-typing {
  font-size: 0.78rem;
  color: #6b7280;
  padding: 2px 4px 6px;
}

/* ===== Quick Actions (FIXED AT BOTTOM) ===== */

.ztcx-chat-quick-actions {
  flex-shrink: 0;                   /* ✅ FIX */
  display: flex;
  gap: 8px;
  padding: 6px 12px 4px;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
}

.ztcx-chat-quick-btn {
  flex: 1;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  font-size: 0.78rem;
  padding: 6px 8px;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.ztcx-chat-quick-btn:hover {
  background: #eef2ff;
  border-color: var(--orange, #ff7a00);
  transform: translateY(-1px);
}

/* ===== Input Row (FIXED AT BOTTOM) ===== */

.ztcx-chat-input-row {
  flex-shrink: 0;                    /* ✅ FIX */
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px 10px;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
}

.ztcx-chat-input {
  flex: 1;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  padding: 7px 11px;
  font-size: 0.85rem;
  outline: none;
  font-family: inherit;
}

.ztcx-chat-input:focus {
  border-color: var(--orange, #ff7a00);
  box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.25);
}

.ztcx-chat-send-btn {
  border-radius: 999px;
  background: var(--orange, #ff7a00);
  border: none;
  color: #ffffff;
  font-size: 0.82rem;
  padding: 7px 12px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.ztcx-chat-send-btn:hover {
  background: #e06a00;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(249, 115, 22, 0.4);
}

/* ===== Mobile tweaks ===== */

@media (max-width: 480px) {
  .ztcx-chat-window {
    right: 10px;
    left: 10px;
    bottom: 80px;
    width: auto;
    max-width: none;
    max-height: calc(100vh - 120px);  /* ✅ MOBILE FIX */
  }

  .ztcx-chat-launcher {
    right: 16px;
    bottom: 16px;
  }
}

#ztcxChatLauncher svg {
  width: 26px;
  height: 26px;
  display: block;
}
