/* Wayfinder floating chatbot. Uses tokens from style.css. */

.wf-chat-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: var(--surface-raised);
  box-shadow: 0 4px 16px rgba(20, 30, 60, 0.18);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-out),
    background var(--duration-fast) var(--ease-out);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.wf-chat-fab:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.wf-chat-fab svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.wf-chat-fab.wf-hidden-affordance {
  width: 28px;
  height: 28px;
  background: var(--surface);
  color: var(--text-tertiary);
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(20, 30, 60, 0.08);
  font-size: 14px;
}

.wf-chat-fab.wf-hidden-affordance:hover {
  color: var(--text);
  background: var(--surface-raised);
}

.wf-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 84px;
  z-index: 1000;
  width: min(420px, calc(100vw - 40px));
  max-height: min(720px, calc(100vh - 120px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(20, 30, 60, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-body);
}

.wf-chat-panel[hidden] {
  display: none;
}

.wf-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-raised);
}

.wf-chat-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.wf-chat-header-actions {
  display: inline-flex;
  gap: 4px;
}

.wf-chat-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

.wf-chat-icon-btn:hover {
  background: var(--primary-lighter);
  color: var(--text);
}

.wf-chat-icon-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wf-chat-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.wf-chat-empty {
  color: var(--text-tertiary);
  font-size: 13px;
  line-height: 1.5;
}

.wf-chat-empty p {
  margin-bottom: 8px;
}

.wf-chat-empty .wf-suggestion {
  display: block;
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--primary-lighter);
  color: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: background var(--duration-fast) var(--ease-out);
}

.wf-chat-empty .wf-suggestion:hover {
  background: var(--primary-light);
}

.wf-chat-q {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  white-space: pre-wrap;
}

.wf-chat-a {
  color: var(--text-secondary);
  white-space: pre-wrap;
}

.wf-chat-a a {
  color: var(--primary);
  text-decoration: underline;
}

.wf-chat-a a:hover {
  color: var(--primary-hover);
}

.wf-chat-a p + p {
  margin-top: 10px;
}

.wf-chat-a ul,
.wf-chat-a ol {
  margin: 8px 0 8px 20px;
}

.wf-chat-a li + li {
  margin-top: 4px;
}

.wf-chat-error {
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--danger-light);
  color: var(--danger);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.wf-chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-raised);
}

.wf-chat-input {
  flex: 1 1 auto;
  resize: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--surface);
  min-height: 36px;
  max-height: 96px;
  transition: border-color var(--duration-fast) var(--ease-out);
}

.wf-chat-input:focus {
  outline: none;
  border-color: var(--primary);
}

.wf-chat-input::placeholder {
  color: var(--text-tertiary);
}

.wf-chat-send {
  align-self: flex-end;
  padding: 8px 14px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: var(--surface-raised);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
}

.wf-chat-send:hover {
  background: var(--primary-hover);
}

.wf-chat-send[disabled] {
  background: var(--border);
  color: var(--text-tertiary);
  cursor: not-allowed;
}

.wf-typing {
  display: inline-block;
  width: 4px;
  height: 14px;
  background: var(--text-secondary);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: wf-blink 0.9s steps(1) infinite;
}

@keyframes wf-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

@media (max-width: 600px) {
  .wf-chat-panel {
    right: 12px;
    left: 12px;
    bottom: 76px;
    width: auto;
    max-height: calc(100vh - 100px);
  }
  .wf-chat-fab {
    right: 14px;
    bottom: 14px;
  }
  .wf-chat-send {
    min-height: 44px;
  }
  .wf-chat-icon-btn {
    min-width: 44px;
    min-height: 44px;
  }
}
