/* ========== Base theme vars ========== */
:root {
  --ai-bg: #fff;
  --ai-fg: #111;
  --ai-border: #ddd;
  --ai-accent: #10b981;
  --ai-accent-hover: #059669;
  --ai-primary: #2563eb;
  --ai-primary-hover: #1d4ed8;
  --ai-muted: #666;
  --ai-shadow: rgba(0, 0, 0, 0.18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ai-bg: #111827;
    --ai-fg: #f3f4f6;
    --ai-border: #374151;
    --ai-accent: #34d399;
    --ai-accent-hover: #10b981;
    --ai-primary: #60a5fa;
    --ai-primary-hover: #3b82f6;
    --ai-muted: #9ca3af;
    --ai-shadow: rgba(0, 0, 0, 0.55);
  }
}

/* Host container */
#ai-agent-panel-host {
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 2147483647;
  pointer-events: none;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* Floating button */
#ai-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--ai-accent);
  color: var(--ai-bg);
  border: none;
  border-radius: 9999px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 8px 18px var(--ai-shadow);
  transition: transform 0.18s ease, background-color 0.18s ease;
}
#ai-fab:hover {
  background: var(--ai-accent-hover);
  transform: scale(1.05);
}

/* ========== Panel ========== */
.ai-panel {
  position: fixed;
  right: 20px;
  bottom: 70px;
  width: 380px;
  height: 450px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 120px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--ai-bg);
  color: var(--ai-fg);
  border: 1px solid var(--ai-border);
  border-radius: 10px;
  box-shadow: 0 18px 36px var(--ai-shadow);
  pointer-events: auto;
  resize: both;
  animation: ai-fade-in 150ms ease-out both;
}
@keyframes ai-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ai-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--ai-border);
  padding: 6px 10px;
}
.ai-header strong { font-size: 15px; }
.ai-header button {
  border: none;
  background: transparent;
  color: var(--ai-muted);
  font-size: 16px;
  cursor: pointer;
}

/* Scrollable content area */
.ai-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}

/* Input rows */
.ai-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}
.ai-label {
  width: 90px;
  font-size: 13px;
  color: var(--ai-fg);
}
.ai-panel input[type="text"],
.ai-panel input[type="number"] {
  flex: 1;
  background: var(--ai-bg);
  color: var(--ai-fg);
  border: 1px solid var(--ai-border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
}
.ai-panel input:focus {
  border-color: var(--ai-primary);
  outline: none;
}

/* Buttons */
.ai-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.ai-panel button {
  background: #f3f4f6;
  color: #111;
  border: 1px solid var(--ai-border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
}
.ai-panel button:hover {
  background: var(--ai-primary);
  color: var(--ai-bg);
  border-color: var(--ai-primary);
}
.ai-panel .ai-primary {
  background: var(--ai-primary);
  color: var(--ai-bg);
}

/* Output box */
#ai-output {
  flex: 1;
  background: var(--ai-bg);
  border: 1px solid var(--ai-border);
  border-radius: 6px;
  margin-top: 10px;
  padding: 8px;
  font-family: monospace;
  font-size: 13px;
  white-space: pre-wrap;
  overflow-y: auto;
}

/* Scrollbars */
.ai-panel::-webkit-scrollbar { width: 8px; }
.ai-panel::-webkit-scrollbar-thumb {
  background: var(--ai-border);
  border-radius: 6px;
}
.ai-panel::-webkit-scrollbar-thumb:hover { background: var(--ai-muted); }

