/* ==========================================================================
   Demo viva "discount-flow" (hero de /descuentos): crear un cupón por categoría
   en el panel y que el cliente lo aplique en el checkout de la tienda.
   Markup: resources/views/web/partials/anim/discount-flow.blade.php
   Estados en la raíz:
     data-modal    modal "Nuevo descuento" abierto · data-target  "Categorías específicas"
     data-cat      categoría marcada · data-created  renglón nuevo en la tabla
     data-applied  cupón aplicado en el checkout · data-cursor  puntero visible
   Panel y tienda no tienen modo oscuro: solo halo y sombra.
   Fotos: CDN estático (dulce-puebla-logo en la marca del checkout y
   dulce-puebla-pastel-de-chocolate en la miniatura del producto).
   ========================================================================== */

/* ---------- Paleta ---------- */
.lla-dc {
  --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-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(245, 158, 11, .12);
  --lla-cursor-fill: #1e2022;
  --lla-cursor-edge: #ffffff;
  --lla-cursor-ring: rgba(55, 125, 255, .55);

  /* Tienda (plantilla 4): --ll-color-primary / --ll-color-success de la tienda de ejemplo */
  --lla-brand: #db2777;
  --lla-store-ok: #16a34a;
}
html[data-theme="dark"] .lla-dc {
  --lla-glow-a: rgba(77, 159, 255, .14);
  --lla-glow-b: rgba(245, 158, 11, .1);
  --lla-shadow: 0 32px 64px -24px rgba(0, 0, 0, .8), 0 10px 24px -10px rgba(0, 0, 0, .55);
}

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

