/* ==========================================================================
   Demo viva "ia-product" (hero de /inteligencia-artificial): "Crear con Ana LL"
   llena el formulario de Nuevo Producto a partir de una frase.
   Markup: resources/views/web/partials/anim/ia-product.blade.php
   Estados en la raíz:
     data-box     caja de IA abierta · data-focus prompt
     data-busy    "Ana está escribiendo…" · data-note aviso con campos sugeridos
     data-filled  campos sugeridos resaltados (.ll-ai-filled)
     data-tagging "Pensando…" · data-tags etiquetas sugeridas · data-cursor
   El panel no tiene modo oscuro: solo halo y sombra.
   ========================================================================== */

.lla-iap {
  --lla-bg: #ffffff;
  --lla-surface: #f8f9fa;
  --lla-text: #1e2022;
  --lla-muted: #677788;
  --lla-border: #e7eaf3;
  --lla-border-2: #d0d7e2;
  --lla-primary: #377dff;
  --lla-primary-rgb: 55, 125, 255;
  --lla-ana: #6d28d9;
  --lla-shadow: 0 32px 64px -24px rgba(22, 34, 58, .38), 0 10px 24px -10px rgba(22, 34, 58, .18);
  --lla-glow-a: rgba(109, 40, 217, .16);
  --lla-glow-b: rgba(55, 125, 255, .14);
  --lla-cursor-fill: #1e2022;
  --lla-cursor-edge: #ffffff;
  --lla-cursor-ring: rgba(55, 125, 255, .55);
  max-width: 640px;
  margin-inline: auto;
  color: var(--lla-text);
  line-height: 1.3;
  text-align: left;
}
html[data-theme="dark"] .lla-iap {
  --lla-glow-a: rgba(167, 139, 250, .16);
  --lla-glow-b: rgba(77, 159, 255, .12);
  --lla-shadow: 0 32px 64px -24px rgba(0, 0, 0, .8), 0 10px 24px -10px rgba(0, 0, 0, .55);
}

.lla .lla-iap__stage { --lla-w: 640; --lla-h: 480; }
.lla-iap :where(b, small, strong, em, i, p) { margin: 0; font-size: inherit; font-style: normal; color: inherit; }
.lla-iap .bi::before { vertical-align: 0; }

.lla-iap__glow { position: absolute; border-radius: 50%; pointer-events: none; }
.lla-iap__glow--a { left: -40px; top: -20px; width: 420px; height: 420px; background: radial-gradient(closest-side, var(--lla-glow-a), transparent); }
.lla-iap__glow--b { left: 280px; top: 120px; width: 400px; height: 400px; background: radial-gradient(closest-side, var(--lla-glow-b), transparent); }

