/* ============================================================
   ANGAZA HISA — AI Research Desk (chat)
   Self-contained; uses theme vars from style.css
   ============================================================ */

/* ---------- FAB ---------- */
.rd-fab {
  position: fixed; right: 18px; bottom: 100px; z-index: 980;
  display: flex; align-items: center; gap: 9px;
  padding: 11px 16px 11px 12px; border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, 0.45);
  background: linear-gradient(135deg, rgba(13, 24, 56, 0.92), rgba(10, 16, 34, 0.92));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  color: var(--cyan); cursor: pointer; font-family: var(--font-m);
  font-size: 11px; letter-spacing: 2.2px; font-weight: 700;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(34, 211, 238, 0.08) inset, 0 0 24px rgba(34, 211, 238, 0.18);
  transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.3), box-shadow 0.25s, border-color 0.25s;
}
.rd-fab:hover { transform: translateY(-3px) scale(1.03); border-color: rgba(34, 211, 238, 0.8); box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 32px rgba(34, 211, 238, 0.3); }
.rd-fab:active { transform: translateY(0) scale(0.97); }
.rd-fab-ico { display: inline-flex; width: 26px; height: 26px; align-items: center; justify-content: center; }
.rd-fab-ico .luc { width: 22px; height: 22px; filter: drop-shadow(0 0 6px rgba(34, 211, 238, 0.6)); }
.rd-fab-label { display: inline-block; }
@keyframes rd-breathe { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.8); } }

/* hide FAB while the login overlay is showing (markup sits after it in DOM) */
#login-overlay:not([hidden]) ~ .rd-fab,
#login-overlay.show ~ .rd-fab { opacity: 0; pointer-events: none; transform: translateY(12px); }

/* ---------- Panel ---------- */
.rd-panel {
  position: fixed; right: 18px; bottom: 158px; z-index: 981;
  width: min(430px, calc(100vw - 28px));
  height: min(640px, calc(100dvh - 190px));
  display: flex; flex-direction: column;
  border-radius: 18px; overflow: hidden;
  background: linear-gradient(165deg, rgba(12, 20, 44, 0.94), rgba(6, 10, 24, 0.97));
  border: 1px solid var(--line2);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(34, 211, 238, 0.05) inset;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  opacity: 0; transform: translateY(24px) scale(0.985); pointer-events: none;
  transition: opacity 0.28s ease, transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.15);
  font-family: var(--font-d);
}
.rd-panel.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.rd-panel::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(600px 240px at 15% -10%, rgba(34, 211, 238, 0.12), transparent 60%),
    radial-gradient(500px 260px at 100% 110%, rgba(167, 139, 250, 0.10), transparent 60%);
}

