/* =====================================================
   ABCTE Customer Support — Floating Chat Widget
   Professional Enterprise Edition
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

/* ===== RESET ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ===== DESIGN TOKENS ===== */
:root {
  /* Brand */
  --brand-50:  #f0f4ff;
  --brand-100: #dde6ff;
  --brand-200: #b8c9ff;
  --brand-400: #6685f5;
  --brand-500: #4a68f0;
  --brand-600: #3450d4;
  --brand-700: #2440b0;
  --brand-800: #1a3090;
  --brand-900: #111e5c;

  /* Accent (violet) */
  --accent-400: #9333ea;
  --accent-500: #7c22d4;

  /* ABCTE brand red (offers / accents) */
  --abcte-red: #c8102e;
  --abcte-red-700: #86091d;

  /* Neutrals — dark palette */
  --n-950: #08090d;
  --n-900: #0d1117;
  --n-850: #111623;
  --n-800: #161c2d;
  --n-750: #1c2438;
  --n-700: #232c42;
  --n-600: #2e3a52;
  --n-500: #3d4e6a;
  --n-400: #536280;
  --n-300: #7588a3;
  --n-200: #a3b3c8;
  --n-100: #cdd8e8;
  --n-50:  #eef2f8;

  /* Semantic */
  --success:  #10b981;
  --success-bg: rgba(16,185,129,.1);
  --warning:  #f59e0b;
  --danger:   #ef4444;
  --danger-bg: rgba(239,68,68,.1);
  --info:     #3b82f6;

  /* Surface */
  --bg-base:    var(--n-900);
  --bg-raised:  var(--n-800);
  --bg-overlay: var(--n-750);
  --bg-input:   var(--n-700);
  --bg-hover:   var(--n-600);

  /* Text */
  --tx-primary:   #f0f4ff;
  --tx-secondary: var(--n-200);
  --tx-muted:     var(--n-300);
  --tx-disabled:  var(--n-400);

  /* Border */
  --bd-subtle:  rgba(255,255,255,.06);
  --bd-default: rgba(255,255,255,.10);
  --bd-strong:  rgba(255,255,255,.18);
  --bd-brand:   var(--brand-400);

  /* Gradient */
  --grad-brand: linear-gradient(135deg, var(--brand-500) 0%, var(--brand-700) 100%);
  --grad-brand-soft: linear-gradient(135deg, var(--brand-400) 0%, var(--brand-600) 100%);
  --grad-surface: linear-gradient(180deg, var(--n-800) 0%, var(--n-850) 100%);

  /* Shadow */
  --shadow-xs: 0 1px 3px rgba(0,0,0,.25);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.35);
  --shadow-md: 0 8px 24px rgba(0,0,0,.45);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.55);
  --shadow-brand: 0 8px 32px rgba(74,104,240,.35);

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-full: 9999px;

  /* Motion */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 350ms;

  /* Typography */
  --font-ui: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'DM Mono', 'Cascadia Code', 'Fira Code', monospace;

  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
}

/* ===== BASE ===== */
html, body {
  height: 100%;
  background: #f3f6fb;
  color: var(--tx-primary);
}

/* ===== WIDGET CONTAINER ===== */
.chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: var(--font-ui);
}

/* ===== LAUNCHER ===== */
.chat-launcher {
  height: 56px;
  padding: 0 22px;
  border-radius: 32px;
  background: var(--grad-brand);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: var(--shadow-brand);
  transition:
    transform var(--duration-normal) var(--ease-spring),
    box-shadow var(--duration-normal) var(--ease-smooth);
  position: relative;
}

.launcher-label {
  color: #fff;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
}

.chat-launcher::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 34px;
  background: var(--grad-brand);
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-smooth);
  z-index: -1;
  filter: blur(8px);
}

.chat-launcher:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 40px rgba(74,104,240,.55);
}

.chat-launcher:hover::before {
  opacity: 0.6;
}

