/* Burbuja de chat de soporte (PRUEBA, solo tienda-staging -- pedido explicito
   del usuario 2026-09-14). Aislado en su propio archivo (no static/css/
   styles.css) para que este feature de prueba sea facil de quitar/revisar
   sin mezclarse con el resto de los estilos del sitio. */
.chat-widget-burbuja {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9500;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #e20f19;
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  cursor: pointer;
  transition: transform .18s ease;
}
.chat-widget-burbuja:hover { transform: scale(1.06); }
.chat-widget-burbuja svg { width: 26px; height: 26px; }
.chat-widget-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ffcc00;
  color: #1a1a1a;
  font-size: 11px;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid #fff;
}

.chat-widget-panel {
  position: fixed;
  right: 20px;
  bottom: 90px;
  z-index: 9500;
  width: 340px;
  max-width: calc(100vw - 32px);
  height: 480px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Inter', Arial, sans-serif;
}
.chat-widget-header {
  background: #e20f19;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
}
.chat-widget-header h4 { margin: 0; font-size: 14.5px; font-weight: 800; }
.chat-widget-header p { margin: 2px 0 0; font-size: 11.5px; opacity: .85; }
.chat-widget-cerrar { background: none; border: none; color: #fff; cursor: pointer; padding: 4px; opacity: .85; }
.chat-widget-cerrar:hover { opacity: 1; }
.chat-widget-mensajes {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f7f5f3;
}
.chat-widget-vacio { text-align: center; color: #667; font-size: 12.5px; padding: 24px 12px; }
.chat-widget-burbuja-msg {
  max-width: 78%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}
.chat-widget-burbuja-msg.cliente { align-self: flex-end; background: #e20f19; color: #fff; border-bottom-right-radius: 4px; }
.chat-widget-burbuja-msg.admin { align-self: flex-start; background: #fff; color: #222; border: 1px solid #e7e3df; border-bottom-left-radius: 4px; }
.chat-widget-burbuja-msg img { max-width: 100%; border-radius: 10px; display: block; margin-bottom: 5px; max-height: 220px; object-fit: contain; }
.chat-widget-escribiendo { margin: 0; padding: 0 14px 6px; font-size: 11.5px; color: #667; font-style: italic; }
.chat-widget-form {
  flex: 0 0 auto;
  border-top: 1px solid #eee;
  padding: 8px;
  display: flex;
  align-items: flex-end;
  gap: 6px;
}
.chat-widget-form textarea {
  flex: 1;
  resize: none;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 13px;
  font-family: inherit;
  max-height: 90px;
}
.chat-widget-form textarea:focus { outline: 2px solid #e20f19; outline-offset: 1px; }
.chat-widget-btn-icono {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 8px;
  display: flex;
}
.chat-widget-btn-icono:hover { color: #e20f19; }
.chat-widget-btn-enviar {
  flex: 0 0 auto;
  background: #e20f19;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.chat-widget-btn-enviar:disabled { opacity: .55; cursor: default; }
.chat-widget-preview {
  padding: 0 10px 6px;
  font-size: 11.5px;
  color: #667;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chat-widget-preview button { background: none; border: none; color: #e20f19; font-size: 15px; cursor: pointer; line-height: 1; }

@media (max-width: 460px) {
  .chat-widget-panel { right: 16px; left: 16px; width: auto; bottom: 84px; }
  .chat-widget-burbuja { right: 16px; bottom: 16px; }
}

/* Bug real (2026-09-14, reportado por el usuario): .chat-widget-panel,
   .chat-widget-badge y .chat-widget-preview ya traen su propio `display`
   (flex), que en la cascada le GANA al `display:none` implicito del
   atributo `hidden` (mismo origen "autor", asi que gana el que estilo
   normal se declare, sin importar el orden ni la especificidad exacta) --
   el panel quedaba SIEMPRE visible ignorando `hidden`, sin importar cuantas
   veces el JS lo marcara cerrado. Esta regla, mas especifica y al final del
   archivo, fuerza que `hidden` gane siempre. */
#chatWidgetRaiz [hidden] { display: none !important; }
