/* =====================================================================
   Asistente IA StarHouse — MÓDULO IN-PAGE (solo PDP).
   Servido directo (NO pasa por PurgeCSS). Colores/tipos de la marca.
   ===================================================================== */
.sh-aim, .sh-aim-panel {
  --shc-gold: var(--primary, hsl(32, 36%, 52%));
  --shc-gold-dark: var(--gold-dark, hsl(28, 40%, 38%));
  --shc-gold-tint: hsl(38, 44%, 96%);
  --shc-gold-light: hsl(45, 45%, 88%);
  --shc-teal: hsl(158, 22%, 44%);
  --shc-teal-tint: hsl(158, 24%, 95%);
  --shc-wa: #25a55a;
  --shc-surface: #fff;
  --shc-surface-2: #f4efe7;
  --shc-text: #2a2622;
  --shc-muted: #6e6558;
  --shc-faint: #978d7c;
  --shc-border: #e7e0d3;
  --shc-border-2: #d8cfbe;
  --shc-shadow: 0 18px 50px -18px hsl(28 40% 20% / 0.34);
  --shc-shadow-sm: 0 6px 18px -8px hsl(28 40% 20% / 0.26);
  font-family: var(--font-sans, 'Montserrat', system-ui, sans-serif);
}

/* ---------- Módulo in-page (caja "pregúntame") ---------- */
/* El grid de compra trae margin-bottom:4rem (para el espacio antes de la nav);
   como ahora el módulo va justo ahí, se reduce para no dejar un hueco enorme.
   (ai-chat.css solo carga en PDP con módulo, así que no afecta otras vistas.) */