/* Ventana */
.lla-iap__win { position: absolute; left: 0; top: 4px; width: 640px; height: 472px; overflow: hidden; border: 1px solid var(--lla-border); border-radius: 14px; background: var(--lla-bg); box-shadow: var(--lla-shadow); }
.lla-iap__chrome { display: flex; align-items: center; gap: 10px; height: 30px; padding: 0 12px; border-bottom: 1px solid var(--lla-border); background: var(--lla-surface); }
.lla-iap__dots { display: flex; flex: none; gap: 5px; }
.lla-iap__dots i { width: 9px; height: 9px; border-radius: 50%; background: #ff5f57; }
.lla-iap__dots i:nth-child(2) { background: #febc2e; }
.lla-iap__dots i:nth-child(3) { background: #28c840; }
.lla-iap__url { display: flex; align-items: center; gap: 5px; min-width: 0; overflow: hidden; padding: 3px 9px; border-radius: 6px; background: var(--lla-bg); color: var(--lla-muted); font-size: 10.5px; white-space: nowrap; }
.lla-iap__url > span { overflow: hidden; text-overflow: ellipsis; }
.lla-iap__url .bi { flex: none; font-size: 8.5px; color: #198754; }
.lla-iap__vp { position: relative; height: calc(100% - 30px); overflow: hidden; }
.lla-iap__body { display: flex; flex-direction: column; gap: 10px; padding: 14px 18px; font-size: 11px; transition: transform .8s var(--lla-ease); }

.lla-iap__head { display: flex; align-items: center; gap: 10px; }
.lla-iap__head b { font-size: 17px; font-weight: 600; }
.lla-iap__back { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 28px; border: 1px solid #6c757d; border-radius: 6px; color: #6c757d; }
.lla-iap__btn { position: relative; display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border: 1px solid var(--lla-primary); border-radius: 6px; background: var(--lla-primary); color: #fff; font-size: 10.5px; font-weight: 600; white-space: nowrap; transition: transform .15s var(--lla-ease), background-color .2s var(--lla-ease), color .2s var(--lla-ease); }
.lla-iap__btn.is-pressed { transform: scale(.95); }
.lla-iap__btn--outline { margin-left: auto; background: #fff; color: var(--lla-primary); }
.lla-iap[data-box] .lla-iap__btn--outline { background: var(--lla-primary); color: #fff; }

/* Caja de IA */
.lla-iap__box { display: none; flex-direction: column; gap: 7px; padding: 12px; border: 1px solid rgba(var(--lla-primary-rgb), .35); border-radius: 10px; background: #fff; }
.lla-iap[data-box] .lla-iap__box { display: flex; animation: lla-iap-in .35s var(--lla-ease) both; }
.lla-iap__box-head { display: flex; align-items: center; gap: 8px; }
.lla-iap__box-head b { font-size: 11.5px; font-weight: 700; }
.lla-iap__box-head small { margin-left: auto !important; color: var(--lla-muted); font-size: 10px; }
.lla-iap__box-head small span { font-weight: 700; color: var(--lla-text); }
.lla-iap__x { color: var(--lla-muted); font-size: 15px; line-height: 1; }
.lla-iap__avatar { position: relative; display: inline-flex; flex: none; align-items: center; justify-content: center; width: 26px; height: 26px; overflow: hidden; border-radius: 50%; background: var(--lla-ana); color: #fff; font-size: 9px; font-weight: 700; }
.lla-iap__avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lla-iap__textarea { position: relative; display: block; min-height: 44px; padding: 7px 9px; border: 1px solid var(--lla-border-2); border-radius: 6px; font-size: 11px; line-height: 1.4; transition: border-color .2s var(--lla-ease), box-shadow .2s var(--lla-ease); }
.lla-iap[data-focus] [data-ref="f-prompt"] { border-color: var(--lla-primary); box-shadow: 0 0 0 3px rgba(var(--lla-primary-rgb), .12); }
.lla-iap__ph { position: absolute; left: 9px; top: 7px; right: 9px; color: #adb5bd; }
[data-ref="prompt"]:not(:empty) + .lla-iap__ph { display: none; }
.lla-iap__box-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lla-iap__box-foot small { color: var(--lla-muted); font-size: 10px; }
.lla-iap__fill-b { display: none; align-items: center; gap: 5px; }
.lla-iap__fill-b .lla-spinner { width: 10px; height: 10px; }
.lla-iap[data-busy] .lla-iap__fill-a { display: none; }
.lla-iap[data-busy] .lla-iap__fill-b { display: inline-flex; }

/* Aviso .ll-ai-note */
.lla-iap__note { display: none; gap: 8px; padding: 9px 12px; border: 1px solid rgba(var(--lla-primary-rgb), .25); border-radius: 8px; background: rgba(var(--lla-primary-rgb), .06); font-size: 10.5px; }
.lla-iap__note > .bi { color: var(--lla-primary); }
.lla-iap__note > span { display: flex; flex-direction: column; gap: 3px; }
.lla-iap__note small { color: #4b5563; font-size: 9.5px; }
.lla-iap[data-note] .lla-iap__note { display: flex; animation: lla-iap-in .35s var(--lla-ease) both; }

/* Formulario */
.lla-iap__form { display: flex; gap: 16px; }
.lla-iap__img { position: relative; display: flex; flex: none; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 150px; height: 150px; border: 1px dashed var(--lla-border-2); border-radius: 10px; color: #adb5bd; font-size: 30px; text-align: center; }
.lla-iap__img small { padding: 0 10px; color: var(--lla-muted); font-size: 9px; }
/* Imagen principal: entra al final del ciclo (data-photo), cuando el dueño sube la foto. */
.lla-iap__photo { position: absolute; top: -1px; left: -1px; width: calc(100% + 2px); height: calc(100% + 2px); border-radius: 10px; object-fit: cover; opacity: 0; transform: scale(1.06); transition: opacity .5s var(--lla-ease), transform .7s var(--lla-ease); }
.lla-iap[data-photo] .lla-iap__photo { opacity: 1; transform: none; }
.lla-iap__fields { display: flex; flex: 1; flex-direction: column; gap: 4px; min-width: 0; }
.lla-iap__label { margin-top: 3px !important; font-size: 10px; font-weight: 700; }
.lla-iap__label--row { display: flex; align-items: center; justify-content: space-between; }
.lla-iap__label--row small { font-size: 10px; font-weight: 700; }
.lla-iap__mini { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px; border: 1px solid var(--lla-primary); border-radius: 5px; color: var(--lla-primary); font-size: 9px; font-weight: 600; }
.lla-iap__mini .bi-chevron-down { font-size: 7px; }
.lla-iap__link { display: inline-flex; align-items: center; color: var(--lla-primary); font-size: 9.5px; font-weight: 600; transition: transform .15s var(--lla-ease); }
.lla-iap__link.is-pressed { transform: scale(.94); }
.lla-iap__link .bi { margin-right: 3px; }
.lla-iap__tags-b { display: none; align-items: center; gap: 4px; }
.lla-iap__tags-b .lla-spinner { width: 9px; height: 9px; }
.lla-iap[data-tagging] .lla-iap__tags-a { display: none; }
.lla-iap[data-tagging] .lla-iap__tags-b { display: inline-flex; }

.lla-iap__in { display: flex; align-items: center; min-height: 28px; padding: 0 9px; overflow: hidden; border: 1px solid var(--lla-border-2); border-radius: 6px; font-size: 11px; transition: border-color .3s var(--lla-ease), box-shadow .3s var(--lla-ease); }
.lla-iap__in--price i { margin-right: 4px; color: var(--lla-muted); font-style: normal; }
.lla-iap__in--area { align-items: flex-start; min-height: 66px; padding: 7px 9px; line-height: 1.45; }
.lla-iap__tags { flex-wrap: wrap; gap: 4px; min-height: 30px; padding: 4px 6px; }
.lla-iap__tags i { display: none; padding: 2px 8px; border-radius: 999px; background: rgba(var(--lla-primary-rgb), .1); color: var(--lla-primary); font-size: 10px; font-style: normal; font-weight: 600; }
.lla-iap[data-tags] .lla-iap__tags i { display: inline-block; animation: lla-iap-pop .35s var(--lla-ease) both; }
.lla-iap[data-tags] .lla-iap__tags i:nth-child(2) { animation-delay: .08s; }
.lla-iap[data-tags] .lla-iap__tags i:nth-child(3) { animation-delay: .16s; }
.lla-iap[data-tags] .lla-iap__tags i:nth-child(4) { animation-delay: .24s; }
/* .ll-ai-filled */
.lla-iap[data-filled] :is([data-f="name"], [data-f="price"], [data-f="desc"]),
.lla-iap[data-tags] [data-f="tags"] { border-color: rgba(var(--lla-primary-rgb), .55); box-shadow: 0 0 0 .15rem rgba(var(--lla-primary-rgb), .12); }

/* Puntero */
.lla-iap__cursor { position: absolute; top: 0; left: 0; z-index: 10; width: 22px; height: 22px; pointer-events: none; opacity: 0; transform: translate(300px, 440px); transition: transform .6s var(--lla-ease), opacity .3s var(--lla-ease); }
.lla-iap[data-cursor] .lla-iap__cursor { opacity: 1; }
.lla-iap__cursor svg { position: relative; display: block; width: 22px; height: 22px; fill: var(--lla-cursor-fill); stroke: var(--lla-cursor-edge); stroke-width: 1.4; stroke-linejoin: round; }
.lla-iap__cursor-ring { position: absolute; left: -10px; top: -12px; width: 28px; height: 28px; border: 2px solid var(--lla-cursor-ring); border-radius: 50%; opacity: 0; }
.lla-iap__cursor.is-tap svg { animation: lla-iap-press .3s var(--lla-ease); }
.lla-iap__cursor.is-tap .lla-iap__cursor-ring { animation: lla-iap-ripple .5s var(--lla-ease); }

@container (max-width: 479px) {
  .lla .lla-iap__stage { --lla-w: 420; --lla-h: 620; }
  .lla-iap__win { width: 420px; height: 612px; }
  .lla-iap__form { flex-direction: column; }
  .lla-iap__img { width: 100%; height: 70px; flex-direction: row; }
}

@keyframes lla-iap-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes lla-iap-pop { from { transform: scale(.6); } to { transform: none; } }
@keyframes lla-iap-press { 50% { transform: scale(.85); } }
@keyframes lla-iap-ripple {
  0% { opacity: .9; transform: scale(.4); }
  100% { opacity: 0; transform: scale(1.4); }
}