.chat-launcher:active {
  transform: scale(0.96);
}

.launcher-icon {
  width: 26px;
  height: 26px;
  color: white;
}

.launcher-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: var(--danger);
  color: white;
  width: 20px;
  height: 20px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  border: 2px solid white;
  box-shadow: var(--shadow-xs);
  animation: badgePulse 2s ease infinite;
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ===== CHAT WINDOW ===== */
.chat-window {
  width: 400px;
  height: 660px;
  background: var(--bg-base);
  border-radius: var(--r-xl);
  display: flex;
  flex-direction: column;
  box-shadow:
    var(--shadow-lg),
    0 0 0 1px var(--bd-default),
    inset 0 1px 0 var(--bd-subtle);
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  transition:
    opacity var(--duration-slow) var(--ease-smooth),
    transform var(--duration-slow) var(--ease-spring);
  position: relative;
}

.chat-window::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--grad-brand);
  opacity: 0.6;
  z-index: 1;
}

.chat-window.active {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ===== HEADER ===== */
.chat-header {
  background: var(--grad-surface);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--bd-subtle);
  position: relative;
  flex-shrink: 0;
  z-index: 2;
}

.chat-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(74,104,240,.08) 0%, rgba(124,34,212,.05) 100%);
  pointer-events: none;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-avatar {
  position: relative;
}

.avatar-circle {
  width: 40px;
  height: 40px;
  border-radius: var(--r-full);
  background: var(--grad-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 3px rgba(74,104,240,.2);
  transition: box-shadow var(--duration-normal) var(--ease-smooth);
}

.avatar-circle svg {
  width: 20px;
  height: 20px;
  color: white;
}

.status-indicator {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 11px;
  height: 11px;
  border-radius: var(--r-full);
  background: var(--success);
  border: 2px solid var(--n-850);
  box-shadow: 0 0 0 2px rgba(16,185,129,.35);
  animation: statusPulse 2.5s ease infinite;
}

@keyframes statusPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(16,185,129,.35); }
  50% { box-shadow: 0 0 0 4px rgba(16,185,129,.15); }
}

.header-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.header-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--tx-primary);
  letter-spacing: -0.01em;
}

.header-status {
  font-size: 12px;
  color: var(--tx-secondary);
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 5px;
}

.header-status::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: var(--r-full);
  background: var(--success);
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  gap: 6px;
  position: relative;
  z-index: 1;
}

.header-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px solid var(--bd-subtle);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast) var(--ease-smooth);
  color: var(--tx-secondary);
}

.header-btn:hover {
  background: var(--bg-hover);
  border-color: var(--bd-default);
  color: var(--tx-primary);
  transform: scale(1.05);
}

.header-btn:active {
  transform: scale(0.95);
}

.header-btn svg {
  width: 16px;
  height: 16px;
  color: inherit;
}

/* ===== CHAT BODY ===== */
.chat-body {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.30) transparent;
  background: var(--bg-base);
  background-image:
    radial-gradient(ellipse at 15% 20%, rgba(74,104,240,.06) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 80%, rgba(124,34,212,.04) 0%, transparent 55%);
  scroll-behavior: smooth;
}

.chat-messages {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100%;
}

/* Scrollbar - higher contrast on the dark theme */
.chat-body::-webkit-scrollbar {
  width: 9px;
}

.chat-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.chat-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.30);
  border-radius: var(--r-full);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.chat-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.50);
}

/* ===== WELCOME CARD ===== */
.welcome-card {
  background: var(--bg-raised);
  border: 1px solid var(--bd-default);
  border-radius: var(--r-lg);
  padding: 24px 20px;
  text-align: center;
  animation: fadeSlideUp 0.4s var(--ease-smooth) both;
}

.welcome-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  background: var(--grad-brand);
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-brand);
}

.welcome-icon svg {
  width: 28px;
  height: 28px;
  color: white;
}

