/* ==========================================================================
 * aria-orb.css — styling for the Aria Orb (collapsed mini-symbol + panel)
 * Palette mirrors the Vox Ordo / aria-workspace dark theme:
 *   --bg #08080b  --surface #131319  --border #24242c  --text #e9ebf2
 *   --accent #5ad1ff  --cyan #7fe0ff  --violet #6a5bff  --ok #46e6a0
 * ======================================================================== */

.aria-orb-root {
  --orb-bg: #0c0c11;
  --orb-surface: #131319;
  --orb-border: #24242c;
  --orb-text: #e9ebf2;
  --orb-muted: #8b90a2;
  --orb-accent: #5ad1ff;
  --orb-cyan: #7fe0ff;
  --orb-violet: #6a5bff;
  --orb-ok: #46e6a0;
  --orb-warn: #ffcd5a;
  --orb-err: #ff6b8b;

  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2147483000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  color: var(--orb-text);
}

/* ---- collapsed mini-symbol button ------------------------------------- */
.aria-orb-mini {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(122, 224, 255, 0.35);
  background:
    radial-gradient(120% 120% at 30% 25%, rgba(106, 91, 255, 0.35), rgba(12, 12, 17, 0.95) 60%),
    var(--orb-surface);
  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(0, 0, 0, 0.4),
    0 0 22px rgba(90, 209, 255, 0.18);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: transform 0.18s ease, box-shadow 0.25s ease;
}
.aria-orb-mini:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.6),
    0 0 30px rgba(90, 209, 255, 0.4);
}
.aria-orb-mini svg { width: 34px; height: 34px; }

/* Aria glyph — concentric voice rings + breathing core */
.aria-orb-mini .ring,
.aria-orb-mark .ring {
  fill: none;
  stroke: var(--orb-cyan);
  stroke-width: 1.4;
  opacity: 0.55;
}
.aria-orb-mini .ring.r1 { animation: orb-pulse 3.2s ease-in-out infinite; }
.aria-orb-mini .ring.r2 { animation: orb-pulse 3.2s ease-in-out infinite 0.5s; opacity: 0.75; }
.aria-orb-mini .core,
.aria-orb-mark .core {
  fill: var(--orb-accent);
  filter: drop-shadow(0 0 6px rgba(90, 209, 255, 0.8));
  animation: orb-breathe 3.2s ease-in-out infinite;
}
@keyframes orb-pulse {
  0%, 100% { transform: scale(1); opacity: 0.45; transform-origin: center; }
  50% { transform: scale(1.06); opacity: 0.85; }
}
@keyframes orb-breathe {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}

/* ---- expand / collapse state ------------------------------------------ */
.aria-orb-root.collapsed .aria-orb-panel {
  opacity: 0;
  transform: translateY(10px) scale(0.96);
  pointer-events: none;
}
.aria-orb-root:not(.collapsed) .aria-orb-mini {
  /* keep the mini visible but de-emphasized while open */
  opacity: 0.0;
  pointer-events: none;
}

/* ---- expanded panel ---------------------------------------------------- */
.aria-orb-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 360px;
  max-width: calc(100vw - 32px);
  max-height: min(78vh, 620px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #14141c 0%, var(--orb-bg) 100%);
  border: 1px solid var(--orb-border);
  border-radius: 18px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(90, 209, 255, 0.08);
  overflow: hidden;
  transform-origin: bottom right;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.aria-orb-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--orb-border);
}
.aria-orb-mark { width: 26px; height: 26px; display: inline-grid; place-items: center; }
.aria-orb-mark svg { width: 26px; height: 26px; }
.aria-orb-title { font-weight: 600; font-size: 14.5px; letter-spacing: 0.2px; flex: 1; }
.aria-orb-close {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--orb-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 8px;
}
.aria-orb-close:hover { color: var(--orb-text); background: rgba(255, 255, 255, 0.05); }

.aria-orb-purpose {
  padding: 12px 16px 4px;
  font-size: 12.8px;
  line-height: 1.5;
  color: var(--orb-muted);
}

/* ---- rotating context card -------------------------------------------- */
.aria-orb-card {
  margin: 12px 14px 4px;
  padding: 12px 14px;
  border: 1px solid var(--orb-border);
  border-radius: 12px;
  background: rgba(106, 91, 255, 0.06);
}
.aria-orb-card-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--orb-accent);
  margin-bottom: 6px;
}
.aria-orb-card-body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--orb-text);
  min-height: 2.6em;
  white-space: pre-wrap;
  transition: opacity 0.3s ease;
}

/* ---- tools rail -------------------------------------------------------- */
.aria-orb-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px 4px;
}
.aria-orb-tool {
  appearance: none;
  border: 1px solid rgba(90, 209, 255, 0.35);
  background: rgba(90, 209, 255, 0.08);
  color: var(--orb-cyan);
  font-size: 12px;
  font-weight: 500;
  padding: 7px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.aria-orb-tool:hover { background: rgba(90, 209, 255, 0.16); transform: translateY(-1px); }
.aria-orb-tool.is-stub {
  border-color: rgba(255, 205, 90, 0.35);
  color: var(--orb-warn);
  background: rgba(255, 205, 90, 0.07);
}
.aria-orb-tools-empty { font-size: 12px; color: var(--orb-muted); padding: 2px 2px; }

/* ---- tool-runner result strip ----------------------------------------- */
.aria-orb-result {
  margin: 8px 14px 0;
  padding: 0 12px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--orb-text);
  white-space: pre-wrap;
  max-height: 0;
  opacity: 0;
  overflow-y: auto;
  transition: max-height 0.25s ease, opacity 0.25s ease, padding 0.25s ease;
}
.aria-orb-result.show { max-height: 160px; opacity: 1; padding: 10px 12px; }
.aria-orb-result.pending { color: var(--orb-muted); }
.aria-orb-result.ok { border-left: 2px solid var(--orb-ok); }
.aria-orb-result.stub { border-left: 2px solid var(--orb-warn); color: var(--orb-warn); }
.aria-orb-result.err { border-left: 2px solid var(--orb-err); color: var(--orb-err); }

/* ---- voice (EL convai) host ------------------------------------------- */
.aria-orb-voice {
  margin-top: auto;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--orb-border);
}
.aria-orb-convai-host { min-height: 56px; display: flex; justify-content: center; }
.aria-orb-voice-off { font-size: 12px; color: var(--orb-muted); }

/* ---- small screens ----------------------------------------------------- */
@media (max-width: 420px) {
  .aria-orb-root { right: 14px; bottom: 14px; }
  .aria-orb-panel { width: calc(100vw - 28px); }
}

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .aria-orb-mini .ring, .aria-orb-mini .core { animation: none !important; }
}
