/* Wall-E Ask AI Panel — Theme-aware, bottom-anchored */

/* ===== Overlay ===== */
.wai-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0,0,0,0.08);
  backdrop-filter: blur(1px);
  animation: wai-overlay-in 0.15s ease;
}
@keyframes wai-overlay-in { from { opacity: 0; } to { opacity: 1; } }

/* ===== Bottom-anchored panel (Claude-style) ===== */
.wai-panel {
  position: fixed;
  z-index: 9999;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: 640px;
  max-width: calc(100vw - 48px);
  border-radius: 16px;
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: wai-slide-up 0.2s cubic-bezier(0.16, 1, 0.3, 1);

  /* Light theme (default) */
  background: #ffffff;
  color: #1a1a2e;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.04),
    0 8px 40px rgba(0,0,0,0.12),
    0 2px 8px rgba(0,0,0,0.06);
}

/* Dark theme */
[data-mantine-color-scheme="dark"] .wai-panel {
  background: #1a1b1e;
  color: #c1c2c5;
  border-color: rgba(255,255,255,0.06);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04),
    0 8px 40px rgba(0,0,0,0.5),
    0 2px 8px rgba(0,0,0,0.3);
}

@keyframes wai-slide-up {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== Header ===== */
.wai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
}

.wai-header-title {
  font-size: 13px;
  font-weight: 700;
  color: #2653B0;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 6px;
}
[data-mantine-color-scheme="dark"] .wai-header-title { color: #7B9CFF; }

.wai-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wai-header-hint {
  font-size: 11px;
  color: #999;
  font-family: monospace;
}

.wai-header-close {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 18px;
  line-height: 1;
  transition: all 0.1s;
}
.wai-header-close:hover { color: #333; background: rgba(0,0,0,0.05); }
[data-mantine-color-scheme="dark"] .wai-header-close:hover { color: #fff; background: rgba(255,255,255,0.08); }

/* ===== Prompt input ===== */
.wai-prompt-area {
  padding: 0 20px 14px;
}

.wai-prompt-input {
  width: 100%;
  border: 1.5px solid rgba(0,0,0,0.1);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  min-height: 48px;
  max-height: 120px;
  line-height: 1.5;
  transition: border-color 0.15s;
  background: rgba(0,0,0,0.02);
  color: inherit;
}
.wai-prompt-input::placeholder { color: #aaa; }
.wai-prompt-input:focus { border-color: #2653B0; background: transparent; }

[data-mantine-color-scheme="dark"] .wai-prompt-input {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.1);
}
[data-mantine-color-scheme="dark"] .wai-prompt-input:focus { border-color: #7B9CFF; }

/* ===== Action chips ===== */
.wai-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 20px 12px;
}

.wai-actions-label {
  width: 100%;
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.wai-chip {
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(0,0,0,0.02);
  color: #555;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
.wai-chip:hover { border-color: #2653B0; color: #2653B0; background: rgba(38,83,176,0.04); }

[data-mantine-color-scheme="dark"] .wai-chip {
  border-color: rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  color: #aab;
}
[data-mantine-color-scheme="dark"] .wai-chip:hover { border-color: #7B9CFF; color: #7B9CFF; }

/* ===== Prompt actions row ===== */
.wai-prompt-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
  gap: 8px;
}

/* ===== Buttons ===== */
.wai-btn {
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.12s;
}

.wai-btn-primary { background: #2653B0; color: white; }
.wai-btn-primary:hover { background: #3163C8; }
.wai-btn-primary:disabled { background: #ccc; color: #888; cursor: not-allowed; }
[data-mantine-color-scheme="dark"] .wai-btn-primary:disabled { background: #333; color: #666; }

.wai-btn-secondary { background: rgba(0,0,0,0.05); color: #555; }
.wai-btn-secondary:hover { background: rgba(0,0,0,0.1); color: #333; }
[data-mantine-color-scheme="dark"] .wai-btn-secondary { background: rgba(255,255,255,0.06); color: #aab; }
[data-mantine-color-scheme="dark"] .wai-btn-secondary:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* ===== Streaming output ===== */
.wai-output {
  padding: 4px 20px 12px;
  flex: 1;
  overflow-y: auto;
  max-height: 300px;
}

.wai-output-text {
  font-size: 14px;
  line-height: 1.7;
  color: inherit;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.wai-output-text .wai-cursor {
  display: inline-block;
  width: 2px;
  height: 15px;
  background: #2653B0;
  margin-left: 1px;
  vertical-align: text-bottom;
  animation: wai-blink 0.8s step-end infinite;
}
[data-mantine-color-scheme="dark"] .wai-output-text .wai-cursor { background: #7B9CFF; }

@keyframes wai-blink { 50% { opacity: 0; } }

.wai-output-actions {
  display: flex;
  gap: 8px;
  padding: 10px 20px 16px;
  border-top: 1px solid rgba(0,0,0,0.06);
}
[data-mantine-color-scheme="dark"] .wai-output-actions { border-top-color: rgba(255,255,255,0.06); }

/* ===== Loading ===== */
.wai-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  color: #2653B0;
  font-size: 13px;
  font-weight: 500;
}
[data-mantine-color-scheme="dark"] .wai-loading { color: #7B9CFF; }

.wai-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0,0,0,0.08);
  border-top-color: #2653B0;
  border-radius: 50%;
  animation: wai-spin 0.6s linear infinite;
}
[data-mantine-color-scheme="dark"] .wai-spinner { border-color: rgba(255,255,255,0.1); border-top-color: #7B9CFF; }

@keyframes wai-spin { to { transform: rotate(360deg); } }

/* ===== Context indicator ===== */
.wai-context {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 20px 8px;
  font-size: 11.5px;
  color: #888;
}
.wai-context-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4CAF50;
  flex-shrink: 0;
}

/* ===== Slash menu injected item ===== */
.wai-slash-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.1s;
}
.wai-slash-item:hover { background: var(--mantine-color-default-hover, #f0f0f0); }

.wai-slash-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2653B0 0%, #4B7BF5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 15px;
  flex-shrink: 0;
}
.wai-slash-text { display: flex; flex-direction: column; flex: 1; }
.wai-slash-title { font-size: 13px; font-weight: 500; color: var(--mantine-color-text, #1a1a1a); }
.wai-slash-desc { font-size: 11.5px; color: var(--mantine-color-dimmed, #868e96); }

.wai-kbd {
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0,0,0,0.06);
  color: #888;
  font-size: 10px;
  font-family: monospace;
}
[data-mantine-color-scheme="dark"] .wai-kbd { background: rgba(255,255,255,0.08); }

/* ===== Markdown rendering in output ===== */
.wai-output-text code {
  background: rgba(0,0,0,0.05);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12.5px;
}
[data-mantine-color-scheme="dark"] .wai-output-text code { background: rgba(255,255,255,0.08); }

.wai-output-text pre {
  background: rgba(0,0,0,0.04);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  margin: 8px 0;
}
[data-mantine-color-scheme="dark"] .wai-output-text pre { background: rgba(255,255,255,0.05); }

.wai-output-text pre code { background: none; padding: 0; }
