/* F-Bolt chat widget for fellten.com. Scoped under .ft-chat to avoid clashing
   with host site styles. Dark, indigo, glow-accented per the Fellten brand. */
.ft-chat {
  --ft-accent: #6366f1;        /* indigo-500 */
  --ft-accent-hover: #818cf8;  /* indigo-400 */
  --ft-accent-deep: #4f46e5;   /* indigo-600 */
  --ft-accent-text: #ffffff;
  --ft-bg: #111827;            /* gray-900 panel bg */
  --ft-surface: #1f2937;       /* gray-800 surfaces */
  --ft-text: #f3f4f6;
  --ft-muted: #9ca3af;
  --ft-border: #374151;
  --ft-bot-bubble: #1f2937;
  --ft-user-bubble: var(--ft-accent);
  --ft-user-text: #ffffff;
  --ft-radius: 16px;
  --ft-glow: 0 0 50px rgba(79, 70, 229, 0.28);
  --ft-font: 'Figtree', ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
  font-family: var(--ft-font);
}

.ft-chat *,
.ft-chat *::before,
.ft-chat *::after {
  box-sizing: border-box;
}

/* Launcher button */
.ft-launcher {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3), 0 0 22px rgba(99, 102, 241, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ft-launcher:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35), 0 0 30px rgba(99, 102, 241, 0.7); }
.ft-launcher-icon { width: 60px; height: 60px; display: block; border-radius: 50%; pointer-events: none; }

/* Panel */
.ft-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: var(--ft-bg);
  color: var(--ft-text);
  border-radius: var(--ft-radius);
  border: 1px solid rgba(99, 102, 241, 0.18);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45), var(--ft-glow);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.ft-chat.ft-open .ft-panel { display: flex; }

.ft-header {
  background: linear-gradient(135deg, var(--ft-accent-deep), #4338ca);
  color: var(--ft-accent-text);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: inset 0 0 30px rgba(129, 140, 248, 0.25);
}
.ft-avatar {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}
.ft-header-text { flex: 1 1 auto; min-width: 0; }
.ft-header h3 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: 0.2px; }
.ft-header p { margin: 2px 0 0; font-size: 12px; opacity: 0.85; }
.ft-close { margin-left: auto; }
.ft-close {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 4px;
}

.ft-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ft-msg {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.ft-msg.ft-bot { align-self: flex-start; background: var(--ft-bot-bubble); color: var(--ft-text); border: 1px solid rgba(99, 102, 241, 0.12); border-bottom-left-radius: 4px; }
.ft-msg.ft-user { align-self: flex-end; background: var(--ft-user-bubble); color: var(--ft-user-text); border-bottom-right-radius: 4px; }
.ft-msg a { color: var(--ft-accent-hover); text-decoration: none; }
.ft-msg a:hover { text-decoration: underline; }
.ft-msg.ft-user a { color: #fff; text-decoration: underline; }
.ft-msg { animation: ft-msg-in 0.18s ease-out; }
@keyframes ft-msg-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ft-msg { animation: none; } }

.ft-status {
  align-self: center;
  font-size: 12px;
  color: var(--ft-muted);
  font-style: italic;
}

.ft-typing { display: inline-flex; gap: 4px; align-items: center; }
.ft-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ft-accent-hover); opacity: 0.5;
  animation: ft-bounce 1.2s infinite ease-in-out;
}
.ft-typing span:nth-child(2) { animation-delay: 0.15s; }
.ft-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ft-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.4; } 40% { transform: translateY(-4px); opacity: 1; } }

.ft-input {
  border-top: 1px solid var(--ft-border);
  padding: 10px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--ft-bg);
}
.ft-input textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--ft-border);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  max-height: 120px;
  outline: none;
  background: var(--ft-surface);
  color: var(--ft-text);
}
.ft-input textarea::placeholder { color: var(--ft-muted); }
.ft-input textarea:focus { border-color: var(--ft-accent); box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3); }
.ft-send {
  border: none;
  background: var(--ft-accent);
  color: var(--ft-accent-text);
  border-radius: 12px;
  width: 42px;
  height: 42px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  box-shadow: 0 0 15px rgba(79, 70, 229, 0.5);
}
.ft-send:hover { background: var(--ft-accent-hover); }
.ft-send:disabled { opacity: 0.5; cursor: default; box-shadow: none; }
.ft-send svg { width: 20px; height: 20px; }

.ft-footer {
  text-align: center;
  font-size: 11px;
  color: var(--ft-muted);
  padding: 0 0 8px;
  background: var(--ft-bg);
}

/* Contact form card */
.ft-form-card {
  max-width: 100%;
  width: 100%;
  background: var(--ft-surface);
}
.ft-form { display: flex; flex-direction: column; gap: 8px; }
.ft-field { display: flex; flex-direction: column; gap: 3px; }
.ft-field label { font-size: 12px; color: var(--ft-muted); font-weight: 600; }
.ft-field input {
  border: 1px solid var(--ft-border);
  border-radius: 9px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 14px;
  background: var(--ft-bg);
  color: var(--ft-text);
  outline: none;
}
.ft-field input:focus { border-color: var(--ft-accent); box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3); }
.ft-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.ft-privacy { font-size: 11px; line-height: 1.4; color: var(--ft-muted); margin: 2px 0 0; }
.ft-form-error { font-size: 12px; color: #f87171; }
.ft-form-submit {
  margin-top: 4px;
  border: none;
  background: var(--ft-accent);
  color: var(--ft-accent-text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 15px rgba(79, 70, 229, 0.5);
}
.ft-form-submit:hover { background: var(--ft-accent-hover); }
.ft-form-submit:disabled { opacity: 0.6; cursor: default; box-shadow: none; }
.ft-form-done { font-size: 14px; line-height: 1.5; }

/* Lock the host page behind the full-screen chat on mobile */
html.ft-lock, body.ft-lock { overflow: hidden !important; }

/* Mobile: full-screen app-like panel that slides up */
@media (max-width: 480px) {
  .ft-chat { right: 14px; bottom: 14px; }

  .ft-panel {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    border-radius: 0;
    border: none;
    display: flex;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    pointer-events: none;
  }
  .ft-chat.ft-open .ft-panel {
    transform: translateY(0);
    pointer-events: auto;
  }

  .ft-avatar,
  .ft-avatar svg { width: 48px; height: 48px; }

  .ft-header { padding: 12px 14px; padding-top: calc(12px + env(safe-area-inset-top)); }
  .ft-close {
    font-size: 26px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
  }

  .ft-input textarea,
  .ft-field input { font-size: 16px; }

  .ft-input { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .ft-msg { max-width: 90%; font-size: 15px; }
}