.rd-head {
  display: flex; align-items: center; gap: 11px; padding: 13px 14px;
  border-bottom: 1px solid var(--line); position: relative; z-index: 1;
  background: rgba(8, 13, 30, 0.6);
}
.rd-head-ico { display: inline-flex; width: 34px; height: 34px; border-radius: 10px; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.16), rgba(167, 139, 250, 0.16)); border: 1px solid rgba(34, 211, 238, 0.3); }
.rd-head-ico .luc { width: 19px; height: 19px; color: var(--cyan); }
.rd-title { font-size: 13px; font-weight: 800; letter-spacing: 2.4px; color: var(--text);
  background: linear-gradient(90deg, var(--cyan), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rd-sub { font-size: 9.5px; letter-spacing: 1.6px; color: var(--faint); display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.rd-pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: rd-breathe 1.6s infinite; display: inline-block; }
.rd-close { margin-left: auto; width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line);
  background: transparent; color: var(--dim); cursor: pointer; font-size: 13px; transition: all 0.2s; }
.rd-close:hover { color: var(--red); border-color: rgba(251, 113, 133, 0.5); background: rgba(251, 113, 133, 0.08); }

/* ---------- messages ---------- */
.rd-msgs { flex: 1; overflow-y: auto; padding: 14px 13px 8px; position: relative; z-index: 1;
  display: flex; flex-direction: column; gap: 11px; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.rd-msgs::-webkit-scrollbar { width: 5px; } .rd-msgs::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 4px; }

.rd-msg { max-width: 88%; display: flex; flex-direction: column; gap: 4px; animation: rd-msg-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
@keyframes rd-msg-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.rd-msg.user { align-self: flex-end; }
.rd-msg.bot { align-self: flex-start; max-width: 94%; }
.rd-who { font-size: 8.5px; letter-spacing: 2px; color: var(--faint); font-family: var(--font-m); padding: 0 4px; }
.rd-msg.user .rd-who { text-align: right; color: var(--cyan); }
.rd-bubble {
  padding: 10px 13px; border-radius: 14px; font-size: 12.8px; line-height: 1.55; color: var(--text);
  border: 1px solid var(--line);
}
.rd-msg.user .rd-bubble {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.16), rgba(167, 139, 250, 0.14));
  border-color: rgba(34, 211, 238, 0.35); border-bottom-right-radius: 4px;
}
.rd-msg.bot .rd-bubble {
  background: rgba(10, 17, 38, 0.85); border-color: rgba(148, 163, 255, 0.16); border-bottom-left-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
.rd-plain { white-space: pre-wrap; word-break: break-word; }
.rd-msg .mono-sm { font-family: var(--font-m); font-size: 10.5px; }

/* typing indicator */
.rd-typing { display: inline-flex; align-items: center; gap: 8px; }
.rd-typing .rd-dots { display: inline-flex; gap: 4px; }
.rd-typing .rd-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); animation: rd-dot 1.1s infinite; }
.rd-typing .rd-dots i:nth-child(2) { animation-delay: 0.15s; } .rd-typing .rd-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes rd-dot { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.rd-typing .rd-phase { font-family: var(--font-m); font-size: 10px; letter-spacing: 1.4px; color: var(--faint); }

/* ---------- verdict card ---------- */
.rd-card { display: flex; flex-direction: column; gap: 9px; }
.rd-card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rd-sym { font-size: 16px; font-weight: 800; letter-spacing: 1px; color: var(--text); }
.rd-name { font-size: 11.5px; color: var(--dim); }
.rd-chip { font-family: var(--font-m); font-size: 9px; letter-spacing: 1.6px; padding: 3px 8px; border-radius: 999px; border: 1px solid; font-weight: 700; }
.rd-chip.mkt { color: var(--violet); border-color: rgba(167, 139, 250, 0.45); background: rgba(167, 139, 250, 0.08); }
.rd-chip.grade { color: var(--amber); border-color: rgba(251, 191, 36, 0.45); background: rgba(251, 191, 36, 0.08); }
.rd-chip.sig-buy { color: var(--green); border-color: rgba(52, 211, 153, 0.45); background: rgba(52, 211, 153, 0.08); }
.rd-chip.sig-sell { color: var(--red); border-color: rgba(251, 113, 133, 0.45); background: rgba(251, 113, 133, 0.08); }
.rd-chip.sig-hold { color: var(--amber); border-color: rgba(251, 191, 36, 0.45); background: rgba(251, 191, 36, 0.08); }
.rd-price { font-family: var(--font-m); font-size: 13px; margin-left: auto; }
.rd-price .up { color: var(--green); } .rd-price .down { color: var(--red); }
.rd-stance { font-size: 10px; font-family: var(--font-m); letter-spacing: 1.8px; padding: 4px 10px; border-radius: 8px; border: 1px solid; text-align: center; }
.rd-stance.bull { color: var(--green); border-color: rgba(52, 211, 153, 0.5); background: rgba(52, 211, 153, 0.1); }
.rd-stance.bear { color: var(--red); border-color: rgba(251, 113, 133, 0.5); background: rgba(251, 113, 133, 0.1); }
.rd-stance.neut { color: var(--amber); border-color: rgba(251, 191, 36, 0.5); background: rgba(251, 191, 36, 0.1); }

.rd-conf { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.rd-conf .rd-clabel { font-size: 9px; letter-spacing: 1.8px; color: var(--faint); font-family: var(--font-m); flex: 0 0 auto; }
.rd-conf .rd-cbar { flex: 1; height: 6px; border-radius: 4px; background: rgba(148, 163, 255, 0.12); overflow: hidden; }
.rd-conf .rd-cfill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--cyan), var(--violet)); width: 0; transition: width 0.9s cubic-bezier(0.2, 0.9, 0.3, 1); }
.rd-conf .rd-cval { font-family: var(--font-m); font-size: 10.5px; color: var(--cyan); flex: 0 0 auto; }

