/* Thoughty Chat Widget – isolated styles (no Tailwind needed) */
:root {
  --dtc-primary: #0f172a;            /* slate-900-ish header */
  --dtc-primary-2: #1f2937;          /* slate-800-ish gradient end */
  --dtc-accent: #f97316;             /* orange-500 */
  --dtc-accent-2: #ea580c;           /* orange-600 */
  --dtc-border: #e5e7eb;             /* gray-200 */
  --dtc-bg: #ffffff;
  --dtc-bg-soft: #f9fafb;            /* gray-50 */
  --dtc-text: #111827;               /* gray-900 */
  --dtc-text-soft: #6b7280;          /* gray-500 */
  --dtc-shadow: 0 20px 40px rgba(0,0,0,.18);
  --dtc-radius-xl: 16px;
  --dtc-radius-lg: 12px;
  --dtc-radius-full: 999px;
}

/* Root container */
.dtc-root { position: fixed; right: 24px; bottom: 24px; z-index: 9999; }

/* Floating open button */
.dtc-open-btn {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, var(--dtc-primary), var(--dtc-primary-2));
  color: #fff; padding: 12px 14px; border-radius: 18px; border: 0; cursor: pointer;
  box-shadow: var(--dtc-shadow);
  transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease, visibility .2s ease;
  text-decoration: none; outline: none;
}
.dtc-open-btn:hover { transform: translateY(-2px); }
.dtc-open-btn:focus { outline: none; }
.dtc-open-btn__icon {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  background: var(--dtc-accent); border-radius: 999px; padding: 8px;
}
.dtc-open-btn__text { display: flex; flex-direction: column; line-height: 1.1; font-size: 12px; }
.dtc-bubble-icon { color: var(--dtc-accent); }

/* Online dot */
.dtc-online-dot, .dtc-online-dot--sm {
  position: absolute; right: -3px; top: -3px; background: #22c55e; /* green-500 */
  border: 2px solid #fff; border-radius: 50%;
  animation: dtc-pulse 2s infinite;
}
.dtc-online-dot { width: 14px; height: 14px; }
.dtc-online-dot--sm { width: 10px; height: 10px; border-width: 1px; }

@keyframes dtc-pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: .6; transform: scale(.9); }
}

/* Chat window */
.dtc-window {
  position: fixed; right: 24px; bottom: 24px;
  width: 320px; height: 380px; background: var(--dtc-bg);
  box-shadow: var(--dtc-shadow);
  
  display: grid; grid-template-rows: auto 1fr auto;
  transform: scale(.96) translateY(8px); opacity: 0; visibility: hidden; pointer-events: none;
  transition: transform .2s ease, opacity .2s ease, visibility .2s ease;
  overflow: hidden;
}

/* Show/Hide helpers (JS will toggle these) */
.dtc-window.is-open {
  transform: scale(1) translateY(0); opacity: 1; visibility: visible; pointer-events: auto;
}
.dtc-open-btn.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; transform: scale(.96); }

/* Header */
.dtc-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px; background: linear-gradient(135deg, var(--dtc-primary), var(--dtc-primary-2));
  color: #fff;
}
.dtc-header__left { display: flex; gap: 10px; align-items: center; }
.dtc-avatar {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  background: var(--dtc-accent); color: #fff; border-radius: 999px; padding: 8px;
}
.dtc-header__meta { display: flex; flex-direction: column; line-height: 1.1; }
.dtc-header__meta small { color: #cbd5e1; } /* slate-300 */
.dtc-close-btn {
  background: transparent; border: 0; color: #cbd5e1; padding: 6px; border-radius: 10px; cursor: pointer;
}
.dtc-close-btn:hover { background: rgba(255,255,255,.08); color: #fff; }

/* Messages */
.dtc-messages {
  background: var(--dtc-bg-soft); padding: 14px; overflow-y: auto;
}

/* Message bubbles */
.dtc-msg {
  display: flex; margin-bottom: 10px;
}
.dtc-msg--bot { justify-content: flex-start; }
.dtc-msg--user { justify-content: flex-end; }

.dtc-bubble {
  max-width: 78%;
  padding: 10px 12px; border-radius: 16px;
  font-size: 14px; line-height: 1.45;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.dtc-bubble--bot {
  background: #fff; color: var(--dtc-text); border: 1px solid var(--dtc-border);
}
.dtc-bubble--user {
  background: linear-gradient(135deg, var(--dtc-accent), var(--dtc-accent-2)); color: #fff;
}

.dtc-bubble__brand {
  display: flex; align-items: center; gap: 6px; margin-bottom: 4px; font-size: 11px; font-weight: 700; color: #ea580c;
}
.dtc-bubble__time {
  margin-top: 6px; font-size: 11px; opacity: .75;
}

/* Input area */
.dtc-input {
  background: #fff; border-top: 1px solid var(--dtc-border); padding: 12px;
}
.dtc-input form, .dtc-input > div { display: flex; gap: 8px; align-items: center; }
.dtc-input input[type="text"] {
  flex: 1; border: 1px solid var(--dtc-border); background: #f3f4f6; /* gray-100 */
  border-radius: var(--dtc-radius-full); padding: 10px 14px; font-size: 14px; outline: none;
  transition: box-shadow .2s ease, border-color .2s ease;
}
.dtc-input input[type="text"]:focus {
  border-color: var(--dtc-accent); box-shadow: 0 0 0 3px rgba(249,115,22,.2);
}
.dtc-input button {
  border: 0; background: linear-gradient(135deg, var(--dtc-accent), var(--dtc-accent-2));
  color: #fff; border-radius: 999px; padding: 10px; cursor: pointer;
  box-shadow: 0 6px 16px rgba(234,88,12,.3);
  transition: transform .15s ease, box-shadow .15s ease;
}
.dtc-input button:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(234,88,12,.4); }
.dtc-powered { width: 100%; text-align: center; font-size: 11px; color: #9ca3af; margin-top: 6px; }

/* Small screens: nudge inwards a bit */
@media (max-width: 420px) {
  .dtc-root { right: 16px; bottom: 16px; }
  .dtc-window { right: 16px; bottom: 16px; width: calc(100vw - 32px); height: 70vh; }
}

.dtc-input__row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dtc-input input[type="text"] {
  flex: 1;
  width: 100%;           /* ensures it uses all remaining space */
  min-width: 0;          /* prevents overflow in flex */
}

/* Offline mode: grey dot + no pulse */
.dtc-root.is-offline .dtc-online-dot,
.dtc-root.is-offline .dtc-online-dot--sm {
  background: #9ca3af;   /* gray */
  animation: none;
}