.welcome-card h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--tx-primary);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.welcome-text {
  color: var(--tx-secondary);
  font-size: 13.5px;
  margin-bottom: 20px;
  line-height: 1.65;
}

/* ===== MESSAGES ===== */
.message {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: fadeSlideUp 0.25s var(--ease-smooth) both;
}

.message.user {
  align-self: flex-end;
}

.message.assistant {
  align-self: flex-start;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tx-muted);
}

.message-time {
  color: var(--n-400);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.message-content {
  padding: 11px 15px;
  border-radius: var(--r-lg);
  line-height: 1.65;
  word-wrap: break-word;
  white-space: pre-wrap;
  font-size: 13.5px;
  font-weight: 400;
}

.message.user .message-content {
  background: var(--grad-brand);
  color: white;
  border-bottom-right-radius: var(--r-sm);
  box-shadow: 0 4px 12px rgba(74,104,240,.28);
}

.message.assistant .message-content {
  background: var(--bg-overlay);
  color: var(--tx-primary);
  border: 1px solid var(--bd-default);
  border-bottom-left-radius: var(--r-sm);
}

/* Streaming cursor */
.message-content[data-streaming="true"]::after {
  content: '▋';
  animation: cursorBlink 1s step-start infinite;
  margin-left: 2px;
  color: var(--brand-400);
  font-size: 12px;
}

@keyframes cursorBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ===== TYPING INDICATOR ===== */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  background: var(--bg-overlay);
  border-radius: var(--r-lg);
  border-bottom-left-radius: var(--r-sm);
  border: 1px solid var(--bd-default);
  width: fit-content;
}

.typing-indicator span {
  width: 7px;
  height: 7px;
  border-radius: var(--r-full);
  background: var(--n-400);
  animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.18s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.36s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-7px); opacity: 1; }
}

/* ===== MESSAGE METADATA ===== */
.message-metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.message-metadata span {
  background: var(--bg-overlay);
  color: var(--tx-muted);
  padding: 3px 8px;
  border-radius: var(--r-sm);
  font-size: 10.5px;
  font-weight: 500;
  border: 1px solid var(--bd-subtle);
  letter-spacing: 0.02em;
}

/* ===== SOURCES ===== */
.sources {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--bg-overlay);
  border-radius: var(--r-md);
  border: 1px solid var(--bd-default);
  border-left: 3px solid var(--brand-400);
}

.sources-title {
  font-weight: 600;
  font-size: 12px;
  color: var(--tx-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.source-item {
  margin-top: 6px;
  padding: 7px 11px;
  background: var(--bg-input);
  border-radius: var(--r-sm);
  border: 1px solid var(--bd-subtle);
  transition: all var(--duration-fast) var(--ease-smooth);
}

.source-item:hover {
  background: var(--bg-hover);
  border-color: var(--bd-brand);
  transform: translateX(3px);
}

.source-item a {
  color: var(--brand-200);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.source-item a::before {
  content: '↗';
  font-size: 12px;
  opacity: 0.7;
}

.source-item a:hover {
  color: var(--brand-100);
  text-decoration: underline;
}

/* ===== ACTION LINKS ===== */
.action-links {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: var(--r-md);
  background: var(--brand-600);
  color: white;
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,.12);
  transition: all var(--duration-fast) var(--ease-smooth);
  letter-spacing: 0.01em;
}

.action-btn:hover {
  background: var(--brand-500);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74,104,240,.35);
}

.action-btn:active {
  transform: translateY(0);
}

/* ===== RELATED LINKS ===== */
.related-links {
  margin-top: 8px;
}

.related-links a {
  color: var(--brand-200);
  text-decoration: underline;
  font-weight: 500;
  font-size: 13px;
  transition: color var(--duration-fast);
}

.related-links a:hover {
  color: var(--brand-100);
}

/* ===== TRIAL BUTTONS ===== */
.trial-buttons {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.trial-btn {
  padding: 9px 20px;
  border: none;
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-ui);
  transition: all var(--duration-fast) var(--ease-smooth);
  letter-spacing: 0.01em;
}

.yes-btn {
  background: var(--grad-brand);
  color: white;
  box-shadow: 0 3px 10px rgba(74,104,240,.3);
}

.yes-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(74,104,240,.45);
}

