/* ========================================================================== 
   configurable chat widget — v3
   --------------------------------------------------------------------------
   - Componente independiente del CSS del sitio anfitrión.
   - Todas las clases usan prefijo `acw-`.
   - Responsive desde el inicio.
   - V3 incorpora galería rotatoria de producto.
   ========================================================================== */
.acw-root,
.acw-root * { box-sizing: border-box; }

.acw-root {
  --acw-primary: #11100f;
  --acw-accent: #d2aa63;
  --acw-bg: #fffaf3;
  --acw-surface: #fff;
  --acw-text: #211c18;
  --acw-muted: #6b6058;
  --acw-shadow: 0 24px 80px rgba(17,16,15,.22);
  position: fixed;
  z-index: 109;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--acw-text);
  line-height: 1.4;
}

.acw-launcher {
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  border: 1px solid rgba(210,170,99,.52);
  border-radius: 999px;
  padding: 8px 17px 8px 8px;
  background: var(--acw-primary);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 14px 42px rgba(0,0,0,.24);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.acw-launcher:hover,
.acw-launcher:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 18px 50px rgba(0,0,0,.30);
  border-color: var(--acw-accent);
  outline: 2px solid rgba(210,170,99,.34);
  outline-offset: 3px;
}
.acw-launcher__icon {
  width: 40px;
  height: 40px;
  display: block;
  object-fit: contain;
  border-radius: 50%;
  background: #0d0c0b;
  padding: 5px;
  user-select: none;
  -webkit-user-drag: none;
}
.acw-launcher__label { font-size: 12px; letter-spacing: .05em; white-space: nowrap; }

.acw-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 14px);
  width: min(390px, calc(100vw - 32px));
  max-height: min(640px, calc(100dvh - 104px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(17,16,15,.09);
  border-radius: 20px;
  background: var(--acw-bg);
  box-shadow: var(--acw-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(.982);
  transform-origin: bottom right;
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}
.acw-root.is-open .acw-panel { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

.acw-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 13px;
  align-items: center;
  min-height: 76px;
  padding: 14px 15px;
  background: var(--acw-primary);
  color: #fff;
}
.acw-header__logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
  border-radius: 50%;
  padding: 6px;
  background: #090909;
  user-select: none;
  -webkit-user-drag: none;
}
.acw-header__brand { min-width: 0; }
.acw-header__title {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: Didot, "Bodoni 72", Georgia, serif;
  font-size: 18px;
  font-weight: 400;
}
.acw-header__status {
  margin: 3px 0 0;
  color: rgba(255,255,255,.58);
  font-size: 9px;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.acw-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}
.acw-close:hover,
.acw-close:focus-visible { background: rgba(255,255,255,.08); outline: 1px solid rgba(255,255,255,.34); }

.acw-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(120,96,72,.35) transparent;
}
.acw-welcome { padding: 2px 2px 18px; text-align: center; }
.acw-welcome__mark {
  width: 72px;
  height: 58px;
  display: block;
  margin: 0 auto 10px;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
.acw-welcome h2 {
  margin: 0;
  font-family: Didot, "Bodoni 72", Georgia, serif;
  font-size: 30px;
  line-height: 1.04;
  font-weight: 400;
  letter-spacing: -.02em;
  text-transform: none;
}
.acw-welcome p {
  max-width: 290px;
  margin: 10px auto 0;
  color: var(--acw-muted);
  font-family: Georgia, serif;
  font-size: 15px;
  line-height: 1.5;
}

.acw-menu,
.acw-actions { display: grid; gap: 9px; }
.acw-choice,
.acw-action {
  width: 100%;
  min-height: 47px;
  border: 1px solid rgba(17,16,15,.12);
  border-radius: 11px;
  padding: 12px 14px;
  background: var(--acw-surface);
  color: var(--acw-text);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color .18s ease, transform .18s ease, background .18s ease;
}
.acw-choice:hover,
.acw-choice:focus-visible,
.acw-action:hover,
.acw-action:focus-visible {
  border-color: var(--acw-accent);
  background: #fffdf9;
  transform: translateY(-1px);
  outline: none;
}
.acw-choice::after,
.acw-action::after { content: "→"; float: right; margin-left: 12px; color: #9e7545; }
.acw-menu--submenu { margin-top: 13px; }

.acw-conversation { display: grid; gap: 10px; }
.acw-message {
  max-width: 92%;
  padding: 12px 14px;
  border-radius: 14px;
  font-family: Georgia, serif;
  font-size: 14px;
  line-height: 1.5;
}
.acw-message--assistant { justify-self: start; background: #f0e5d8; color: #3d342e; border-bottom-left-radius: 4px; }
.acw-message--user { justify-self: end; background: var(--acw-primary); color: #fff; border-bottom-right-radius: 4px; }
.acw-actions { margin-top: 3px; }
.acw-action { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 12px; }

.acw-product {
  display: grid;
  gap: 12px;
  margin-top: 4px;
  padding: 12px;
  border: 1px solid rgba(17,16,15,.10);
  border-radius: 16px;
  background: #fff;
}
.acw-product__gallery {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 12px;
  background: #f5efe8;
}
.acw-product__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .28s ease;
}
.acw-product__image.is-active { opacity: 1; }
.acw-product__dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: -2px;
}
.acw-product__dot {
  width: 8px;
  height: 8px;
  border: 0;
  border-radius: 50%;
  background: rgba(17,16,15,.18);
  cursor: pointer;
  padding: 0;
}
.acw-product__dot.is-active { background: var(--acw-accent); }
.acw-product__info { display: grid; gap: 6px; }
.acw-product__name {
  margin: 0;
  font-family: Didot, "Bodoni 72", Georgia, serif;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.06;
  text-transform: none;
}
.acw-product__desc {
  margin: 0;
  color: var(--acw-muted);
  font-family: Georgia, serif;
  font-size: 14px;
  line-height: 1.55;
}

.acw-navrow {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 16px;
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid rgba(17,16,15,.08);
}
.acw-reset {
  border: 0;
  padding: 4px 0;
  background: transparent;
  color: #82623f;
  font: inherit;
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.acw-reset:hover,
.acw-reset:focus-visible { color: #4f3924; outline: none; }

@media (max-width: 560px) {
  .acw-root {
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
  }
  .acw-panel {
    left: 0;
    right: 0;
    width: 100%;
    max-height: min(74dvh, 640px);
    border-radius: 17px;
  }
  .acw-launcher { margin-left: auto; display: flex; width: fit-content; }
  .acw-launcher__label { display: none; }
  .acw-launcher { padding: 7px; min-height: 54px; }
  .acw-launcher__icon { width: 40px; height: 40px; }
  .acw-header { min-height: 70px; }
  .acw-welcome h2 { font-size: 28px; }
  .acw-body { padding: 17px; }
  .acw-product__name { font-size: 20px; }
}

@media (max-height: 620px) and (min-width: 561px) {
  .acw-panel { max-height: calc(100dvh - 84px); }
}

@media (prefers-reduced-motion: reduce) {
  .acw-panel,
  .acw-launcher,
  .acw-choice,
  .acw-action,
  .acw-product__image { transition: none !important; }
}

/* V10 integración: el widget no se imprime junto al contenido editorial. */
@media print {
  .acw-root { display: none !important; }
}
