/* ============================================================
   Asistente de productos — widget de chat
   Colores de marca del sitio (#0B6FA4). Se queda oculto hasta
   que asistente.js confirma que el servicio esta disponible.
   ============================================================ */
.oa {
  --oa-brand: #0b6fa4;
  --oa-brand-hover: #08557e;
  --oa-brand-soft: #e6f2f9;
  --oa-on-brand: #ffffff;
  --oa-panel: #ffffff;
  --oa-panel-2: #f6f8fb;
  --oa-ink: #0f172a;
  --oa-muted: #475569;
  --oa-faint: #7589a0;
  --oa-border: #d8e3ec;
  --oa-border-soft: #e6edf3;
  --oa-bot: #eef4f9;
  --oa-bot-ink: #16304a;
  --oa-head: #0a1a2f;
  --oa-head-2: #12263f;
  --oa-head-ink: #eaf2f9;
  --oa-head-faint: #93a9c0;
  --oa-shadow: 0 30px 60px -22px rgba(10, 26, 47, .42), 0 10px 24px -14px rgba(10, 26, 47, .24);
  --oa-radius: 16px;

  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2147483000;
  font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
}
.oa[hidden] { display: none; }

/* ---- launcher ---- */
.oa-fab {
  appearance: none;
  border: 0;
  cursor: pointer;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--oa-brand);
  color: var(--oa-on-brand);
  box-shadow: var(--oa-shadow);
  display: grid;
  place-items: center;
  transition: transform .18s ease, background .18s ease;
  margin-left: auto;
}
.oa-fab:hover { background: var(--oa-brand-hover); transform: translateY(-2px); }
.oa-fab svg { width: 26px; height: 26px; }
.oa-fab .close-ic { display: none; }
.oa.open .oa-fab .open-ic { display: none; }
.oa.open .oa-fab .close-ic { display: block; }

/* ---- panel ---- */
.oa-panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: 384px;
  max-width: calc(100vw - 32px);
  display: flex;
  flex-direction: column;
  background: var(--oa-panel);
  border: 1px solid var(--oa-border);
  border-radius: var(--oa-radius);
  box-shadow: var(--oa-shadow);
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px) scale(.98);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.oa.open .oa-panel { opacity: 1; transform: none; pointer-events: auto; }

.oa-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 15px;
  background: linear-gradient(135deg, var(--oa-head), var(--oa-head-2));
  color: var(--oa-head-ink);
}
.oa-av {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: rgba(255, 255, 255, .09);
  display: grid; place-items: center;
}
.oa-av svg { width: 22px; height: 22px; }
.oa-id { flex: 1; min-width: 0; }
.oa-id b { display: block; font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; }
.oa-id span { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--oa-head-faint); }
.oa-id span i { width: 6px; height: 6px; border-radius: 50%; background: #45c07a; box-shadow: 0 0 0 3px rgba(69, 192, 122, .22); }
.oa-min {
  appearance: none; border: 0; cursor: pointer;
  width: 30px; height: 30px; border-radius: 8px;
  background: rgba(255, 255, 255, .08); color: var(--oa-head-ink);
  display: grid; place-items: center;
}
.oa-min:hover { background: rgba(255, 255, 255, .16); }
.oa-min svg { width: 15px; height: 15px; }

.oa-body {
  height: 360px;
  overflow-y: auto;
  padding: 16px 14px 6px;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--oa-panel);
  scroll-behavior: smooth;
}

.oa-msg { display: flex; gap: 8px; max-width: 88%; }
.oa-msg .oa-b { padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.oa-msg.bot { align-self: flex-start; }
.oa-msg.bot .oa-b { background: var(--oa-bot); color: var(--oa-bot-ink); border-bottom-left-radius: 5px; }
.oa-msg.user { align-self: flex-end; }
.oa-msg.user .oa-b { background: var(--oa-brand); color: var(--oa-on-brand); border-bottom-right-radius: 5px; }
.oa-avd { width: 25px; height: 25px; border-radius: 8px; flex: none; margin-top: 2px; background: var(--oa-brand-soft); color: var(--oa-brand); display: grid; place-items: center; }
.oa-avd svg { width: 16px; height: 16px; }

.oa-chips { display: flex; flex-wrap: wrap; gap: 8px; align-self: flex-start; }
.oa-chip {
  appearance: none; cursor: pointer;
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--oa-brand); background: var(--oa-panel);
  border: 1px solid color-mix(in srgb, var(--oa-brand) 30%, var(--oa-border));
  padding: 7px 12px; border-radius: 999px;
}
.oa-chip:hover { background: var(--oa-brand-soft); }

.oa-typing { align-self: flex-start; display: flex; gap: 8px; }
.oa-typing .oa-b { display: flex; gap: 4px; align-items: center; padding: 12px 14px; }
.oa-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--oa-faint); animation: oa-bob 1s infinite ease-in-out; }
.oa-typing i:nth-child(2) { animation-delay: .15s; }
.oa-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes oa-bob { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.oa-foot { border-top: 1px solid var(--oa-border-soft); padding: 11px 12px 12px; background: var(--oa-panel); }
.oa-composer {
  display: flex; align-items: flex-end; gap: 8px;
  border: 1px solid var(--oa-border); border-radius: 12px; padding: 7px 7px 7px 13px;
  background: var(--oa-panel-2);
}
.oa-composer:focus-within { border-color: var(--oa-brand); box-shadow: 0 0 0 3px rgba(11, 111, 164, .18); }
.oa-composer textarea {
  flex: 1; border: 0; background: transparent; resize: none; outline: none;
  font-family: inherit; font-size: 14px; color: var(--oa-ink); line-height: 1.45;
  max-height: 84px; padding: 4px 0;
}
.oa-composer textarea::placeholder { color: var(--oa-faint); }
.oa-send {
  width: 36px; height: 36px; border-radius: 9px; border: 0; flex: none; cursor: pointer;
  background: var(--oa-brand); color: var(--oa-on-brand); display: grid; place-items: center;
}
.oa-send:hover { background: var(--oa-brand-hover); }
.oa-send:disabled { opacity: .5; cursor: default; }
.oa-send svg { width: 16px; height: 16px; }
.oa-legal { text-align: center; font-size: 10.5px; color: var(--oa-faint); margin: 8px 2px 0; line-height: 1.4; }

@media (max-width: 460px) {
  .oa { right: 14px; bottom: 14px; }
  .oa-panel { width: calc(100vw - 28px); }
}
@media (prefers-reduced-motion: reduce) {
  .oa-fab, .oa-panel { transition: none; }
  .oa-typing i { animation: none; }
  .oa-body { scroll-behavior: auto; }
}

@media (prefers-color-scheme: dark) {
  .oa {
    --oa-brand: #49a7dc;
    --oa-brand-hover: #67b9e7;
    --oa-brand-soft: #112f47;
    --oa-on-brand: #04121d;
    --oa-panel: #0f1d30;
    --oa-panel-2: #132339;
    --oa-ink: #e8f1f8;
    --oa-muted: #9fb4c7;
    --oa-faint: #6f879e;
    --oa-border: #24405f;
    --oa-border-soft: #1b3047;
    --oa-bot: #16304d;
    --oa-bot-ink: #dceaf5;
  }
}