.no-btn {
  background: var(--bg-overlay);
  color: var(--tx-secondary);
  border: 1px solid var(--bd-default);
}

.no-btn:hover {
  background: var(--bg-hover);
  color: var(--tx-primary);
}

/* ===== COUPON CARD ===== */
.coupon-card {
  margin: 12px 0;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: linear-gradient(135deg, var(--abcte-red) 0%, var(--abcte-red-700) 100%);
  box-shadow: 0 8px 28px rgba(200,16,46,.38);
  animation: popIn 0.3s var(--ease-spring) both;
  border: 1px solid rgba(255,255,255,.12);
  position: relative;
}

.coupon-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 120px;
  height: 120px;
  background: rgba(255,255,255,.04);
  border-radius: 50%;
  transform: translate(30px, -30px);
  pointer-events: none;
}

.coupon-header {
  padding: 11px 18px;
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(0,0,0,.15);
  text-align: center;
  color: rgba(255,255,255,.9);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.coupon-body {
  padding: 18px;
  text-align: center;
}

.coupon-code {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 500;
  letter-spacing: 2px;
  color: #ffffff;
  background: rgba(255,255,255,.12);
  backdrop-filter: blur(8px);
  padding: 12px 20px;
  border-radius: var(--r-md);
  margin-bottom: 14px;
  border: 1px dashed rgba(255,255,255,.3);
  user-select: all;
  cursor: pointer;
  transition: background var(--duration-fast);
}

.coupon-code:hover {
  background: rgba(255,255,255,.18);
}

.coupon-discount {
  font-size: 13.5px;
  color: rgba(255,255,255,.85);
  margin-bottom: 16px;
  font-weight: 400;
}

.coupon-discount strong {
  color: white;
  font-weight: 600;
}

.copy-btn {
  background: white;
  color: var(--abcte-red);
  border: none;
  padding: 9px 22px;
  border-radius: var(--r-full);
  font-weight: 600;
  font-size: 13px;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-smooth);
  letter-spacing: 0.01em;
}

.copy-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0,0,0,.2);
}

.copy-btn:active {
  transform: scale(0.97);
}

.copy-btn.copied {
  background: rgba(255,255,255,.88);
  color: #3730a3;
}

.coupon-meta {
  font-size: 11.5px;
  color: rgba(255,255,255,.6);
  margin-top: 12px;
  letter-spacing: 0.02em;
}

/* ===== CHAT FOOTER ===== */
.chat-footer {
  background: var(--bg-raised);
  border-top: 1px solid var(--bd-subtle);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex-shrink: 0;
}

.input-container {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--bd-default);
  border-radius: var(--r-md);
  padding: 10px 14px;
  color: var(--tx-primary);
  font-size: 13.5px;
  font-family: var(--font-ui);
  resize: none;
  max-height: 120px;
  min-height: 42px;
  line-height: 1.5;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.chat-input:focus {
  outline: none;
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px rgba(74,104,240,.12);
  background: var(--bg-hover);
}

.chat-input::placeholder {
  color: var(--tx-disabled);
}

.chat-input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Input fields in forms (lead / trial) */
input.chat-input,
select.chat-input {
  width: 100%;
  height: 42px;
  resize: none;
}

select.chat-input option {
  background: var(--bg-overlay);
  color: var(--tx-primary);
}

.send-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  background: var(--grad-brand);
  border: none;
  border-radius: var(--r-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast) var(--ease-smooth);
  box-shadow: 0 3px 10px rgba(74,104,240,.28);
}

