/* WSC Store Assistant — colours, fonts and radii come from the client theme (--wsc-* tokens, then theme.json presets). */
.wsc-a {
  --wa-accent: var(--wsc-color-accent, var(--wp--preset--color--accent, #1f2937));
  --wa-on-accent: var(--wsc-color-on-accent, #fff);
  --wa-bg: var(--wsc-color-bg, var(--wp--preset--color--base, #fff));
  --wa-card: var(--wsc-color-card, #f4f4f5);
  --wa-text: var(--wsc-color-text, var(--wp--preset--color--contrast, #111));
  --wa-muted: var(--wsc-color-muted, #5f6368);
  --wa-line: var(--wsc-color-line, rgba(0, 0, 0, .14));
  --wa-field: var(--wsc-color-field, var(--wa-bg));
  --wa-font: var(--wsc-font-body, inherit);
  --wa-font-h: var(--wsc-font-heading, var(--wa-font));
  --wa-radius: var(--wsc-radius-small, 16px);
  --wa-radius-btn: var(--wsc-radius-button, 999px);
  --wa-shadow: var(--wsc-shadow, 0 12px 40px -12px rgba(0, 0, 0, .3));
  position: fixed;
  right: 16px;
  bottom: var(--wsc-a-bottom, 16px);
  z-index: 99990;
  font-family: var(--wa-font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--wa-text);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}
.wsc-a *, .wsc-a *::before, .wsc-a *::after { box-sizing: border-box; }
.wsc-a button, .wsc-a input, .wsc-a textarea { font: inherit; color: inherit; margin: 0; }
/* the accent buttons keep their light text: the reset above (0,1,1) would otherwise beat their own rules (0,1,0) */
.wsc-a .wsc-a-launcher, .wsc-a .wsc-a-primary { color: var(--wa-on-accent); }
.wsc-a :focus-visible { outline: 3px solid var(--wa-accent); outline-offset: 2px; }

.wsc-a-launcher {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 52px; padding: 0 20px 0 16px;
  border: 0; border-radius: var(--wa-radius-btn);
  background: var(--wa-accent); color: var(--wa-on-accent);
  box-shadow: var(--wa-shadow); cursor: pointer; font-weight: 600; position: relative;
}
.wsc-a-icon {
  width: 22px; height: 22px; flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H9l-5 4v-4H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H9l-5 4v-4H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.wsc-a-dot { position: absolute; top: 6px; right: 8px; width: 10px; height: 10px; border-radius: 50%; background: #d93025; border: 2px solid var(--wa-on-accent); }
.wsc-a-dot[hidden] { display: none; }
.wsc-a.is-open .wsc-a-launcher-text { display: none; }
.wsc-a.is-open .wsc-a-launcher { padding: 0 15px; }

.wsc-a-panel {
  width: min(380px, calc(100vw - 32px));
  height: min(600px, calc(100vh - var(--wsc-a-bottom, 16px) - 88px));
  display: flex; flex-direction: column;
  background: var(--wa-bg); border: 1px solid var(--wa-line); border-radius: var(--wa-radius);
  box-shadow: var(--wa-shadow); overflow: hidden;
}
.wsc-a-panel[hidden] { display: none; }
.wsc-a-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 14px 12px 12px 18px; background: var(--wa-accent); color: var(--wa-on-accent); }
.wsc-a-title { margin: 0; font-family: var(--wa-font-h); font-size: 17px; line-height: 1.25; color: inherit; }
.wsc-a-sub { margin: 2px 0 0; font-size: 13px; opacity: .9; }
.wsc-a .wsc-a-close { width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 26px; line-height: 1; cursor: pointer; }
.wsc-a-close:hover { background: rgba(255, 255, 255, .16); }

.wsc-a-log { flex: 1; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.wsc-a-msg { max-width: 88%; padding: 9px 13px; border-radius: var(--wa-radius); word-wrap: break-word; }
.wsc-a-bot, .wsc-a-operator { align-self: flex-start; background: var(--wa-card); border-bottom-left-radius: 6px; }
.wsc-a-operator { border: 1px solid var(--wa-accent); }
.wsc-a-user { align-self: flex-end; background: var(--wa-accent); color: var(--wa-on-accent); border-bottom-right-radius: 6px; }
.wsc-a-user a { color: inherit; }
.wsc-a-notice { align-self: center; max-width: 100%; margin: 0; padding: 2px 6px; font-size: 12.5px; color: var(--wa-muted); text-align: center; background: none; }
.wsc-a-who { display: block; font-size: 12px; font-weight: 700; color: var(--wa-muted); margin-bottom: 2px; }
.wsc-a-text p { margin: 0; }
.wsc-a-msg a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

.wsc-a-card { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 6px; min-height: 44px; border-radius: calc(var(--wa-radius) * .6); background: var(--wa-bg); border: 1px solid var(--wa-line); text-decoration: none !important; }
.wsc-a-card img { width: 56px; height: 56px; object-fit: cover; border-radius: calc(var(--wa-radius) * .45); flex: none; }
.wsc-a-card-body { display: flex; flex-direction: column; min-width: 0; }
.wsc-a-card-name { font-weight: 600; }
.wsc-a-card-price { font-size: 13.5px; color: var(--wa-muted); }

.wsc-a-quick { display: flex; flex-wrap: nowrap; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--wa-line); overflow-x: auto; scrollbar-width: thin; }
.wsc-a-quick .wsc-a-chip { flex: none; white-space: nowrap; }
.wsc-a-chip {
  display: inline-flex; align-items: center; min-height: 44px; padding: 6px 14px; margin: 6px 6px 0 0;
  border: 1px solid var(--wa-line); border-radius: var(--wa-radius-btn); background: var(--wa-bg); cursor: pointer; font-size: 14px; text-align: left;
}
.wsc-a-quick .wsc-a-chip { margin: 0; }
.wsc-a-chip:hover { border-color: var(--wa-accent); }
.wsc-a-primary { background: var(--wa-accent); color: var(--wa-on-accent); border-color: var(--wa-accent); }

.wsc-a-form { display: flex; flex-direction: column; gap: 6px; width: 88%; }
.wsc-a-form label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--wa-muted); }
.wsc-a-form input, .wsc-a-form textarea { min-height: 44px; padding: 9px 12px; border: 1px solid var(--wa-line); border-radius: calc(var(--wa-radius) * .5); background: var(--wa-field); color: var(--wa-text); font-size: 16px; }

.wsc-a-compose { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--wa-line); }
.wsc-a .wsc-a-input { flex: 1; min-height: 44px; height: 44px; max-height: 120px; width: auto; box-shadow: none; outline-offset: 0; padding: 10px 14px; resize: none; border: 1px solid var(--wa-line); border-radius: 22px; background: var(--wa-field); font-size: 16px; line-height: 1.4; }
.wsc-a .wsc-a-send { width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; background: var(--wa-accent); color: var(--wa-on-accent); font-size: 20px; font-weight: 700; cursor: pointer; }
.wsc-a-send:disabled { opacity: .5; cursor: default; }

.wsc-a-typing { display: inline-flex; gap: 4px; padding: 13px 14px; }
.wsc-a-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--wa-muted); animation: wsc-a-blink 1.2s infinite ease-in-out both; }
.wsc-a-typing span:nth-child(2) { animation-delay: .15s; }
.wsc-a-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes wsc-a-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .wsc-a-typing span { animation: none; opacity: .6; } }

@media (max-width: 520px) {
  .wsc-a { right: 12px; }
  .wsc-a-launcher-text { display: none; }
  .wsc-a-launcher { width: 52px; padding: 0; justify-content: center; }
  .wsc-a.is-open { left: 0; right: 0; bottom: 0; align-items: stretch; gap: 0; }
  .wsc-a.is-open .wsc-a-launcher { display: none; }
  .wsc-a-panel { width: 100%; height: min(88vh, 100dvh - 40px); border-radius: var(--wa-radius) var(--wa-radius) 0 0; border-bottom: 0; }
}
@media print { .wsc-a { display: none; } }