.rd-scores { display: flex; flex-direction: column; gap: 5px; margin-top: 2px; }
.rd-score { display: flex; align-items: center; gap: 8px; }
.rd-score .rd-sl { font-size: 9px; letter-spacing: 1.6px; color: var(--faint); font-family: var(--font-m); width: 74px; flex: 0 0 auto; }
.rd-score .rd-sbar { flex: 1; height: 5px; border-radius: 4px; background: rgba(148, 163, 255, 0.10); overflow: hidden; }
.rd-score .rd-sfill { height: 100%; border-radius: 4px; width: 0; transition: width 0.8s cubic-bezier(0.2, 0.9, 0.3, 1); }
.rd-score .rd-sv { font-family: var(--font-m); font-size: 9.5px; width: 24px; text-align: right; color: var(--dim); }

.rd-col { border-radius: 11px; padding: 8px 10px; border: 1px solid; }
.rd-col h5 { font-size: 9px; letter-spacing: 2px; margin-bottom: 5px; font-family: var(--font-m); }
.rd-col ul { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.rd-col li { font-size: 11.3px; line-height: 1.5; padding-left: 13px; position: relative; color: var(--text); }
.rd-col li::before { content: "▸"; position: absolute; left: 0; top: 0; font-size: 10px; }
.rd-col.bull { border-color: rgba(52, 211, 153, 0.28); background: rgba(52, 211, 153, 0.05); }
.rd-col.bull h5 { color: var(--green); } .rd-col.bull li::before { color: var(--green); }
.rd-col.bear { border-color: rgba(251, 113, 133, 0.28); background: rgba(251, 113, 133, 0.05); }
.rd-col.bear h5 { color: var(--red); } .rd-col.bear li::before { color: var(--red); }
.rd-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
@media (max-width: 480px) { .rd-rows { grid-template-columns: 1fr; } }
.rd-mini { border-radius: 10px; border: 1px solid var(--line); background: rgba(148, 163, 255, 0.04); padding: 7px 9px; }
.rd-mini h6 { font-size: 8.5px; letter-spacing: 1.8px; color: var(--faint); font-family: var(--font-m); margin-bottom: 3px; }
.rd-mini p { font-size: 11px; line-height: 1.5; color: var(--text); }
.rd-mini ul { list-style: none; display: flex; flex-direction: column; gap: 3px; }
.rd-mini li { font-size: 10.8px; color: var(--text); font-family: var(--font-m); }
.rd-mini li b { color: var(--cyan); font-weight: 600; }
.rd-mini .rd-risk { color: #f9a8b8; }

.rd-bottom { border-radius: 11px; padding: 9px 11px; border: 1px solid rgba(251, 191, 36, 0.3);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(167, 139, 250, 0.07)); }
.rd-bottom h5 { font-size: 9px; letter-spacing: 2px; color: var(--amber); font-family: var(--font-m); margin-bottom: 4px; }
.rd-bottom p { font-size: 11.5px; line-height: 1.55; color: var(--text); }
.rd-bottom .rd-band { color: var(--amber); font-weight: 700; }
.rd-disc { font-size: 8.5px; letter-spacing: 1px; color: var(--faint); font-family: var(--font-m); margin-top: 2px; }

/* toppicks / lists */
.rd-pick-row { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 10px; border: 1px solid var(--line); background: rgba(148, 163, 255, 0.04); }
.rd-pick-row + .rd-pick-row { margin-top: 5px; }
.rd-pick-sym { font-family: var(--font-m); font-size: 11.5px; font-weight: 700; color: var(--cyan); width: 52px; flex: 0 0 auto; }
.rd-pick-name { flex: 1; font-size: 10.5px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-pick-chg { font-family: var(--font-m); font-size: 10.5px; }
.rd-pick-sig { font-family: var(--font-m); font-size: 8.5px; letter-spacing: 1px; padding: 2px 6px; border-radius: 6px; border: 1px solid; color: var(--green); border-color: rgba(52, 211, 153, 0.4); }
.rd-pick-reason { font-size: 9.5px; color: var(--faint); font-family: var(--font-m); width: 100%; margin-top: 3px; }
.rd-sec { font-size: 9px; letter-spacing: 2.2px; color: var(--violet); font-family: var(--font-m); margin: 8px 0 4px; }

/* mood gauges */
.rd-fg { display: flex; gap: 8px; }
.rd-fg-box { flex: 1; border-radius: 11px; border: 1px solid var(--line); background: rgba(148, 163, 255, 0.04); padding: 8px 10px; text-align: center; }
.rd-fg-box .rd-fgv { font-family: var(--font-m); font-size: 21px; font-weight: 800; }
.rd-fg-box .rd-fgl { font-size: 9px; letter-spacing: 1.8px; font-family: var(--font-m); margin-top: 2px; }
.rd-fg-box .rd-fgc { height: 5px; border-radius: 4px; background: rgba(148, 163, 255, 0.12); margin-top: 7px; overflow: hidden; }
.rd-fg-box .rd-fgc i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--red), var(--amber), var(--green)); }
.rd-fg-box .rd-fgc i { width: var(--w, 50%); margin-left: var(--o, 0%); }
.rd-fg.fear .rd-fgv { color: var(--red); } .rd-fg.neutral .rd-fgv { color: var(--amber); } .rd-fg.greed .rd-fgv { color: var(--green); }

