/* ALFa AI guest chat — matches contracts-bot AlfaAskAiDock (slate/cyan dock) */
:root {
  --alfa-dock-bg: rgba(2, 6, 23, 0.98);
  --alfa-dock-border: rgba(6, 182, 212, 0.35);
  --alfa-dock-cyan: #67e8f9;
  --alfa-dock-cyan-dim: #22d3ee;
  --alfa-dock-muted: #94a3b8;
  --alfa-dock-slate-700: rgba(51, 65, 85, 0.9);
  --alfa-dock-slate-600: #475569;
}

.alfa-ai-dock {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 100030;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  pointer-events: none;
  padding-bottom: env(safe-area-inset-bottom, 0);
  padding-right: env(safe-area-inset-right, 0);
}

.alfa-ai-dock > * {
  pointer-events: auto;
}

.alfa-ai-chat-fab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid rgba(6, 182, 212, 0.4);
  border-radius: 9999px;
  background: rgba(2, 6, 23, 0.95);
  padding: 0.375rem 1rem 0.375rem 0.375rem;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(8, 47, 73, 0.3);
  transition: border-color 0.15s ease, background 0.15s ease;
  font-family: inherit;
}

.alfa-ai-chat-fab:hover,
.alfa-ai-chat-fab:focus-visible {
  border-color: rgba(34, 211, 238, 0.6);
  background: #0f172a;
  outline: none;
}

.alfa-ai-chat-fab__badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  background: linear-gradient(to bottom right, rgba(6, 182, 212, 0.3), rgba(2, 132, 199, 0.4));
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.5);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #a5f3fc;
}

.alfa-ai-chat-fab__label {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--alfa-dock-cyan);
}

.alfa-ai-chat-panel {
  display: none;
  flex-direction: column;
  width: min(calc(100vw - 2rem), 28rem);
  max-height: min(85dvh, 36rem);
  border: 1px solid var(--alfa-dock-border);
  border-radius: 0.75rem;
  background: var(--alfa-dock-bg);
  box-shadow: 0 25px 50px rgba(8, 47, 73, 0.4);
  backdrop-filter: blur(12px);
  overflow: hidden;
}

.alfa-ai-chat-panel.is-open {
  display: flex;
}

.alfa-ai-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: #e2e8f0;
}

.alfa-ai-chat--float {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  max-width: none;
}

.alfa-ai-chat__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--alfa-dock-slate-700);
  background: rgba(15, 23, 42, 0.8);
  flex-shrink: 0;
}

.alfa-ai-chat__header-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  border-radius: 9999px;
  background: linear-gradient(to bottom right, rgba(6, 182, 212, 0.3), rgba(2, 132, 199, 0.4));
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.5);
  font-size: 0.55rem;
  font-weight: 700;
  color: #a5f3fc;
}

.alfa-ai-chat__header-text {
  min-width: 0;
  flex: 1;
}

.alfa-ai-chat__header h3 {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--alfa-dock-cyan);
}

.alfa-ai-chat__subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.6875rem;
  line-height: 1.35;
  color: var(--alfa-dock-muted);
}

.alfa-ai-chat__close {
  flex-shrink: 0;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  padding: 0.5rem;
  color: var(--alfa-dock-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.alfa-ai-chat__close:hover,
.alfa-ai-chat__close:focus-visible {
  background: #1e293b;
  color: #fff;
  outline: none;
}

.alfa-ai-chat__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 0.75rem;
}

.alfa-ai-chat__log {
  flex: 1;
  min-height: 10rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-right: 0.25rem;
}

.alfa-ai-chat__log:empty::before {
  content: 'Ask about ALFa products, Market Software, Contracts Software, Credit Check Software, and this website.';
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--alfa-dock-muted);
  padding: 0.5rem 0;
}

.alfa-ai-chat__bubble {
  max-width: 95%;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  line-height: 1.45;
  font-size: 0.875rem;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.alfa-ai-chat__bubble--user {
  align-self: flex-end;
  background: rgba(14, 116, 144, 0.35);
  color: #ecfeff;
  border: 1px solid rgba(6, 182, 212, 0.25);
}

.alfa-ai-chat__bubble--assistant {
  align-self: flex-start;
  background: rgba(15, 23, 42, 0.9);
  color: #f1f5f9;
  border: 1px solid var(--alfa-dock-slate-700);
}

.alfa-ai-chat__bubble--error {
  align-self: stretch;
  background: rgba(127, 29, 29, 0.25);
  color: #fecaca;
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.alfa-ai-chat__form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--alfa-dock-slate-700);
  flex-shrink: 0;
}

.alfa-ai-chat__form input[type='text'] {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--alfa-dock-slate-600);
  border-radius: 0.375rem;
  background: #020617;
  color: #fff;
  font-size: 0.875rem;
}

.alfa-ai-chat__form input[type='text']::placeholder {
  color: #64748b;
}

.alfa-ai-chat__form input[type='text']:focus {
  outline: none;
  border-color: rgba(6, 182, 212, 0.5);
  box-shadow: 0 0 0 1px rgba(6, 182, 212, 0.35);
}

.alfa-ai-chat__form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.alfa-ai-chat__hint {
  font-size: 0.625rem;
  color: #475569;
}

.alfa-ai-chat__send {
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: 0.375rem;
  background: #0891b2;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}

.alfa-ai-chat__send:hover:not(:disabled) {
  background: #06b6d4;
}

.alfa-ai-chat__send:disabled {
  opacity: 0.5;
  cursor: wait;
}

.alfa-ai-chat__footer {
  margin: 0.5rem 0 0;
  font-size: 0.625rem;
  color: #475569;
  text-align: center;
}

@media (max-width: 767px) {
  .alfa-ai-dock {
    right: 0.75rem;
    left: 0.75rem;
    align-items: stretch;
  }

  .alfa-ai-chat-panel {
    width: auto;
  }

  .alfa-ai-chat-fab {
    align-self: flex-end;
  }
}