/* ---------- Ventana del panel ---------- */
.lla-dc__win { position: absolute; left: 0; top: 24px; width: 496px; height: 430px; overflow: hidden; border: 1px solid var(--lla-border); border-radius: 14px; background: var(--lla-panel); box-shadow: var(--lla-shadow); }
.lla-dc__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-dc__dots { display: flex; gap: 5px; }
.lla-dc__dots i { width: 9px; height: 9px; border-radius: 50%; background: #ff5f57; }
.lla-dc__dots i:nth-child(2) { background: #febc2e; }
.lla-dc__dots i:nth-child(3) { background: #28c840; }
.lla-dc__url { display: flex; align-items: center; gap: 6px; flex: 1; max-width: 340px; height: 20px; margin-inline: auto; padding: 0 10px; border-radius: 6px; background: #fff; color: var(--lla-muted); font-size: 11px; }
.lla-dc__url .bi { color: #198754; font-size: 9px; }
.lla-dc__panel { position: relative; height: calc(100% - 32px); padding: 14px; }
.lla-dc__card { overflow: hidden; border: 1px solid var(--lla-border); border-radius: 12px; background: #fff; }
.lla-dc__head { display: flex; align-items: center; gap: 9px; padding: 11px 14px; border-bottom: 1px solid var(--lla-border); }
.lla-dc__head > .bi { color: var(--lla-muted); font-size: 13px; }
.lla-dc__head > b { margin-right: auto; font-size: 14.5px; font-weight: 600; }
.lla-dc__search { display: flex; align-items: center; gap: 7px; width: 150px; height: 27px; padding: 0 9px; border: 1px solid #dfe3ea; border-radius: 6px; color: #97a4af; font-size: 11px; }
.lla-dc__add { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 6px; background: var(--lla-primary); color: #fff; font-size: 13px; transition: transform .15s var(--lla-ease), filter .15s; }
.lla-dc__add.is-pressed { transform: scale(.9); filter: brightness(.9); }

.lla-dc__table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.lla-dc__table th { padding: 8px 14px; background: #f8fafd; color: var(--lla-muted); font-size: 10px; font-weight: 600; letter-spacing: .04em; text-align: left; text-transform: uppercase; }
.lla-dc__table td { padding: 10px 14px; border-top: 1px solid #f1f3f7; white-space: nowrap; }
.lla-dc__table td:first-child { font-weight: 700; }
.lla-dc__b { padding: 2px 7px; border: 1px solid #8c98a4; border-radius: 5px; background: rgba(113, 134, 157, .1); color: #71869d; font-size: 10px; font-weight: 600; }
.lla-dc__b--info { border-color: #09a5be; background: rgba(9, 165, 190, .1); color: #09a5be; }
.lla-dc__b--ok { border: 0; background: rgba(0, 201, 167, .1); color: var(--lla-success); }
.lla-dc__on { padding: 3px 8px; border-radius: 5px; background: var(--lla-success); color: #fff; font-size: 10px; font-weight: 600; }
.lla-dc__new { display: none; }
.lla-dc[data-created] .lla-dc__new { display: table-row; }
.lla-dc[data-created] .lla-dc__new td { animation: lla-dc-hl 2s var(--lla-ease) both; }
[data-ref="used"] { transition: color .3s; }
.lla-dc[data-applied] [data-ref="used"] { color: var(--lla-primary); font-weight: 700; }

/* ---------- Modal ---------- */
.lla-dc__backdrop { position: absolute; inset: 0; background: rgba(19, 33, 68, .35); opacity: 0; transition: opacity .3s var(--lla-ease); }
.lla-dc[data-modal] .lla-dc__backdrop { opacity: 1; }
.lla-dc__modal { position: absolute; left: 50%; top: 14px; width: 440px; 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-dc[data-modal] .lla-dc__modal { opacity: 1; transform: translate(-50%, 0); }
.lla-dc__modal header { display: flex; align-items: center; justify-content: space-between; padding: 11px 16px; border-bottom: 1px solid var(--lla-border); }
.lla-dc__modal header b { font-size: 15px; font-weight: 600; }
.lla-dc__modal header .bi { color: var(--lla-muted); font-size: 12px; }
.lla-dc__form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; padding: 12px 16px; }
.lla-dc__form label { display: flex; flex-direction: column; gap: 4px; }
.lla-dc__form small { font-size: 11px; }
.lla-dc__form small em { color: #ed4c78; }
.lla-dc__wide { grid-column: 1 / -1; }
.lla-dc__input { position: relative; display: flex; align-items: center; height: 29px; padding: 0 10px; border: 1px solid #dfe3ea; border-radius: 6px; font-size: 12px; transition: border-color .2s, box-shadow .2s; }
.lla-dc__input.is-focus { border-color: rgba(55, 125, 255, .5); box-shadow: 0 0 0 3px rgba(55, 125, 255, .12); }
.lla-dc__input.is-focus::after { content: ""; width: 1px; height: 14px; margin-left: 1px; background: var(--lla-text); animation: lla-dc-caret 1s steps(1) infinite; }
.lla-dc__select { padding-right: 26px; }
.lla-dc__select::before { content: ""; position: absolute; right: 10px; top: 11px; width: 6px; height: 6px; border-right: 1.5px solid #677788; border-bottom: 1.5px solid #677788; transform: rotate(45deg); }
.lla-dc__select > span + span, .lla-dc[data-target] .lla-dc__select > span:first-child { display: none; }
.lla-dc[data-target] .lla-dc__select > span + span { display: inline; }
.lla-dc__select.is-pressed { border-color: rgba(55, 125, 255, .5); box-shadow: 0 0 0 3px rgba(55, 125, 255, .12); }
.lla-dc__cats { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 8px 10px; border: 1px solid #eef0f3; border-radius: 8px; opacity: .35; transition: opacity .3s; }
.lla-dc__cats > small { width: 100%; color: var(--lla-muted); }
.lla-dc[data-target] .lla-dc__cats { opacity: 1; }
.lla-dc__check { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.lla-dc__check i { display: grid; place-items: center; width: 14px; height: 14px; border: 1px solid #c4cad3; border-radius: 3px; transition: background-color .2s, border-color .2s; }
.lla-dc[data-cat] [data-ref="cat"] i { border-color: var(--lla-primary); background: var(--lla-primary); }
.lla-dc[data-cat] [data-ref="cat"] i::after { content: ""; width: 6px; height: 3px; margin-top: -2px; border-left: 1.5px solid #fff; border-bottom: 1.5px solid #fff; transform: rotate(-45deg); }
.lla-dc__modal footer { display: flex; justify-content: flex-end; gap: 6px; padding: 10px 16px; border-top: 1px solid var(--lla-border); }
.lla-dc__ghost { padding: 6px 12px; color: #71869d; font-size: 11.5px; font-weight: 600; }
.lla-dc__btn { padding: 6px 14px; 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-dc__btn.is-pressed { transform: scale(.95); filter: brightness(.9); }

/* ---------- Celular: checkout ---------- */
.lla-dc__phone { position: absolute; left: 512px; top: 64px; width: 206px; height: 404px; padding: 7px; border-radius: 36px; background: #0a0a0c; box-shadow: inset 0 0 0 2px #8a8e97, inset 0 0 0 3.5px #2b2d33, var(--lla-shadow); }
.lla-dc__screen { position: relative; display: flex; flex-direction: column; height: 100%; overflow: hidden; padding: 36px 12px 18px; border-radius: 29px; background: #fff; font-size: 11px; }
.lla-dc__island { position: absolute; top: 8px; left: 50%; width: 56px; height: 17px; border-radius: 999px; background: #000; transform: translateX(-50%); }
.lla-dc__home { position: absolute; bottom: 6px; left: 50%; width: 36%; height: 4px; border-radius: 999px; background: rgba(0, 0, 0, .85); transform: translateX(-50%); }
.lla-dc__h { margin-bottom: 8px !important; font-size: 13px !important; font-weight: 800; }
/* Marca de la tienda en el checkout (logo de Dulce Puebla + nombre). */
.lla-dc__brand { display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 7px; }
.lla-dc__brand img { flex: none; width: 28px; height: 28px; object-fit: contain; }
.lla-dc__brand span { font-size: 10px; font-weight: 700; }
.lla-dc__item { display: flex; align-items: center; gap: 7px; padding-bottom: 9px; border-bottom: 1px solid #f1f2f5; }
.lla-dc__thumb { position: relative; display: grid; flex: none; place-items: center; width: 36px; height: 36px; overflow: hidden; border-radius: 9px; background: #fdf2f8; font-size: 20px; }
/* Foto real del producto (misma de la tienda); el pastelito queda de respaldo. */
.lla-dc__photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lla-dc__info { display: flex; flex-direction: column; min-width: 0; }
.lla-dc__item b { display: -webkit-box; overflow: hidden; font-size: 10.5px; font-weight: 700; line-height: 1.15; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.lla-dc__item small { color: var(--lla-muted); font-size: 9.5px; }
.lla-dc__item strong { margin-left: auto; font-size: 10.5px; font-weight: 700; }
.lla-dc__rows { display: flex; flex-direction: column; gap: 4px; padding: 8px 0; }
.lla-dc__rows > span { display: flex; justify-content: space-between; gap: 4px; white-space: nowrap; }
.lla-dc__disc small { font-size: 9.5px; }
.lla-dc__rows b { font-weight: 600; }
.lla-dc__disc { display: none !important; color: var(--lla-store-ok); }
.lla-dc[data-applied] .lla-dc__disc { display: flex !important; animation: lla-dc-in .4s var(--lla-ease); }
.lla-dc__coupon { display: flex; flex-direction: column; gap: 5px; padding: 8px 0; border-top: 1px solid #f1f2f5; }
.lla-dc__coupon > small:first-child { color: var(--lla-muted); font-size: 10px; }
.lla-dc__group { display: flex; overflow: hidden; border: 1px solid #d6dbe4; border-radius: 8px; }
.lla-dc__cin { display: flex; flex: 1; align-items: center; min-width: 0; height: 28px; padding: 0 8px; overflow: hidden; font-size: 10.5px; font-weight: 600; letter-spacing: .03em; white-space: nowrap; }
.lla-dc__cin:empty::before { content: attr(data-ph); color: #9aa5b4; font-size: 9px; font-weight: 400; letter-spacing: 0; }
.lla-dc__cin.is-focus::after { content: ""; width: 1px; height: 12px; margin-left: 1px; background: var(--lla-text); animation: lla-dc-caret 1s steps(1) infinite; }
.lla-dc__apply { display: grid; place-items: center; padding: 0 9px; border-left: 1px solid #d6dbe4; color: #4b5563; font-size: 10px; font-weight: 600; transition: background-color .15s; }
.lla-dc__apply.is-pressed { background: #eef0f3; }
.lla-dc[data-applied] .lla-dc__group { background: #f6f7f9; }
.lla-dc__msg { display: none; color: var(--lla-store-ok); font-size: 9.5px; font-weight: 600; }
.lla-dc[data-applied] .lla-dc__msg { display: block; animation: lla-dc-in .4s var(--lla-ease); }
.lla-dc__total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 8px; border-top: 1px solid #f1f2f5; }
.lla-dc__total b { font-size: 12px; font-weight: 800; }
.lla-dc__total s { display: none; margin-right: 5px; color: var(--lla-muted); font-size: 9.5px; font-weight: 500; }
.lla-dc__total ins { display: none; text-decoration: none; }
.lla-dc__total b:last-child { font-variant-numeric: tabular-nums; }
.lla-dc:not([data-applied]) .lla-dc__total s { display: inline; margin: 0; color: inherit; font-size: inherit; font-weight: inherit; text-decoration: none; }
.lla-dc[data-applied] .lla-dc__total s { display: inline; text-decoration: line-through; }
.lla-dc[data-applied] .lla-dc__total ins { display: inline; }
.lla-dc__pay { margin-top: auto; padding: 9px; border-radius: 10px; background: var(--lla-brand); color: #fff; font-size: 11.5px; font-weight: 700; text-align: center; }

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

/* ---------- Angosto: panel arriba, celular abajo ---------- */
@container (max-width: 479px) {
  .lla .lla-dc__stage { --lla-w: 560; --lla-h: 900; }
  .lla-dc__win { left: 32px; top: 10px; }
  .lla-dc__phone { left: 177px; top: 476px; }
}

@keyframes lla-dc-caret { 50% { opacity: 0; } }
@keyframes lla-dc-hl { 0%, 55% { background: rgba(55, 125, 255, .08); } 100% { background: transparent; } }
@keyframes lla-dc-in { from { transform: translateY(-4px); } to { transform: none; } }
@keyframes lla-dc-press { 50% { transform: scale(.85); } }
@keyframes lla-dc-ripple {
  0% { opacity: .9; transform: scale(.4); }
  100% { opacity: 0; transform: scale(1.4); }
}
