/* ==========================================================================
   Demo viva "inventory" (hero de /inventario): llega una venta y descuenta
   stock, se registra una entrada a un producto agotado y se abre su historial.
   Markup: resources/views/web/partials/anim/inventory.blade.php
   Estados en la raíz:
     data-sale    tarjeta de la venta visible · data-flash  renglón que cambió (a | b)
     data-modal   adjust | hist (modal abierto) · data-restock  la taza ya tiene stock
     data-cursor  puntero visible
   El panel no tiene modo oscuro: solo halo y sombra.
   ========================================================================== */

/* ---------- Paleta (panel company, Bootstrap/Front) ---------- */
.lla-inv {
  --lla-bg: #ffffff;
  --lla-surface: #f8f9fa;
  --lla-panel: #f5f7fb;
  --lla-text: #1e2022;
  --lla-muted: #677788;
  --lla-border: #e7eaf3;
  --lla-primary: #377dff;
  --lla-success: #00c9a7;
  --lla-success-text: #00a389;
  --lla-danger: #ed4c78;
  --lla-shadow: 0 32px 64px -24px rgba(22, 34, 58, .38), 0 10px 24px -10px rgba(22, 34, 58, .18);
  --lla-glow-a: rgba(55, 125, 255, .16);
  --lla-glow-b: rgba(0, 201, 167, .12);
  --lla-cursor-fill: #1e2022;
  --lla-cursor-edge: #ffffff;
  --lla-cursor-ring: rgba(55, 125, 255, .55);
}
html[data-theme="dark"] .lla-inv {
  --lla-glow-a: rgba(77, 159, 255, .14);
  --lla-glow-b: rgba(74, 217, 145, .1);
  --lla-shadow: 0 32px 64px -24px rgba(0, 0, 0, .8), 0 10px 24px -10px rgba(0, 0, 0, .55);
}

/* ---------- Escena ---------- */
.lla-inv { max-width: 700px; margin-inline: auto; color: var(--lla-text); line-height: 1.3; text-align: left; }
.lla .lla-inv__stage { --lla-w: 700; --lla-h: 390; }
.lla-inv :where(b, small, strong, em, i, p, label) { margin: 0; font-size: inherit; font-style: normal; font-weight: inherit; color: inherit; }
.lla-inv .bi::before { vertical-align: 0; }
.lla-inv__glow { position: absolute; border-radius: 50%; pointer-events: none; }
.lla-inv__glow--a { left: -30px; top: 20px; width: 460px; height: 460px; background: radial-gradient(closest-side, var(--lla-glow-a), transparent); }
.lla-inv__glow--b { left: 340px; top: 40px; width: 380px; height: 420px; background: radial-gradient(closest-side, var(--lla-glow-b), transparent); }

