/* ==========================================================================
   CRISPRmart Unified AI Agent — widget styles (shared by all 10 domains)
   Uses only tokens from brand.css. Direction-aware (logical properties).
   ========================================================================== */

.agent-fab {
  position: fixed;
  inset-block-end: 20px;
  inset-inline-end: 20px;
  z-index: 90;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 18px 10px 12px;
  border: 1px solid rgba(var(--gold-rgb), .55);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(8, 48, 90, .96), rgba(4, 31, 61, .96));
  color: var(--text);
  font-weight: 700; font-size: .92rem;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .5), 0 0 26px rgba(var(--blue-rgb), .35);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: transform .3s var(--ease), box-shadow .3s;
}
.agent-fab:hover { transform: translateY(-3px); box-shadow: 0 14px 40px rgba(0,0,0,.55), 0 0 34px rgba(var(--blue-rgb), .6); }
.agent-fab__orb {
  position: relative; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-size: 17px;
  background: radial-gradient(circle at 30% 25%, #5BD3FF, var(--blue) 55%, #0a5f8a);
  box-shadow: 0 0 16px rgba(var(--blue-rgb), .8);
}
.agent-fab__orb::after {            /* soft pulse = "alive" */
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid rgba(var(--blue-rgb), .8);
  animation: agent-ping 2.6s ease-out infinite;
}
@keyframes agent-ping { from { transform: scale(1); opacity: .8; } to { transform: scale(1.8); opacity: 0; } }

.agent-panel {
  position: fixed;
  inset-block-end: 84px;
  inset-inline-end: 20px;
  z-index: 91;
  width: min(390px, calc(100vw - 24px));
  height: min(580px, calc(100dvh - 110px));
  display: flex; flex-direction: column;
  border-radius: 22px;
  border: 1px solid rgba(var(--blue-rgb), .4);
  background: linear-gradient(170deg, rgba(8, 48, 90, .97), rgba(3, 23, 41, .98));
  box-shadow: 0 30px 80px rgba(0, 0, 0, .65), 0 0 40px rgba(var(--blue-rgb), .2);
  overflow: hidden;
  opacity: 0; visibility: hidden; transform: translateY(14px) scale(.98);
  transition: opacity .25s, transform .35s var(--ease), visibility .25s;
}
.agent-panel.is-open { opacity: 1; visibility: visible; transform: none; }

.agent-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: rgba(var(--blue-rgb), .06); }
.agent-head__title { font-weight: 800; line-height: 1.3; }
.agent-head__sub { font-size: .75rem; color: var(--muted); line-height: 1.4; }
.agent-head__text { flex: 1; min-width: 0; }
.agent-close { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; }
.agent-close:hover { color: var(--text); border-color: var(--blue); }

.agent-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.agent-msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: .92rem; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.agent-msg--bot { align-self: flex-start; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); border-end-start-radius: 4px; }
.agent-msg--user { align-self: flex-end; color: #021426; background: linear-gradient(135deg, #5BD3FF, var(--blue)); border-end-end-radius: 4px; font-weight: 600; }
.agent-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.agent-link { padding: 4px 12px; border-radius: 999px; font-size: .8rem; border: 1px solid rgba(var(--gold-rgb), .55); color: var(--gold); transition: background .2s; }
.agent-link:hover { background: rgba(var(--gold-rgb), .14); }

.agent-typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.agent-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); animation: agent-dot 1s infinite; }
.agent-typing i:nth-child(2) { animation-delay: .15s; }
.agent-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes agent-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }

.agent-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.agent-suggest button { padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.03); color: var(--muted); font-size: .8rem; transition: all .2s; }
.agent-suggest button:hover { color: var(--text); border-color: var(--blue); background: rgba(var(--blue-rgb), .12); }

.agent-form { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }
.agent-form input { flex: 1; min-width: 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(2, 14, 28, .7); outline: none; transition: border-color .2s, box-shadow .2s; }
.agent-form input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(var(--blue-rgb), .18); }
.agent-form button { width: 42px; height: 42px; flex: none; border: 0; border-radius: 50%; color: #1b1500; font-size: 17px; background: linear-gradient(135deg, #FFE55C, var(--gold)); }
.agent-form button:disabled { opacity: .5; }
[dir="rtl"] .agent-form button svg { transform: scaleX(-1); }

.agent-foot { display: flex; justify-content: space-between; gap: 8px; padding: 0 16px 10px; font-size: .7rem; color: var(--muted); }
.agent-mode::before { content: "●"; margin-inline-end: 6px; color: var(--muted); }
.agent-mode[data-mode="online"]::before { color: var(--tq); }
.agent-mode[data-mode="local"]::before { color: var(--gold); }

@media (max-width: 520px) {
  .agent-fab { inset-block-end: 14px; inset-inline-end: 14px; padding: 8px 12px 8px 8px; }
  .agent-fab__label { display: none; }
  .agent-panel { inset-inline: 12px; width: auto; inset-block-end: 74px; }
}