.single-product-container .product-main-grid { margin-bottom: 0.25rem !important; }
.sh-aim { margin: 0 0 18px; }
.sh-aim-inner { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
.sh-aim-box {
  background: var(--shc-gold-tint); border: 1.5px solid var(--shc-gold-light);
  border-radius: 16px; padding: 18px 20px; box-shadow: var(--shc-shadow-sm);
}
.sh-aim-top { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.sh-aim-av {
  width: 44px; height: 44px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--shc-gold), var(--shc-gold-dark)); box-shadow: var(--shc-shadow-sm);
}
.sh-aim-av svg { width: 24px; height: 24px; color: #fff; }
.sh-aim-h { font-family: var(--font-heading, 'Inter', sans-serif); font-weight: 700; font-size: 16.5px; margin: 0; line-height: 1.2; color: var(--shc-text); }
.sh-aim-s { font-size: 13px; color: var(--shc-muted); margin: 2px 0 0; }
.sh-aim-field { display: flex; gap: 10px; align-items: center; }
.sh-aim-input {
  flex: 1; min-width: 0; background: var(--shc-surface); border: 1.5px solid var(--shc-border-2);
  border-radius: 12px; padding: 13px 15px; font-size: 14px; color: var(--shc-text); font-family: inherit;
}
.sh-aim-input::placeholder { color: var(--shc-faint); }
.sh-aim-input:focus { outline: none; border-color: var(--shc-gold); box-shadow: 0 0 0 3px hsl(32 36% 52% / .14); }
.sh-aim-send { width: 46px; height: 46px; border-radius: 12px; flex: none; border: none; cursor: pointer; background: var(--shc-gold); display: grid; place-items: center; }
.sh-aim-send:hover { background: var(--shc-gold-dark); }
.sh-aim-send svg { width: 20px; height: 20px; color: #fff; }
.sh-aim-sugg { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 12px; }
.sh-aim-chip { font-size: 12.5px; font-weight: 600; padding: 7px 13px; border-radius: 999px; cursor: pointer; background: var(--shc-surface); border: 1px solid var(--shc-gold-light); color: var(--shc-gold-dark); }
.sh-aim-chip:hover { background: var(--shc-gold-light); }

/* ---------- Chat expandido inline (escritorio) ---------- */
.sh-aim-chat {
  background: var(--shc-surface); border: 1px solid var(--shc-border-2); border-radius: 18px;
  box-shadow: var(--shc-shadow); overflow: hidden; display: flex; flex-direction: column;
  max-height: min(680px, 78vh);
}
.sh-aim-chat .shc-body { max-height: min(520px, 62vh); }

/* ---------- Panel pantalla completa (móvil) ---------- */
.sh-aim-panel {
  position: fixed; inset: 0; z-index: 99999; background: var(--shc-surface);
  display: flex; flex-direction: column; transform: translateY(100%); transition: transform .22s ease;
}
.sh-aim-panel.is-open { transform: none; }
body.sh-aim-lock { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .sh-aim-panel { transition: none; } }

/* ---------- Cabecera del chat ---------- */
.shc-head { display: flex; align-items: center; gap: 11px; padding: 14px 16px; flex: none; background: linear-gradient(135deg, var(--shc-gold), var(--shc-gold-dark)); color: #fff; }
.shc-avatar { width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28); }
.shc-avatar svg { width: 22px; height: 22px; color: #fff; }
.shc-head-txt { flex: 1; min-width: 0; }
.shc-title { font-family: var(--font-heading, 'Inter', sans-serif); font-weight: 650; font-size: 15px; line-height: 1.2; }
.shc-sub { font-size: 11.5px; opacity: .9; display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.shc-live { width: 7px; height: 7px; border-radius: 50%; background: #86e5a8; }
.shc-close { background: rgba(255,255,255,.14); border: none; color: #fff; cursor: pointer; padding: 6px; border-radius: 8px; display: grid; place-items: center; }
.shc-close svg { width: 18px; height: 18px; display: block; }

.shc-body { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 12px; background: var(--shc-surface); }

/* ---------- Gate ---------- */
.shc-gate { display: flex; flex-direction: column; gap: 15px; }
.shc-gate-hero { background: var(--shc-gold-tint); border: 1px solid var(--shc-border); border-radius: 14px; padding: 18px; text-align: center; }
.shc-gate-badge { width: 52px; height: 52px; border-radius: 15px; margin: 0 auto 12px; display: grid; place-items: center; background: linear-gradient(135deg, var(--shc-gold), var(--shc-gold-dark)); box-shadow: var(--shc-shadow-sm); }
.shc-gate-badge svg { width: 27px; height: 27px; color: #fff; }
.shc-gate-h { font-family: var(--font-heading, 'Inter', sans-serif); font-weight: 700; font-size: 17px; margin: 0 0 6px; }
.shc-gate-p { color: var(--shc-muted); font-size: 13px; margin: 0; }
.shc-field label { font-size: 12px; font-weight: 600; color: var(--shc-muted); display: block; margin: 0 0 6px; }
.shc-field input { width: 100%; padding: 12px 13px; border-radius: 11px; font-size: 14px; font-family: inherit; border: 1.5px solid var(--shc-border-2); background: var(--shc-surface); color: var(--shc-text); }
.shc-field input:focus { outline: none; border-color: var(--shc-gold); box-shadow: 0 0 0 3px hsl(32 36% 52% / .14); }
.shc-consent { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--shc-muted); background: var(--shc-surface-2); border: 1px solid var(--shc-border); border-radius: 11px; padding: 11px 12px; cursor: pointer; }
.shc-consent input { position: absolute; opacity: 0; width: 0; height: 0; }
.shc-consent .shc-box { width: 19px; height: 19px; border-radius: 5px; flex: none; margin-top: 1px; border: 1.5px solid var(--shc-border-2); background: #fff; display: grid; place-items: center; }
.shc-consent .shc-box svg { width: 12px; height: 12px; color: #fff; opacity: 0; }
.shc-consent input:checked + .shc-box { background: var(--shc-gold); border-color: var(--shc-gold); }
.shc-consent input:checked + .shc-box svg { opacity: 1; }
.shc-consent a { color: var(--shc-gold-dark); font-weight: 600; }
.shc-err { color: #b3261e; font-size: 12.5px; margin: 0; display: none; }
.shc-err.shc-show { display: block; }
.shc-foot { font-size: 11px; color: var(--shc-faint); text-align: center; margin: 0; }

/* ---------- Botones ---------- */
.shc-btn { border: none; border-radius: 12px; font-family: var(--font-heading, 'Inter', sans-serif); font-weight: 650; font-size: 14.5px; padding: 13px 16px; cursor: pointer; width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.shc-btn:disabled { opacity: .6; cursor: default; }
.shc-btn-gold { background: var(--shc-gold); color: #fff; box-shadow: var(--shc-shadow-sm); text-decoration: none; }
.shc-btn-gold:hover:not(:disabled) { background: var(--shc-gold-dark); }
.shc-btn-wa { background: #f0f9f3; color: #1c8b4b; border: 1.5px solid #c5e8d2; text-decoration: none; font-weight: 600; font-size: 13.5px; padding: 11px 16px; }
.shc-btn-wa svg { color: var(--shc-wa); width: 17px; height: 17px; }
.shc-btn-wa:hover { background: #e6f5ec; border-color: var(--shc-wa); }

/* ---------- Mensajes ---------- */
.shc-msg { display: flex; gap: 8px; max-width: 92%; }
.shc-msg.bot { align-self: flex-start; }
.shc-msg.me { align-self: flex-end; flex-direction: row-reverse; }
.shc-mava { width: 26px; height: 26px; border-radius: 8px; flex: none; display: grid; place-items: center; background: var(--shc-gold); margin-top: 2px; }
.shc-mava svg { width: 15px; height: 15px; color: #fff; }
.shc-bubble { padding: 10px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.45; }
.shc-msg.bot .shc-bubble { background: var(--shc-surface-2); color: var(--shc-text); border-bottom-left-radius: 5px; }
.shc-msg.me .shc-bubble { background: var(--shc-gold); color: #fff; border-bottom-right-radius: 5px; }
.shc-bubble b { font-weight: 700; }
.shc-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.shc-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--shc-faint); animation: shc-bounce 1.2s infinite; }
.shc-typing span:nth-child(2) { animation-delay: .2s; }
.shc-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes shc-bounce { 0%,60%,100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .shc-typing span { animation: none; } }

/* ---------- Tarjeta de producto ---------- */
.shc-card { background: var(--shc-surface); border: 1px solid var(--shc-border-2); border-radius: 13px; overflow: hidden; box-shadow: var(--shc-shadow-sm); }
.shc-card-top { display: flex; gap: 11px; padding: 11px; }
.shc-card-photo { width: 66px; height: 66px; border-radius: 9px; flex: none; object-fit: cover; background: var(--shc-surface-2); }
.shc-card-info { flex: 1; min-width: 0; }
.shc-card-name { font-size: 13px; font-weight: 650; line-height: 1.3; margin: 0 0 4px; color: var(--shc-text); }
.shc-card-meta { font-size: 11.5px; color: var(--shc-faint); margin: 0 0 5px; }
.shc-card-price { font-family: var(--font-heading, 'Inter', sans-serif); font-weight: 700; font-size: 15px; color: var(--shc-text); }
.shc-card-price .shc-m2 { font-weight: 500; font-size: 11px; color: var(--shc-muted); }
.shc-card-stock { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; margin-top: 3px; white-space: nowrap; }
.shc-in { color: var(--shc-teal); }
.shc-out { color: #b3261e; }
.shc-card-actions { display: flex; gap: 7px; padding: 0 11px 11px; }
.shc-card-actions .shc-btn { padding: 9px 10px; font-size: 12.5px; border-radius: 9px; }
.shc-btn-ghost { background: var(--shc-surface); color: var(--shc-gold-dark); border: 1.5px solid var(--shc-border-2); width: auto; padding: 9px 12px; text-decoration: none; }
.shc-btn-ghost:hover { border-color: var(--shc-gold); }

/* ---------- Feedback ---------- */
.shc-fb { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--shc-faint); padding-left: 34px; }
.shc-fb-btn { width: 24px; height: 24px; border-radius: 7px; border: 1px solid var(--shc-border); background: var(--shc-surface); display: grid; place-items: center; cursor: pointer; }
.shc-fb-btn svg { width: 13px; height: 13px; color: var(--shc-muted); }
.shc-fb-btn.up:hover, .shc-fb-btn.up.on { border-color: var(--shc-teal); background: var(--shc-teal-tint); }
.shc-fb-btn.down:hover, .shc-fb-btn.down.on { border-color: #d99; background: #fbeeee; }

/* ---------- Bloque de carrito ---------- */
.shc-cartnote { background: var(--shc-teal-tint); border: 1px solid var(--shc-teal); border-radius: 13px; padding: 13px; display: flex; gap: 11px; align-items: flex-start; }
.shc-cartnote-ic { width: 30px; height: 30px; border-radius: 9px; background: var(--shc-teal); display: grid; place-items: center; flex: none; }
.shc-cartnote-ic svg { width: 17px; height: 17px; color: #fff; }
.shc-cartnote-t { font-size: 13px; color: var(--shc-text); }
.shc-cartnote-t b { font-family: var(--font-heading, 'Inter', sans-serif); }
.shc-cartnote-sub { font-size: 12px; color: var(--shc-muted); }

/* ---------- Bloque de cálculo ---------- */
.shc-calc { background: var(--shc-surface); border: 1px solid var(--shc-border-2); border-radius: 13px; box-shadow: var(--shc-shadow-sm); overflow: hidden; }
.shc-calc-head { display: flex; align-items: center; gap: 8px; padding: 11px 13px; font-family: var(--font-heading, 'Inter', sans-serif); font-weight: 650; font-size: 13.5px; color: var(--shc-gold-dark); background: var(--shc-gold-tint); border-bottom: 1px solid var(--shc-border); }
.shc-calc-head svg { width: 17px; height: 17px; }
.shc-calc-rows { padding: 6px 13px 10px; }
.shc-calc-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; font-size: 13px; border-bottom: 1px dashed var(--shc-border); }
.shc-calc-row:last-child { border-bottom: none; }
.shc-calc-row > span { color: var(--shc-muted); }
.shc-calc-row > b { font-family: var(--font-heading, 'Inter', sans-serif); color: var(--shc-text); text-align: right; }
.shc-calc-row em { font-style: normal; font-weight: 400; font-size: 11px; color: var(--shc-faint); }
.shc-calc-total > b { color: var(--shc-gold-dark); font-size: 15px; }
.shc-calc .shc-btn { border-radius: 0; }

.shc-wa-sub { font-size: 11px; color: var(--shc-faint); text-align: center; margin: 3px 0 2px; }

/* ---------- Entrada ---------- */
.shc-input { border-top: 1px solid var(--shc-border); padding: 11px 13px; display: flex; gap: 9px; align-items: center; flex: none; background: var(--shc-surface); }
.shc-input textarea { flex: 1; background: var(--shc-surface-2); border: 1px solid var(--shc-border); border-radius: 20px; padding: 10px 15px; font-size: 13.5px; color: var(--shc-text); font-family: inherit; resize: none; max-height: 90px; line-height: 1.4; }
.shc-input textarea:focus { outline: none; border-color: var(--shc-gold); }
.shc-send { width: 40px; height: 40px; border-radius: 50%; background: var(--shc-gold); border: none; display: grid; place-items: center; flex: none; cursor: pointer; }
.shc-send:disabled { opacity: .5; }
.shc-send svg { width: 18px; height: 18px; color: #fff; }

/* ---------- Chips rápidos ---------- */
.shc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.shc-chip { font-size: 12px; font-weight: 600; padding: 7px 11px; border-radius: 999px; cursor: pointer; background: var(--shc-gold-tint); border: 1px solid var(--shc-gold-light); color: var(--shc-gold-dark); }
.shc-chip:hover { background: var(--shc-gold-light); }