/* compare */
.rd-cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rd-cmp-box { border-radius: 11px; border: 1px solid var(--line2); padding: 9px 10px; background: rgba(10, 17, 38, 0.7); }
.rd-cmp-box.win { border-color: rgba(52, 211, 153, 0.5); box-shadow: 0 0 18px rgba(52, 211, 153, 0.12); }
.rd-cmp-sym { font-size: 14px; font-weight: 800; font-family: var(--font-m); }
.rd-cmp-row { display: flex; justify-content: space-between; font-size: 10.5px; margin-top: 4px; font-family: var(--font-m); }
.rd-cmp-row span:first-child { color: var(--faint); } .rd-cmp-row span:last-child { color: var(--text); }

/* ---------- chips ---------- */
.rd-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 13px 8px; position: relative; z-index: 1; }
.rd-chipq { font-family: var(--font-m); font-size: 9.5px; letter-spacing: 0.6px; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line2); background: rgba(148, 163, 255, 0.05); color: var(--dim); cursor: pointer; transition: all 0.18s; }
.rd-chipq:hover { color: var(--cyan); border-color: rgba(34, 211, 238, 0.5); background: rgba(34, 211, 238, 0.08); transform: translateY(-1px); }

/* ---------- input ---------- */
.rd-input-row { display: flex; gap: 8px; padding: 8px 13px 10px; position: relative; z-index: 1; border-top: 1px solid var(--line); background: rgba(8, 13, 30, 0.55); }
.rd-input { flex: 1; padding: 11px 13px; border-radius: 11px; border: 1px solid var(--line2);
  background: rgba(148, 163, 255, 0.06); color: var(--text); font-size: 12.5px; font-family: var(--font-d); outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
.rd-input::placeholder { color: var(--faint); }
.rd-input:focus { border-color: rgba(34, 211, 238, 0.6); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12); }
.rd-send { width: 42px; height: 42px; border-radius: 11px; border: none; cursor: pointer; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--cyan), var(--violet)); color: #04101f; font-size: 16px; font-weight: 800;
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s; }
.rd-send:hover { transform: translateY(-1px); filter: brightness(1.1); box-shadow: 0 6px 18px rgba(34, 211, 238, 0.35); }
.rd-send:active { transform: scale(0.94); }
.rd-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; filter: none; }

.rd-foot { font-size: 8px; letter-spacing: 1.6px; color: var(--faint); text-align: center; padding: 6px 10px 8px; font-family: var(--font-m); position: relative; z-index: 1; border-top: 1px solid rgba(148, 163, 255, 0.06); background: rgba(8, 13, 30, 0.45); }

/* ---------- mobile ---------- */
@media (max-width: 640px) {
  .rd-fab { bottom: calc(env(safe-area-inset-bottom, 0px) + 108px); right: 12px; padding: 10px 14px 10px 10px; }
  .rd-fab-label { display: inline-block; font-size: 9.5px; letter-spacing: 1.6px; }
  .rd-fab-ico { width: 24px; height: 24px; }
  .rd-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; border-left: none; border-right: none; border-bottom: none; }
  .rd-msg, .rd-msg.bot { max-width: 97%; }
  .rd-cmp { grid-template-columns: 1fr; }
}

/* track-record link inside verdict cards */
.rd-trk-link {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 8px;
  font-family: var(--font-m); font-size: 9px; letter-spacing: 1.4px; color: var(--amber);
  padding: 6px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(251, 191, 36, 0.35); background: rgba(251, 191, 36, 0.07);
  transition: all 0.2s;
}
.rd-trk-link:hover { border-color: rgba(251, 191, 36, 0.75); box-shadow: 0 0 16px rgba(251, 191, 36, 0.25); transform: translateY(-1px); }
.rd-trk-link .luc { width: 12px; height: 12px; }