.send-btn:hover:not(:disabled) {
  transform: scale(1.06) translateY(-1px);
  box-shadow: 0 6px 18px rgba(74,104,240,.45);
}

.send-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.send-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

.send-btn svg {
  width: 18px;
  height: 18px;
  color: white;
}

.footer-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: var(--tx-muted);
}

.stream-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
  color: var(--tx-muted);
  font-size: 11.5px;
  transition: color var(--duration-fast);
}

.stream-toggle:hover {
  color: var(--tx-secondary);
}

.stream-toggle input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--brand-400);
}

.powered-by {
  font-weight: 500;
  opacity: 0.5;
  letter-spacing: 0.03em;
  font-size: 11px;
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--grad-brand);
  color: white;
  border: none;
  padding: 11px 24px;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: 13.5px;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-smooth);
  box-shadow: 0 3px 12px rgba(74,104,240,.28);
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(74,104,240,.45);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.btn-primary.full-width {
  width: 100%;
  margin-top: 6px;
}

/* ===== LEAD / TRIAL FORMS ===== */
#lead-form,
#trial-form {
  border: 1px solid var(--bd-default);
  background: var(--bg-raised);
  padding: 24px 20px;
  border-radius: var(--r-lg);
  animation: fadeSlideUp 0.3s var(--ease-smooth) both;
}

#lead-form h2,
#trial-form h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--tx-primary);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

#lead-form .welcome-text,
#trial-form .welcome-text {
  margin-bottom: 18px;
}

/* ===== ADMIN SIDEBAR ===== */
.admin-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 270px;
  height: 100vh;
  background: var(--bg-raised);
  border-left: 1px solid var(--bd-default);
  box-shadow: var(--shadow-lg);
  z-index: 9998;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--bd-subtle);
}

.admin-header h3 {
  color: var(--tx-primary);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.admin-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-btn {
  background: var(--bg-input);
  color: var(--tx-secondary);
  border: 1px solid var(--bd-default);
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background .15s ease, border-color .15s ease;
}
.admin-btn:hover { background: var(--n-700); border-color: var(--n-500); }

/* ===== Connection status (header) ===== */
.connection-status { font-size: 11px; }
.status-connected { color: var(--success); }
.status-disconnected { color: var(--danger); }

/* ===== Ingest modal (admin only) ===== */
.modal-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal-content {
  background: var(--n-850); color: var(--tx-primary);
  border: 1px solid var(--bd-default); border-radius: 12px;
  padding: 18px; width: 88%; max-width: 380px; max-height: 86%; overflow: auto;
}
.result-message { font-size: 13px; margin-top: 8px; }
.char-counter { font-size: 11px; color: var(--n-400); text-align: right; }
.info-banner { font-size: 12px; color: var(--n-300); }

/* ===== Greeting + quick-reply chips + jump-to-latest (new UX) ===== */
.chat-window { position: relative; }
.quick-replies { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 16px 10px; }
.quick-reply {
  background: var(--bg-input); color: var(--tx-primary);
  border: 1px solid var(--bd-default); border-radius: 9999px;
  padding: 7px 14px; font-size: 13px; cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.quick-reply:hover { background: var(--n-700); border-color: var(--brand-500); }
.jump-latest {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 88px; background: var(--brand-500); color: #fff;
  border: none; border-radius: 9999px; padding: 6px 14px;
  font-size: 12px; font-weight: 500; cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,.35); display: none; z-index: 6;
}
.jump-latest.show { display: block; }

/* ===== Mobile: full-screen widget ===== */
@media (max-width: 480px) {
  .chat-widget { bottom: 0; right: 0; left: 0; }
  .chat-window { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; }
  .header-btn, .close-btn, .minimize-btn { width: 40px; height: 40px; }
}

/* ===== Respect reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}


/* Readable links inside assistant answers (light blue on the dark bubble) */
.message-content a {
  color: #8ab4ff;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.message-content a:hover { color: #b6d1ff; }
