@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Outfit:wght@500;600;700&display=swap');

/* Scoped Variables & Reset */
#chatbot-root {
  --bg: #0b0f17;
  --panel: #0f1725;
  --panel-2: #0c131f;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8ecf2;
  --muted: #9aa3b5;
  --accent: #00d68f;
  --accent-2: #1fb6ff;
  --bubble: #131b2a;
  --bubble-user: linear-gradient(135deg, #00d68f, #1fb6ff);
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.03);

  font-family: "Inter", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  color-scheme: dark;

  /* Positioning */
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  width: 380px;
  max-width: calc(100vw - 32px);
}

/* Remove global body styles that were causing conflicts */

.cb-btn {
  width: 70px;
  height: 70px;
  border-radius: 18px;
  background: transparent;
  border: none;
  box-shadow: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
  position: absolute;
  bottom: 0;
  right: 0;
}

.cb-btn:hover img {
  /* Subtle Sky Blue drop shadow */
  filter: drop-shadow(0 4px 10px rgba(135, 206, 235, 0.5));
  transform: scale(1.05);
}

.cb-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  animation: iconFloat 3s ease-in-out infinite;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
  transition: filter 0.2s ease;
}

@keyframes iconFloat {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

/* --- Main Panel --- */
.cb-panel {
  width: 380px;
  height: 600px;
  max-height: calc(100vh - 120px);
  max-width: calc(100vw - 32px);
  /* Minimalist Dark Theme */
  background: #09090b;
  border: 1px solid #27272a;
  border-radius: 20px;
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.5);
  display: none;
  flex-direction: column;
  position: absolute;
  bottom: 90px;
  right: 0;
  overflow: hidden;
  transform-origin: bottom right;
  animation: fadeUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* --- Header --- */
.cb-header {
  padding: 20px 24px 16px;
  background: #09090b;
  border-bottom: 1px solid #27272a;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cb-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cb-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cb-header h4 {
  margin: 0;
  color: #fafafa;
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.cb-badge {
  font-size: 10px;
  color: #71717a;
  background: #18181b;
  border: 1px solid #27272a;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.cb-header-bottom {
  display: flex;
  gap: 8px;
  border-color: #3f3f46;
}

.cb-chip.active {
  background: #fafafa;
  color: #09090b;
  border-color: #fafafa;
  font-weight: 500;
}

.cb-close {
  background: transparent;
  border: none;
  color: #71717a;
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  font-size: 20px;
  padding: 0;
}

.cb-close:hover {
  color: #fafafa;
}

/* --- Footer --- */
.cb-footer {
  text-align: center;
  padding: 12px;
  font-size: 11px;
  color: #52525b;
  background: #09090b;
  border-top: 1px solid #27272a;
}

/* --- Body --- */
.cb-body {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: #09090b;
}

/* --- Messages --- */
.cb-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: slideIn 0.3s ease-out forwards;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cb-msg.bot {
  align-self: flex-start;
}

.cb-msg.user {
  align-self: flex-end;
}

.bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
  font-weight: 400;
}

.translation {
  margin-top: 6px;
  font-size: 12px;
  color: #71717a;
  padding-left: 4px;
}

.cb-msg.bot .bubble {
  background: #18181b;
  color: #e4e4e7;
  border-bottom-left-radius: 4px;
}

.cb-msg.user .bubble {
  background: #fafafa;
  color: #09090b;
  border-bottom-right-radius: 4px;
}

/* --- Input Area --- */
.cb-input {
  padding: 16px 24px;
  background: #09090b;
  border-top: 1px solid #27272a;
  display: flex;
  gap: 12px;
  align-items: center;
}

.cb-input input {
  flex: 1;
  background: #18181b;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 16px;
  color: #fafafa;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

.cb-input input:focus {
  background: #27272a;
  border-color: #3f3f46;
}

.cb-input input::placeholder {
  color: #52525b;
}

.cb-input button {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: #fafafa;
  color: #09090b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.cb-input button:hover {
  transform: scale(1.05);
  background: #fff;
}

.cb-input button:active {
  transform: scale(0.95);
}

/* --- Status & Typing --- */
.cb-status {
  padding: 8px 24px;
  font-size: 12px;
  color: #71717a;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #09090b;
}

.typing span {
  width: 4px;
  height: 4px;
  background: #71717a;
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.cb-banner {
  padding: 8px;
}

.cb-chip.active {
  background: #fafafa;
  color: #09090b;
  border-color: #fafafa;
  font-weight: 500;
}

.cb-close {
  background: transparent;
  border: none;
  color: #71717a;
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  font-size: 20px;
  padding: 0;
}

.cb-close:hover {
  color: #fafafa;
}

/* --- Footer --- */
.cb-footer {
  text-align: center;
  padding: 12px;
  font-size: 11px;
  color: #52525b;
  background: #09090b;
  border-top: 1px solid #27272a;
}

/* --- Body --- */
.cb-body {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: #09090b;
}

/* --- Messages --- */
.cb-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: slideIn 0.3s ease-out forwards;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cb-msg.bot {
  align-self: flex-start;
}

.cb-msg.user {
  align-self: flex-end;
}

.bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
  font-weight: 400;
}

.translation {
  margin-top: 6px;
  font-size: 12px;
  color: #71717a;
  padding-left: 4px;
}

.cb-msg.bot .bubble {
  background: #18181b;
  color: #e4e4e7;
  border-bottom-left-radius: 4px;
}

.cb-msg.user .bubble {
  background: #fafafa;
  color: #09090b;
  border-bottom-right-radius: 4px;
}

/* --- Input Area --- */
.cb-input {
  padding: 16px 24px;
  background: #09090b;
  border-top: 1px solid #27272a;
  display: flex;
  gap: 12px;
  align-items: center;
}

.cb-input input {
  flex: 1;
  background: #18181b;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 16px;
  color: #fafafa;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

.cb-input input:focus {
  background: #27272a;
  border-color: #3f3f46;
}

.cb-input input::placeholder {
  color: #52525b;
}

.cb-input button {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: #fafafa;
  color: #09090b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.cb-input button:hover {
  transform: scale(1.05);
  background: #fff;
}

.cb-input button:active {
  transform: scale(0.95);
}

/* --- Status & Typing --- */
.cb-status {
  padding: 8px 24px;
  font-size: 12px;
  color: #71717a;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #09090b;
}

.typing span {
  width: 4px;
  height: 4px;
  background: #71717a;
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.cb-banner {
  padding: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
}

.cb-banner.offline {
  background: #27272a;
  color: #fbbf24;
}

.cb-banner.error {
  background: #27272a;
  color: #f87171;
}

/* --- Contact Form --- */
.cb-contact-form {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #09090b;
}

.cb-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cb-form-group label {
  font-size: 12px;
  color: #a1a1aa;
  font-weight: 500;
}

.cb-form-group input,
.cb-form-group textarea {
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 8px;
  padding: 10px 12px;
  color: #fafafa;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.cb-form-group input:focus,
.cb-form-group textarea:focus {
  border-color: #3f3f46;
}

#cb-submit-lead {
  background: #fafafa;
  color: #09090b;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: opacity 0.2s;
}

#cb-submit-lead:hover {
  opacity: 0.9;
}

#cb-submit-lead:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#cb-cancel-lead {
  background: transparent;
  color: #71717a;
  border: none;
  padding: 8px;
  font-size: 13px;
  cursor: pointer;
}

#cb-cancel-lead:hover {
  color: #fafafa;
}