/* ==========================================================================
 * astra_forge_indicator.css — ambient input-side prompt-assist styles.
 * Namespaced .af-* / .afb-* to prevent collision with any domain theme.
 * Palette borrowed from RAT_CHAT/static/js/astra_forge_rail.js (Astra Forge
 * signature: amber head + cyan online-dot + slate offline-dot).
 * ========================================================================== */

/* Wrap: sits above .input-area, right-aligned, tiny, unobtrusive */
.af-indicator-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 6px 22px 2px;
  font-family: 'Share Tech Mono', ui-monospace, monospace;
  position: relative;
  z-index: 5;
}

.af-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7d8590;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(125, 133, 144, 0.28);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  transition: color .2s ease, border-color .2s ease, background .2s ease, transform .18s ease;
}
.af-indicator:hover, .af-indicator:focus-visible {
  color: #f0a500;
  border-color: rgba(240, 165, 0, 0.5);
  outline: none;
  transform: translateY(-1px);
}

/* Status dot — identical logic to Astra Forge on rat-engine */
.af-status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7d8590;
  transition: background .3s ease, box-shadow .3s ease;
}
.af-indicator.idle       .af-status-dot { background: #7d8590; }
.af-indicator.evaluating .af-status-dot { background: #f0a500; box-shadow: 0 0 5px #f0a50080; animation: af-pulse 0.9s ease-in-out infinite; }
.af-indicator.online     .af-status-dot { background: #00d4ff; box-shadow: 0 0 6px #00d4ff80; }
.af-indicator.offline    .af-status-dot { background: #ff3366; }

.af-indicator.online  { color: #00d4ff; border-color: rgba(0, 212, 255, 0.5); }
.af-indicator.evaluating { color: #f0a500; border-color: rgba(240, 165, 0, 0.5); }

@keyframes af-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(1.35); }
}
@media (prefers-reduced-motion: reduce) {
  .af-indicator.evaluating .af-status-dot { animation: none; }
}

/* Bubble: glassmorphism panel that floats above the input area */
.af-prompt-bubble {
  position: relative;
  margin: 8px 22px 4px;
  padding: 14px 16px 12px;
  background: rgba(13, 17, 23, 0.92);
  color: #e6edf3;
  border: 1px solid rgba(0, 212, 255, 0.35);
  border-left: 3px solid #00d4ff;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 212, 255, 0.12), 0 0 0 1px rgba(0, 212, 255, 0.05);
  font-family: 'Share Tech Mono', ui-monospace, monospace;
  transform: translateY(6px);
  opacity: 0;
  transition: opacity .22s ease, transform .22s cubic-bezier(.4,0,.2,1);
  z-index: 10;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.af-prompt-bubble.open {
  transform: translateY(0);
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .af-prompt-bubble { transition: opacity .22s ease; transform: none; }
}

/* Small caret pointing at the input area below */
.afb-tail {
  position: absolute;
  bottom: -7px;
  left: 32px;
  width: 14px;
  height: 14px;
  background: rgba(13, 17, 23, 0.92);
  border-right: 1px solid rgba(0, 212, 255, 0.35);
  border-bottom: 1px solid rgba(0, 212, 255, 0.35);
  transform: rotate(45deg);
}

.afb-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #00d4ff;
}
.afb-title { flex: 1; font-family: inherit; font-weight: 600; }
.afb-x {
  background: transparent;
  color: #7d8590;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  line-height: 1;
  border-radius: 4px;
  transition: color .18s ease, background .18s ease;
}
.afb-x:hover, .afb-x:focus-visible { color: #ffffff; background: rgba(255,255,255,0.06); outline: none; }

.afb-body { margin: 0 0 12px; }
.afb-quote {
  font: italic 500 14px/1.5 'Source Serif 4', Georgia, serif;
  color: #e6edf3;
  padding: 8px 12px;
  background: rgba(0, 212, 255, 0.06);
  border-left: 2px solid rgba(0, 212, 255, 0.5);
  border-radius: 4px;
  word-break: break-word;
}

.afb-actions { display: flex; gap: 8px; justify-content: flex-end; }
.afb-btn {
  padding: 6px 14px;
  font: 500 11px/1.2 'Share Tech Mono', ui-monospace, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .18s ease, color .18s ease, transform .12s ease, border-color .18s ease;
}
.afb-btn:active { transform: translateY(1px); }
.afb-primary {
  background: #00d4ff;
  color: #0d1117;
  border-color: #00d4ff;
  font-weight: 700;
}
.afb-primary:hover, .afb-primary:focus-visible { background: #4ce0ff; outline: none; }
.afb-ghost {
  background: transparent;
  color: #7d8590;
  border-color: rgba(125, 133, 144, 0.35);
}
.afb-ghost:hover, .afb-ghost:focus-visible { color: #e6edf3; border-color: #7d8590; outline: none; }

/* Light-theme domains: soften the glass so it doesn't look like a dark hole */
body:not(.theme-black_ink):not(.theme-strategic_dark) .af-prompt-bubble {
  background: rgba(255, 255, 255, 0.96);
  color: #0d1117;
  border-color: rgba(0, 128, 160, 0.45);
  border-left-color: #0080a0;
  box-shadow: 0 12px 32px rgba(0, 128, 160, 0.14), 0 0 0 1px rgba(0, 128, 160, 0.04);
}
body:not(.theme-black_ink):not(.theme-strategic_dark) .afb-tail {
  background: rgba(255, 255, 255, 0.96);
  border-right-color: rgba(0, 128, 160, 0.45);
  border-bottom-color: rgba(0, 128, 160, 0.45);
}
body:not(.theme-black_ink):not(.theme-strategic_dark) .afb-head { color: #0080a0; }
body:not(.theme-black_ink):not(.theme-strategic_dark) .afb-quote {
  color: #0d1117;
  background: rgba(0, 128, 160, 0.06);
  border-left-color: rgba(0, 128, 160, 0.5);
}
body:not(.theme-black_ink):not(.theme-strategic_dark) .afb-primary {
  background: #0080a0;
  color: #ffffff;
  border-color: #0080a0;
}
body:not(.theme-black_ink):not(.theme-strategic_dark) .afb-primary:hover { background: #0099bd; }
body:not(.theme-black_ink):not(.theme-strategic_dark) .af-indicator { color: #556; }
body:not(.theme-black_ink):not(.theme-strategic_dark) .af-indicator:hover { color: #f0a500; }

/* Mobile: tighten padding, stack actions if narrow */
@media (max-width: 540px) {
  .af-indicator-wrap { padding: 4px 14px 2px; }
  .af-prompt-bubble { margin: 6px 14px 4px; padding: 12px 14px 10px; }
  .afb-quote { font-size: 13px; }
  .afb-actions { flex-direction: column-reverse; align-items: stretch; }
  .afb-btn { text-align: center; }
}

/* ==============================================================
 * IDIOT-PROOF COACHING LAYER (v2)
 *
 * Purpose: make first-time visitors instantly understand what the
 * ▲ ASTRA FORGE chip does, without any hover or discovery required.
 *
 * Ships four small elements, all namespaced af-*:
 *   · .af-cta          — the "click me for a better prompt" tail on the chip
 *   · .af-coach        — the dim helper line under the input
 *   · .af-first-arrow  — the one-shot pointer arrow toward the input (localStorage-gated)
 *   · .af-empty-toast  — the friendly toast when user clicks chip with empty input
 * ============================================================== */

/* Chip "click me" tail — shows on desktop, hides on narrow screens */
.af-cta {
  opacity: 0.85;
  font-weight: 500;
  letter-spacing: 0.01em;
  margin-left: 2px;
}
.af-indicator:hover .af-cta,
.af-indicator:focus-visible .af-cta { opacity: 1; }
@media (max-width: 720px) {
  .af-cta { display: none; }
}

/* Coach line under the input area */
.af-coach {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 20px 10px;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(180, 190, 205, 0.85);
  transition: opacity 0.6s ease-in-out;
}
.af-coach.af-coach-dim { opacity: 0.35; }
.af-coach:hover { opacity: 1 !important; }
.af-coach-icon { font-size: 14px; line-height: 1.4; flex-shrink: 0; }
.af-coach-text { flex: 1; }
.af-coach-text strong { color: #f0a500; font-weight: 600; }
.af-coach-brand {
  color: #00d4ff;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
/* Light-theme adaptation */
body:not(.theme-black_ink):not(.theme-strategic_dark) .af-coach {
  color: rgba(60, 70, 90, 0.80);
}
body:not(.theme-black_ink):not(.theme-strategic_dark) .af-coach-text strong { color: #c47a00; }
body:not(.theme-black_ink):not(.theme-strategic_dark) .af-coach-brand { color: #0080a0; }

/* First-visit pointer arrow */
.af-first-arrow {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 0 40px 0 20px;
  margin: -2px 0 -6px;
  color: #f0a500;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
  text-align: right;
  pointer-events: none;
  animation: af-arrow-in 0.6s ease-out both, af-arrow-bob 2.2s ease-in-out 0.8s infinite;
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}
.af-first-arrow.af-arrow-out {
  opacity: 0;
  transform: translateY(-6px);
}
.af-arrow-copy {
  display: inline-block;
  padding: 4px 10px;
  border: 1px dashed rgba(240, 165, 0, 0.55);
  border-radius: 10px;
  background: rgba(240, 165, 0, 0.08);
}
.af-arrow-copy b { color: #00d4ff; font-weight: 700; letter-spacing: 0.02em; }
.af-arrow-svg {
  width: 36px;
  height: 48px;
  margin-right: 8px;
  filter: drop-shadow(0 0 3px rgba(240, 165, 0, 0.35));
}
@keyframes af-arrow-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes af-arrow-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(3px); }
}
@media (prefers-reduced-motion: reduce) {
  .af-first-arrow { animation: af-arrow-in 0.4s ease-out both; }
}
@media (max-width: 720px) {
  .af-first-arrow { padding: 0 20px 0 14px; font-size: 11px; }
  .af-arrow-svg { width: 28px; height: 38px; }
}

/* Empty-click toast (anchored to the chip wrap) */
.af-indicator-wrap { position: relative; }
.af-empty-toast {
  position: absolute;
  right: 16px;
  top: 100%;
  margin-top: 4px;
  z-index: 20;
  max-width: 320px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(24, 32, 44, 0.96);
  border: 1px solid rgba(240, 165, 0, 0.55);
  color: #f5d992;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  animation: af-toast-in 0.28s ease-out both;
  transition: opacity 0.35s ease-out, transform 0.35s ease-out;
}
.af-empty-toast.af-toast-out {
  opacity: 0;
  transform: translateY(-4px);
}
@keyframes af-toast-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* Light theme toast */
body:not(.theme-black_ink):not(.theme-strategic_dark) .af-empty-toast {
  background: #fffaf0;
  color: #7a5200;
  border-color: rgba(196, 122, 0, 0.55);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}
