/* retoor <retoor@molodetz.nl> */

.ai-interaction {
  --ai-space-1: 0.25rem;
  --ai-space-2: 0.5rem;
  --ai-space-3: 0.75rem;
  --ai-space-4: 1rem;
  --ai-radius-md: 10px;
  --ai-color-fg: var(--devii-agent, var(--text-primary, #e6edf3));
  --ai-color-muted: var(--devii-dim, var(--text-muted, #7a6a90));
  --ai-color-accent: var(--devii-accent, var(--accent, #ff6b35));
  --ai-color-border: var(--devii-border, var(--border, rgba(255, 255, 255, 0.12)));
  --ai-color-surface: var(--devii-code-bg, var(--bg-card, #1a1030));
  --ai-color-surface-2: var(--devii-bar-bg, var(--bg-secondary, #120821));
  --ai-focus-ring: 0 0 0 2px rgba(63, 185, 80, 0.35);

  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin: var(--ai-space-3) 0;
  padding: var(--ai-space-3);
  border: 1px solid var(--ai-color-border);
  border-radius: var(--ai-radius-md);
  background: var(--ai-color-surface);
  color: var(--ai-color-fg);
  overflow: visible;
}

.ai-interaction-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ai-space-2);
  margin-bottom: var(--ai-space-3);
}

.ai-interaction-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.ai-status {
  font-size: 0.75rem;
  color: var(--ai-color-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ai-status[data-state="submitted"] {
  color: var(--ai-color-accent);
}

.ai-status[data-state="error"],
.ai-status[data-state="cancelled"],
.ai-status[data-state="timeout"] {
  color: var(--devii-error, var(--danger, #e53935));
}

.ai-widget-label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--ai-space-1);
}

.ai-widget-help,
.ai-help {
  display: block;
  color: var(--ai-color-muted);
  font-size: 0.85rem;
  margin-bottom: var(--ai-space-2);
}

.ai-actions {
  display: flex;
  gap: var(--ai-space-2);
  margin-top: var(--ai-space-3);
  flex-wrap: wrap;
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: var(--ai-space-2) 0 var(--ai-space-1);
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0%,
    var(--ai-color-surface) 28%,
    var(--ai-color-surface) 100%
  );
}

.ai-actions.align-end {
  justify-content: flex-end;
}

.ai-btn {
  border: 1px solid var(--ai-color-border);
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  background: var(--ai-color-surface-2);
  color: var(--ai-color-fg);
  cursor: pointer;
  font: inherit;
}

.ai-btn:focus-visible {
  outline: none;
  box-shadow: var(--ai-focus-ring);
}

.ai-btn-primary {
  background: var(--ai-color-accent);
  border-color: transparent;
  color: #041008;
  font-weight: 600;
}

.ai-btn-secondary {
  opacity: 0.92;
}

.ai-group {
  margin: var(--ai-space-3) 0;
  padding: var(--ai-space-2);
  border-left: 2px solid var(--ai-color-border);
}

.ai-group-label {
  font-weight: 600;
  margin-bottom: var(--ai-space-2);
}

.ai-markdown-fallback pre {
  white-space: pre-wrap;
  margin: 0;
  font: inherit;
  color: var(--ai-color-muted);
}

@media (max-width: 768px) {
  .ai-actions {
    flex-direction: column;
  }

  .ai-btn {
    width: 100%;
  }
}
