/* Custo dinámico · CUSTOWINE · v2.7.0 */

/* Poses apiladas que se funden entre sí */
.custo-caras, .custo-esc-caras { position: relative; display: block; overflow: hidden; }
.custo-cara { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.04); transition: opacity .6s ease, transform .9s ease; }
.custo-cara.activa { opacity: 1; transform: none; }

/* ---------- Burbuja ---------- */
.custo-burbuja { position: fixed !important; right: 20px; bottom: 20px; z-index: 2147483647 !important; isolation: isolate; transform: none !important; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.custo-boton { position: relative; width: 72px; height: 72px; border-radius: 50%; border: 3px solid #fff; padding: 0; background: #111; cursor: pointer; box-shadow: 0 6px 24px rgba(0,0,0,.3); overflow: hidden; display: block; margin-left: auto; transition: transform .2s ease; }
.custo-boton:hover { transform: scale(1.06); }
.custo-boton:focus-visible { outline: 3px solid #B8185A; outline-offset: 3px; }
.custo-boton .custo-caras { width: 100%; height: 100%; border-radius: 50%; }
.custo-boton::after { content: ""; position: absolute; top: 4px; right: 4px; width: 14px; height: 14px; border-radius: 50%; background: #25D366; border: 2px solid #fff; }

.custo-aviso { position: relative; background: #fff; color: #1F1416; padding: 10px 30px 10px 14px; border-radius: 14px 14px 4px 14px; box-shadow: 0 4px 18px rgba(0,0,0,.18); font-size: 14px; line-height: 1.4; margin: 0 6px 10px auto; width: max-content; max-width: 240px; min-height: 20px; animation: custo-entra .35s ease both; }
.custo-aviso[hidden] { display: none; }
.custo-aviso-texto { cursor: pointer; display: block; }
.custo-aviso-cerrar { position: absolute; top: 4px; right: 6px; background: none; border: 0; color: #8a7a7e; font-size: 18px; line-height: 1; cursor: pointer; padding: 2px; }
.custo-aviso.custo-escribiendo .custo-aviso-texto { font-size: 0; }
.custo-aviso.custo-escribiendo .custo-aviso-texto::before { content: "• • •"; font-size: 16px; letter-spacing: 2px; color: #B8185A; animation: custo-parpadeo 1s infinite; }

.custo-panel { position: absolute; right: 0; bottom: 88px; width: 400px; height: 680px; max-height: calc(100vh - 120px); background: #F6F0E7; border-radius: 18px; overflow: hidden; box-shadow: 0 12px 48px rgba(0,0,0,.3); display: flex; flex-direction: column; animation: custo-entra .3s ease both; }
.custo-panel[hidden] { display: none; }
.custo-cabecera { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: #111; color: #fff; border-bottom: 3px solid #B8185A; }
.custo-avatar-marco { width: 48px; height: 48px; border-radius: 50%; overflow: hidden; flex: none; background: #111; border: 2px solid #fff; }
.custo-avatar { width: 100%; height: 100%; object-fit: cover; display: block; }
.custo-avatar.custo-salta { animation: custo-salta .45s ease; }
.custo-cab-textos { flex: 1; display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; min-width: 0; }
.custo-marca { height: 26px; width: auto; display: block; }
.custo-estado { font-size: 13px; color: #e9dde0; }
[data-estado="pensando"] .custo-estado::after { content: "…"; display: inline-block; animation: custo-parpadeo 1s infinite; }
[data-estado="pensando"] .custo-avatar-marco { border-color: #B8185A; }
[data-estado="recomienda"] .custo-avatar-marco { border-color: #25D366; }
.custo-cerrar { background: none; border: 0; color: #fff; font-size: 30px; line-height: 1; cursor: pointer; padding: 0 4px; }
.custo-marco { flex: 1; }
.custo-marco iframe { width: 100%; height: 100%; border: 0; display: block; }
.custo-burbuja.abierta .custo-aviso { display: none; }
@media (max-width: 520px) {
	.custo-panel { position: fixed; inset: 0; width: auto; height: auto; max-height: none; border-radius: 0; }
	.custo-burbuja.abierta .custo-boton { display: none; }
}

/* ---------- Escaparate [custo_escaparate] ---------- */
.custo-escaparate { display: flex; align-items: center; gap: 28px; max-width: 760px; margin: 24px auto; padding: 24px 28px; background: #111; color: #fff; border-radius: 22px; box-shadow: 0 14px 44px rgba(0,0,0,.25); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; box-sizing: border-box; }
.custo-escaparate * { box-sizing: border-box; }
.custo-esc-caras { flex: none; width: 200px; height: 200px; border-radius: 18px; }
.custo-esc-cuerpo { flex: 1; min-width: 0; }
.custo-escaparate p { margin: 0; }
.custo-esc-titulo { font-size: 13px !important; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #E0528D; }
.custo-esc-texto { position: relative; margin: 12px 0 20px !important; padding: 14px 18px; min-height: 4.4em; background: #fff; color: #1F1416; border-radius: 16px 16px 16px 4px; font-size: 18px !important; line-height: 1.45; }
.custo-esc-texto::before { content: ""; position: absolute; left: -9px; bottom: 0; border: 10px solid transparent; border-right-color: #fff; border-left: 0; border-bottom: 0; }
.custo-esc-pie { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.custo-esc-boton { display: inline-block; padding: 12px 22px; border-radius: 999px; background: #B8185A; color: #fff !important; text-decoration: none !important; font-weight: 700; font-size: 15px; transition: background .2s ease, transform .2s ease; }
.custo-esc-boton:hover { background: #7A1033; transform: translateY(-1px); }
.custo-esc-boton:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.custo-esc-puntos { display: flex; gap: 8px; }
.custo-esc-puntos button { width: 10px; height: 10px; padding: 0; border-radius: 50%; border: 0; background: rgba(255,255,255,.3); cursor: pointer; transition: background .2s ease, transform .2s ease; }
.custo-esc-puntos button.activo { background: #E0528D; transform: scale(1.25); }
@media (max-width: 600px) {
	.custo-escaparate { flex-direction: column; text-align: center; gap: 16px; padding: 22px 18px; }
	.custo-esc-caras { width: 170px; height: 170px; }
	.custo-esc-texto { text-align: left; font-size: 16px !important; }
	.custo-esc-texto::before { display: none; }
	.custo-esc-pie { justify-content: center; flex-direction: column; }
}

/* ---------- Custo incrustado (versión PHP): centrado, 1/4 de la pantalla por defecto ---------- */
.custo-incrustado { --custo-ancho: 50vw; --custo-alto: 50vh; width: var(--custo-ancho); height: var(--custo-alto); min-width: 340px; min-height: 480px; max-width: 100%; margin: 24px auto; display: flex; flex-direction: column; background: #F6F0E7; border-radius: 18px; overflow: hidden; box-shadow: 0 12px 48px rgba(0,0,0,.22); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; box-sizing: border-box; }
.custo-incrustado * { box-sizing: border-box; }
.custo-incrustado .custo-cabecera { flex: none; padding: 10px 16px; gap: 14px; }
.custo-incrustado .custo-avatar-marco { width: 60px; height: 60px; }
.custo-incrustado .custo-estado { font-size: 14px; min-height: 1.3em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.custo-incrustado iframe { flex: 1; width: 100%; border: 0; display: block; min-height: 0; }
.custo-incrustado.custo-fijo { position: fixed; top: 50%; left: 50%; margin: 0; transform: translate(-50%, -50%); z-index: 2147483000; }
@media (max-width: 700px) {
	.custo-incrustado { width: 100%; height: 75vh; min-width: 0; border-radius: 14px; }
	.custo-incrustado.custo-fijo { width: calc(100% - 24px); }
}

@keyframes custo-entra { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes custo-salta { 0% { transform: scale(.7); } 60% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes custo-parpadeo { 50% { opacity: .3; } }

@media (prefers-reduced-motion: reduce) {
	.custo-cara, .custo-boton, .custo-esc-boton { transition: none; }
	.custo-aviso, .custo-panel, .custo-avatar.custo-salta { animation: none; }
}

/* 2.5: la app ya trae su cabecera (logo, Custo con sus poses y su estado): no se duplica.
   En escritorio se cierra con el botón de Custo, que sigue visible; en el móvil queda solo la «×». */
@media (min-width: 521px) { .custo-burbuja .custo-cabecera { display: none; } .custo-burbuja.abierta .custo-boton { border-color: #B41653; } }
@media (max-width: 520px) { .custo-burbuja .custo-cabecera { padding: 4px 10px; min-height: 0; justify-content: flex-end; border-bottom-width: 2px; } .custo-burbuja .custo-avatar-marco, .custo-burbuja .custo-cab-textos { display: none; } }
