/* ═══════════════════════════════════════════════════
   ARTPRINT chat widget — scoped styles
   ═══════════════════════════════════════════════════ */

.artprint-chat-root,
.artprint-chat-root *,
.artprint-chat-root *::before,
.artprint-chat-root *::after {
  box-sizing: border-box;
}

.artprint-chat-root {
  --apc-navy: #1A2A6C;
  --apc-electric: #2D4FE0;
  --apc-paper: #F4F1EA;
  --apc-ink: #0E1428;
  --apc-ink-soft: #2A2F44;
  --apc-mute: #6B7185;
  --apc-wa: #25D366;
  --apc-wa-2: #1FB358;
  --apc-bubble-user: #1A2A6C;
  --apc-bubble-bot: #FFFFFF;
  --apc-radius: 14px;
  --apc-shadow: 0 12px 40px rgba(14, 20, 40, 0.18), 0 2px 6px rgba(14, 20, 40, 0.08);
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2147483000;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
  font-size: 14px;
  color: var(--apc-ink);
}

.artprint-chat-root > * {
  pointer-events: auto;
}

/* — Floating launcher (single FAB + pills) — */
.artprint-chat-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.artprint-chat-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--apc-electric);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--apc-shadow);
  opacity: 0;
  transform: translateY(8px) scale(.96);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  text-decoration: none;
  white-space: nowrap;
}

.artprint-chat-pill--wa {
  background: var(--apc-wa);
}

.artprint-chat-pill:hover {
  filter: brightness(1.05);
}

.artprint-chat-pill .artprint-chat-pill-ic {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.artprint-chat-launcher[data-open="true"] .artprint-chat-pill {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.artprint-chat-launcher[data-open="true"] .artprint-chat-pill--wa {
  transition-delay: .04s;
}

.artprint-chat-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 0;
  background: var(--apc-navy);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--apc-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .18s ease, background .18s ease;
}

.artprint-chat-fab:hover {
  background: var(--apc-electric);
}

.artprint-chat-launcher[data-open="true"] .artprint-chat-fab {
  transform: rotate(45deg);
  background: var(--apc-ink);
}

.artprint-chat-fab svg {
  width: 24px;
  height: 24px;
}

/* — Chat panel — */
.artprint-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 360px;
  height: min(560px, calc(100vh - 40px));
  background: var(--apc-paper);
  border-radius: var(--apc-radius);
  box-shadow: var(--apc-shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(14, 20, 40, .08);
}

.artprint-chat-panel[data-open="true"] {
  display: flex;
}

.artprint-chat-header {
  background: var(--apc-navy);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.artprint-chat-header h3 {
  margin: 0;
  font-family: 'Archivo Black', 'Inter', sans-serif;
  font-size: 15px;
  letter-spacing: -.01em;
  text-transform: uppercase;
  font-weight: 900;
  flex: 1;
}

.artprint-chat-header p {
  margin: 2px 0 0;
  font-size: 11px;
  letter-spacing: .04em;
  color: rgba(255, 255, 255, .7);
  font-weight: 400;
  text-transform: none;
}

.artprint-chat-header-meta {
  flex: 1;
  min-width: 0;
}

.artprint-chat-close {
  width: 30px;
  height: 30px;
  border: 0;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}

.artprint-chat-close:hover {
  background: rgba(255, 255, 255, .22);
}

.artprint-chat-disclosure {
  padding: 8px 16px;
  background: rgba(45, 79, 224, .06);
  border-bottom: 1px solid rgba(14, 20, 40, .06);
  font-size: 11px;
  color: var(--apc-mute);
  text-align: center;
  flex-shrink: 0;
}

.artprint-chat-disclosure a {
  color: var(--apc-electric);
  text-decoration: underline;
}

.artprint-chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.artprint-chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.45;
  word-wrap: break-word;
  white-space: pre-wrap;
  font-size: 14px;
}

.artprint-chat-msg--user {
  align-self: flex-end;
  background: var(--apc-bubble-user);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.artprint-chat-msg--bot {
  align-self: flex-start;
  background: var(--apc-bubble-bot);
  color: var(--apc-ink);
  border: 1px solid rgba(14, 20, 40, .08);
  border-bottom-left-radius: 4px;
}

.artprint-chat-msg--bot.artprint-chat-msg--typing::after {
  content: '▍';
  display: inline-block;
  animation: artprint-chat-blink 1s infinite;
  margin-left: 2px;
  color: var(--apc-mute);
}

@keyframes artprint-chat-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.artprint-chat-action {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  font-size: 13px;
  border: 0;
  cursor: pointer;
  margin-top: -2px;
}

.artprint-chat-action--quote {
  background: var(--apc-electric);
  color: #fff;
}

.artprint-chat-action--wa {
  background: var(--apc-wa);
  color: #fff;
}

.artprint-chat-action:hover {
  filter: brightness(1.05);
}

/* — Input — */
.artprint-chat-form {
  border-top: 1px solid rgba(14, 20, 40, .08);
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  background: #fff;
  flex-shrink: 0;
}

.artprint-chat-input {
  flex: 1;
  resize: none;
  border: 1px solid rgba(14, 20, 40, .12);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--apc-ink);
  background: var(--apc-paper);
  max-height: 96px;
  min-height: 40px;
  line-height: 1.4;
}

.artprint-chat-input:focus {
  outline: none;
  border-color: var(--apc-electric);
}

.artprint-chat-send {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 0;
  border-radius: 10px;
  background: var(--apc-electric);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: flex-end;
}

.artprint-chat-send:disabled {
  background: var(--apc-mute);
  cursor: not-allowed;
}

.artprint-chat-send svg {
  width: 18px;
  height: 18px;
}

/* — Mobile: full-screen drawer — */
@media (max-width: 640px) {
  .artprint-chat-panel {
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: 0;
  }
}

/* — Reduced motion — */
@media (prefers-reduced-motion: reduce) {
  .artprint-chat-pill,
  .artprint-chat-fab {
    transition: none;
  }
}
