/* LVL human shopping assistant widget */
.lvl-sa-root {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 99990;
  font-family: Inter, system-ui, sans-serif;
}
.lvl-sa-fab {
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.15rem;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.45);
}
.lvl-sa-fab:hover { filter: brightness(1.06); }
.lvl-sa-fab-pulse {
  animation: lvl-sa-pulse 1.1s ease-in-out 3;
}
@keyframes lvl-sa-pulse {
  0%, 100% { box-shadow: 0 8px 28px rgba(99, 102, 241, 0.45); transform: scale(1); }
  50% { box-shadow: 0 10px 36px rgba(139, 92, 246, 0.7); transform: scale(1.04); }
}
@media (prefers-reduced-motion: reduce) {
  .lvl-sa-fab-pulse { animation: none; }
}
/* Full panel must not cover primary commerce grid on small screens when open */
@media (max-width: 720px) {
  .lvl-sa-panel:not(.is-minimized) {
    width: calc(100vw - 16px);
    height: min(52vh, 420px);
    right: 0;
    bottom: 0;
  }
  .lvl-sa-root {
    right: 8px;
    bottom: 8px;
  }
}
.lvl-sa-panel {
  width: min(400px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  background: #0b1220;
  color: #e8eefc;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  transition: width 0.2s ease, height 0.2s ease, border-radius 0.2s ease;
}
/* Minimized: compact dock bar — conversation kept, body/form hidden */
.lvl-sa-panel.is-minimized {
  width: min(280px, calc(100vw - 24px));
  height: auto;
  max-height: none;
  border-radius: 999px;
  box-shadow: 0 10px 32px rgba(99, 102, 241, 0.35);
  border-color: rgba(129, 140, 248, 0.4);
}
.lvl-sa-panel.is-minimized .lvl-sa-msgs,
.lvl-sa-panel.is-minimized .lvl-sa-form {
  display: none !important;
}
.lvl-sa-panel.is-minimized .lvl-sa-header {
  border-bottom: none;
  padding: 0.55rem 0.65rem 0.55rem 0.9rem;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(139, 92, 246, 0.28));
}
.lvl-sa-panel.is-minimized .lvl-sa-sub {
  display: none;
}
.lvl-sa-panel.is-minimized .lvl-sa-min-hint {
  display: inline;
  font-size: 11px;
  color: #c7d2fe;
  font-weight: 600;
  margin-left: 0.35rem;
  white-space: nowrap;
}
.lvl-sa-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.85rem 0.75rem 0.85rem 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  background: rgba(15, 23, 42, 0.95);
}
.lvl-sa-header-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.35rem;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: default;
  font: inherit;
}
.lvl-sa-panel.is-minimized .lvl-sa-header-main {
  cursor: pointer;
}
.lvl-sa-header strong { font-size: 0.98rem; }
.lvl-sa-sub { font-size: 12px; color: #94a3b8; margin-top: 2px; }
.lvl-sa-min-hint { display: none; }
.lvl-sa-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.lvl-sa-min,
.lvl-sa-x {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.lvl-sa-min:hover,
.lvl-sa-x:hover {
  color: #e2e8f0;
  background: rgba(148, 163, 184, 0.12);
}
.lvl-sa-min:focus-visible,
.lvl-sa-x:focus-visible {
  outline: 2px solid #818cf8;
  outline-offset: 1px;
}
.lvl-sa-min {
  font-size: 22px;
  font-weight: 600;
  padding-bottom: 2px;
}
.lvl-sa-panel.is-minimized .lvl-sa-min {
  font-size: 14px;
  padding-bottom: 0;
}
.lvl-sa-msgs {
  flex: 1;
  overflow: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lvl-sa-bubble-user {
  align-self: flex-end;
  background: rgba(99, 102, 241, 0.35);
  padding: 0.55rem 0.75rem;
  border-radius: 12px 12px 4px 12px;
  max-width: 92%;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.lvl-sa-bubble-bot {
  align-self: flex-start;
  background: rgba(30, 41, 59, 0.9);
  padding: 0.55rem 0.75rem;
  border-radius: 12px 12px 12px 4px;
  max-width: 95%;
  font-size: 13.5px;
  line-height: 1.5;
  border: 1px solid rgba(148, 163, 184, 0.12);
  white-space: pre-wrap;
}
.lvl-sa-proactive {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #a5b4fc;
  margin-bottom: 4px;
  text-transform: uppercase;
}
.lvl-sa-cards { display: flex; flex-direction: column; gap: 8px; }
.lvl-sa-card {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(74, 222, 128, 0.25);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  font-size: 13px;
}
.lvl-sa-card strong { display: block; }
.lvl-sa-price { color: #86efac; font-size: 12px; margin-top: 2px; }
.lvl-sa-sum { color: #cbd5e1; margin: 0.35rem 0; line-height: 1.4; }
.lvl-sa-trade { color: #94a3b8; margin: 0; font-size: 12px; }
.lvl-sa-card a { color: #93c5fd; font-size: 12px; }
.lvl-sa-form {
  display: flex;
  gap: 6px;
  padding: 0.65rem;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
}
.lvl-sa-form input {
  flex: 1;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: #020617;
  color: #f1f5f9;
  padding: 0.55rem 0.65rem;
  font-size: 14px;
}
.lvl-sa-form button {
  border: none;
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  background: #6366f1;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.lvl-sa-form button:disabled { opacity: 0.5; cursor: default; }
@media (max-width: 480px) {
  .lvl-sa-root { right: 10px; bottom: 10px; }
  .lvl-sa-panel { height: min(70vh, 520px); }
}