/* ---------- Ventana ---------- */
.lla-inv__win { position: absolute; left: 0; top: 44px; width: 640px; height: 336px; overflow: hidden; border: 1px solid var(--lla-border); border-radius: 14px; background: var(--lla-panel); box-shadow: var(--lla-shadow); }
.lla-inv__chrome { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 12px; border-bottom: 1px solid var(--lla-border); background: var(--lla-surface); }
.lla-inv__dots { display: flex; gap: 5px; }
.lla-inv__dots i { width: 9px; height: 9px; border-radius: 50%; background: #ff5f57; }
.lla-inv__dots i:nth-child(2) { background: #febc2e; }
.lla-inv__dots i:nth-child(3) { background: #28c840; }
.lla-inv__url { display: flex; align-items: center; gap: 6px; flex: 1; max-width: 360px; height: 20px; margin-inline: auto; padding: 0 10px; border-radius: 6px; background: #fff; color: var(--lla-muted); font-size: 11px; }
.lla-inv__url .bi { color: #198754; font-size: 9px; }
.lla-inv__panel { position: relative; height: calc(100% - 32px); padding: 16px; }

.lla-inv__card { overflow: hidden; border: 1px solid var(--lla-border); border-radius: 12px; background: #fff; box-shadow: 0 1px 3px rgba(22, 34, 58, .06); }
.lla-inv__head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--lla-border); }
.lla-inv__head > b { margin-right: auto; font-size: 15px; font-weight: 600; }
.lla-inv__count { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 6px; background: var(--lla-primary); color: #fff; font-size: 11px; font-weight: 600; }
.lla-inv__search { display: flex; align-items: center; width: 230px; height: 28px; overflow: hidden; border: 1px solid #dfe3ea; border-radius: 6px; color: var(--lla-muted); font-size: 11px; }
.lla-inv__search .bi-search { padding: 0 8px; }
.lla-inv__search em { flex: 1; overflow: hidden; color: #97a4af; text-overflow: ellipsis; white-space: nowrap; }
.lla-inv__search .bi-upc-scan { display: grid; place-items: center; height: 100%; padding: 0 9px; border-left: 1px solid #dfe3ea; }

.lla-inv__table { width: 100%; border-collapse: collapse; font-size: 12px; }
.lla-inv__table th { padding: 9px 14px; border-bottom: 1px solid var(--lla-border); color: var(--lla-muted); font-size: 10.5px; font-weight: 600; letter-spacing: .03em; text-align: left; text-transform: uppercase; }
.lla-inv__table td { padding: 9px 14px; border-bottom: 1px solid #f1f3f7; transition: background-color .5s; }
.lla-inv__table tr:last-child td { border-bottom: 0; }
.lla-inv__table :is(th, td):nth-child(n+3) { text-align: right; }
.lla-inv__table td:nth-child(2) { color: var(--lla-muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }
.lla-inv__stock { display: inline-block; min-width: 22px; font-weight: 600; font-variant-numeric: tabular-nums; transition: color .3s; }
[data-row="1"] .lla-inv__stock { color: var(--lla-danger); font-weight: 800; }
.lla-inv[data-restock] [data-row="1"] .lla-inv__stock { color: inherit; font-weight: 600; }
.lla-inv__unl { padding: 2px 7px; border: 1px solid var(--lla-border); border-radius: 5px; background: var(--lla-surface); color: var(--lla-muted); font-size: 10.5px; }
.lla-inv__acts { display: inline-flex; gap: 4px; }
.lla-inv__acts i { display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid; border-radius: 5px; font-size: 11px; transition: transform .15s var(--lla-ease), background-color .15s, color .15s; }
.lla-inv__acts .bi-plus-lg { border-color: var(--lla-success); color: var(--lla-success); }
.lla-inv__acts .bi-dash-lg { border-color: var(--lla-danger); color: var(--lla-danger); }
.lla-inv__acts .bi-clock-history { border-color: #8c98a4; color: #677788; }
.lla-inv__acts .is-pressed { transform: scale(.9); }
.lla-inv__acts .bi-plus-lg.is-pressed { background: var(--lla-success); color: #fff; }
.lla-inv__acts .bi-clock-history.is-pressed { background: #677788; color: #fff; }
.lla-inv__none { color: var(--lla-muted); }
.lla-inv[data-flash="a"] [data-row="0"] td, .lla-inv[data-flash="b"] [data-row="1"] td { background: rgba(0, 201, 167, .1); }

/* ---------- Modales ---------- */
.lla-inv__backdrop { position: absolute; inset: 0; background: rgba(19, 33, 68, .35); opacity: 0; transition: opacity .3s var(--lla-ease); pointer-events: none; }
.lla-inv[data-modal] .lla-inv__backdrop { opacity: 1; }
.lla-inv__modal { position: absolute; left: 50%; top: 26px; overflow: hidden; border-radius: 12px; background: #fff; box-shadow: 0 24px 50px -12px rgba(19, 33, 68, .45); opacity: 0; transform: translate(-50%, -14px); transition: opacity .3s var(--lla-ease), transform .35s var(--lla-ease); }
.lla-inv__modal--adjust { width: 340px; }
.lla-inv__modal--hist { width: 560px; }
.lla-inv[data-modal="adjust"] .lla-inv__modal--adjust, .lla-inv[data-modal="hist"] .lla-inv__modal--hist { opacity: 1; transform: translate(-50%, 0); }
.lla-inv__modal header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--lla-border); }
.lla-inv__modal header b { font-size: 14px; font-weight: 600; }
.lla-inv__modal header .bi { color: var(--lla-muted); font-size: 12px; }
.lla-inv__mbody { padding: 12px 16px; font-size: 12px; }
.lla-inv__mbody p { margin-bottom: 8px !important; }
.lla-inv__mbody strong { font-weight: 700; }
.lla-inv__mbody label { display: block; margin: 6px 0 4px; font-size: 11px; }
.lla-inv__input { display: flex; align-items: center; height: 30px; padding: 0 10px; border: 1px solid #dfe3ea; border-radius: 6px; font-size: 12px; transition: border-color .2s, box-shadow .2s; }
.lla-inv__input.is-focus { border-color: rgba(55, 125, 255, .5); box-shadow: 0 0 0 3px rgba(55, 125, 255, .12); }
.lla-inv__input.is-focus::after { content: ""; width: 1px; height: 14px; margin-left: 1px; background: var(--lla-text); animation: lla-inv-caret 1s steps(1) infinite; }
.lla-inv__modal footer { display: flex; justify-content: flex-end; gap: 6px; padding: 10px 16px; border-top: 1px solid var(--lla-border); }
.lla-inv__btn { padding: 6px 12px; border-radius: 6px; background: var(--lla-primary); color: #fff; font-size: 11.5px; font-weight: 600; transition: transform .15s var(--lla-ease), filter .15s; }
.lla-inv__btn--ghost { background: #71869d; }
.lla-inv__btn.is-pressed { transform: scale(.95); filter: brightness(.9); }

.lla-inv__htable { width: 100%; border-collapse: collapse; font-size: 11px; }
.lla-inv__htable th { padding: 6px 7px; border-bottom: 2px solid var(--lla-border); font-weight: 600; text-align: left; }
.lla-inv__htable td { padding: 6px 7px; border-bottom: 1px solid #f1f3f7; white-space: nowrap; }
.lla-inv__htable :is(th, td):nth-child(3), .lla-inv__htable :is(th, td):nth-child(4) { text-align: right; }
.lla-inv__htable td:last-child { color: var(--lla-muted); }
.lla-inv__htable .is-up { color: #198754; }
.lla-inv__htable .is-down { color: #dc3545; }
.lla-inv[data-modal="hist"] .lla-inv__new td { animation: lla-inv-hl 1.6s var(--lla-ease) .3s both; }

/* ---------- Venta ---------- */
.lla-inv__sale { position: absolute; left: 446px; top: 4px; display: flex; align-items: center; gap: 9px; width: 248px; padding: 9px 12px 9px 10px; border: 1px solid var(--lla-border); border-radius: 14px; background: #fff; box-shadow: var(--lla-shadow); opacity: 0; transform: translateY(-10px); transition: opacity .4s var(--lla-ease), transform .5s var(--lla-ease); }
.lla-inv__sale > span:first-child { display: grid; flex: none; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: rgba(0, 201, 167, .12); color: var(--lla-success-text); font-size: 15px; }
.lla-inv__sale > span:nth-child(2) { display: flex; flex-direction: column; min-width: 0; }
.lla-inv__sale b { font-size: 12px; font-weight: 700; }
.lla-inv__sale small { overflow: hidden; color: var(--lla-muted); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.lla-inv__sale em { margin-left: auto; padding: 2px 8px; border-radius: 999px; background: rgba(237, 76, 120, .1); color: var(--lla-danger); font-size: 11px; font-weight: 700; }
.lla-inv[data-sale] .lla-inv__sale { opacity: 1; transform: none; }
.lla-inv[data-fade] .lla-inv__sale { opacity: 0; }

/* ---------- Puntero ---------- */
.lla-inv__cursor { position: absolute; top: 0; left: 0; z-index: 10; width: 22px; height: 22px; pointer-events: none; opacity: 0; transform: translate(560px, 440px); transition: transform .6s var(--lla-ease), opacity .3s var(--lla-ease); }
.lla-inv[data-cursor] .lla-inv__cursor { opacity: 1; }
.lla-inv__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-inv__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-inv__cursor.is-tap svg { animation: lla-inv-press .3s var(--lla-ease); }
.lla-inv__cursor.is-tap .lla-inv__cursor-ring { animation: lla-inv-ripple .5s var(--lla-ease); }

/* ---------- Angosto ---------- */
@container (max-width: 479px) {
  .lla .lla-inv__stage { --lla-w: 640; --lla-h: 450; }
  .lla-inv__win { top: 104px; }
  .lla-inv__sale { left: 10px; top: 10px; width: 300px; }
}

@keyframes lla-inv-caret { 50% { opacity: 0; } }
@keyframes lla-inv-hl { 0%, 60% { background: rgba(0, 201, 167, .14); } 100% { background: transparent; } }
@keyframes lla-inv-press { 50% { transform: scale(.85); } }
@keyframes lla-inv-ripple {
  0% { opacity: .9; transform: scale(.4); }
  100% { opacity: 0; transform: scale(1.4); }
}
