/* ==========================================================================
   Demo viva "affiliate-earn" (/afiliados, sección "¿Para quién es…?"): el
   afiliado copia su link, lo comparte por WhatsApp, un negocio se registra,
   paga su plan y entra la comisión.
   Markup: resources/views/web/partials/anim/affiliate-earn.blade.php
   Estados en la raíz:
     data-copied  link copiado · data-sent  mensaje enviado · data-thanks  respuesta
     data-reg     negocio nuevo registrado · data-paid  ya paga (+ comisión)
     data-cursor  puntero visible
   Panel y WhatsApp no tienen modo oscuro: solo halo y sombra.
   ========================================================================== */

.lla-af {
  --lla-surface: #f8f9fa;
  --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(37, 211, 102, .14);
  --lla-cursor-fill: #1e2022;
  --lla-cursor-edge: #ffffff;
  --lla-cursor-ring: rgba(55, 125, 255, .55);
}
html[data-theme="dark"] .lla-af {
  --lla-glow-a: rgba(77, 159, 255, .14);
  --lla-glow-b: rgba(37, 211, 102, .1);
  --lla-shadow: 0 32px 64px -24px rgba(0, 0, 0, .8), 0 10px 24px -10px rgba(0, 0, 0, .55);
}

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

/* ---------- Panel ---------- */
.lla-af__win { position: absolute; left: 0; top: 12px; width: 488px; height: 478px; overflow: hidden; border: 1px solid var(--lla-border); border-radius: 14px; background: #f5f7fb; box-shadow: var(--lla-shadow); }
.lla-af__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-af__dots { display: flex; gap: 5px; }
.lla-af__dots i { width: 9px; height: 9px; border-radius: 50%; background: #ff5f57; }
.lla-af__dots i:nth-child(2) { background: #febc2e; }
.lla-af__dots i:nth-child(3) { background: #28c840; }
.lla-af__url { display: flex; align-items: center; gap: 6px; flex: 1; max-width: 330px; height: 20px; margin-inline: auto; padding: 0 10px; border-radius: 6px; background: #fff; color: var(--lla-muted); font-size: 11px; }
.lla-af__url .bi { color: #198754; font-size: 9px; }
.lla-af__panel { height: calc(100% - 32px); padding: 12px; }
.lla-af__card { height: 100%; overflow: hidden; border: 1px solid var(--lla-border); border-radius: 12px; background: #fff; }
.lla-af__card header { display: flex; align-items: center; gap: 7px; padding: 10px 14px; border-bottom: 1px solid var(--lla-border); font-size: 13.5px; font-weight: 600; }
.lla-af__body { padding: 10px 14px; font-size: 11px; }
.lla-af__hint { margin-bottom: 8px !important; color: var(--lla-muted); font-size: 10.5px; line-height: 1.45; }
.lla-af__hint strong { color: var(--lla-text); font-weight: 700; }
.lla-af__acad { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; padding: 7px 10px; border: 1px solid var(--lla-border); border-radius: 8px; background: #fafbfc; }
.lla-af__acad > .bi:first-child { color: var(--lla-primary); font-size: 18px; }
.lla-af__acad > span { display: flex; flex: 1; flex-direction: column; }
.lla-af__acad b { font-size: 11px; font-weight: 700; }
.lla-af__acad small { color: var(--lla-muted); font-size: 9.5px; }
.lla-af__lbl { display: block; margin-bottom: 4px; font-size: 10.5px; font-weight: 600; }
.lla-af__lbl--up { margin-top: 10px; color: var(--lla-muted); font-size: 9.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.lla-af__code { display: inline-flex; align-items: center; width: 160px; height: 28px; padding: 0 9px; border: 1px solid #dfe3ea; border-radius: 6px; background: #f8fafd; font-weight: 700; letter-spacing: .04em; }
.lla-af__btns { display: flex; gap: 6px; margin-top: 6px; }
.lla-af__btns > span { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border: 1px solid var(--lla-primary); border-radius: 6px; color: var(--lla-primary); font-size: 10.5px; font-weight: 600; transition: transform .15s var(--lla-ease), background-color .2s, color .2s; }
.lla-af__btns > span.is-pressed { transform: scale(.95); }
.lla-af__c1, .lla-af__c2 { display: inline-flex; align-items: center; gap: 4px; }
.lla-af__c2, .lla-af[data-copied] .lla-af__c1 { display: none; }
.lla-af[data-copied] [data-ref="copy"] { background: var(--lla-primary); color: #fff; }
.lla-af[data-copied] .lla-af__c2 { display: inline-flex; }

.lla-af__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.lla-af__stats > span { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border: 1px solid var(--lla-border); border-radius: 8px; text-align: center; transition: box-shadow .3s, border-color .3s; }
.lla-af__stats b { display: inline-grid; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.lla-af__stats b em { grid-area: 1 / 1; }
.lla-af__stats b em + em, .lla-af[data-reg] .lla-af__stats b em:first-child { visibility: hidden; }
.lla-af[data-reg] .lla-af__stats b em + em { visibility: visible; }
.lla-af__stats small { color: var(--lla-muted); font-size: 9.5px; }
.lla-af[data-paid] .lla-af__pend { border-color: rgba(0, 201, 167, .5); box-shadow: 0 0 0 3px rgba(0, 201, 167, .12); }
.lla-af[data-paid] .lla-af__pend b { color: #00a389; }

.lla-af__refs { margin: 0; padding: 0; list-style: none; }
.lla-af__refs li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid #f1f3f7; }
.lla-af__b { display: none; padding: 2px 7px; border-radius: 5px; color: #fff; font-size: 9.5px; font-weight: 700; white-space: nowrap; }
.lla-af__b--reg { background: #71869d; }
.lla-af__b--ok { background: var(--lla-success); }
.lla-af__b.is-on { display: inline; }
.lla-af__new { display: none !important; }
.lla-af[data-reg] .lla-af__new { display: flex !important; animation: lla-af-in .5s var(--lla-ease) both; }
.lla-af[data-reg]:not([data-paid]) .lla-af__new .lla-af__b--reg, .lla-af[data-paid] .lla-af__new .lla-af__b--ok { display: inline; }
.lla-af[data-paid] .lla-af__new .lla-af__b--ok { animation: lla-af-pop .4s var(--lla-ease); }

/* ---------- Celular (WhatsApp) ---------- */
.lla-af__phone { position: absolute; left: 506px; top: 44px; width: 206px; height: 420px; 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-af__screen { position: relative; display: flex; flex-direction: column; height: 100%; overflow: hidden; border-radius: 29px; background: #efeae2; font-size: 10.5px; }
.lla-af__island { position: absolute; top: 8px; left: 50%; z-index: 5; width: 56px; height: 17px; border-radius: 999px; background: #000; transform: translateX(-50%); }
.lla-af__home { position: absolute; bottom: 6px; left: 50%; width: 36%; height: 4px; border-radius: 999px; background: rgba(0, 0, 0, .85); transform: translateX(-50%); }
.lla-af__wahead { display: flex; align-items: center; gap: 7px; padding: 32px 10px 8px; background: #075e54; color: #fff; }
.lla-af__gav { display: grid; flex: none; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #cfd8dc; color: #607d8b; font-size: 13px; }
.lla-af__wahead > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.lla-af__wahead b { overflow: hidden; font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.lla-af__wahead small { overflow: hidden; color: rgba(255, 255, 255, .75); font-size: 8.5px; text-overflow: ellipsis; white-space: nowrap; }
.lla-af__chat { display: flex; flex: 1; flex-direction: column; justify-content: flex-end; gap: 6px; padding: 8px; }
.lla-af__msg { max-width: 86%; padding: 6px 8px 4px; border-radius: 8px; box-shadow: 0 1px 1px rgba(0, 0, 0, .08); line-height: 1.35; }
.lla-af__msg > small:first-child { display: block; color: #e0912c; font-size: 9px; font-weight: 700; }
.lla-af__msg--in { align-self: flex-start; border-top-left-radius: 2px; background: #fff; }
.lla-af__msg--out { align-self: flex-end; border-top-right-radius: 2px; background: #d9fdd3; }
.lla-af__msg--out > small { display: flex; justify-content: flex-end; gap: 3px; margin-top: 2px; color: #667781; font-size: 8px; }
.lla-af__msg--out > small .bi { color: #53bdeb; }
.lla-af__msg u { color: #027eb5; text-decoration: none; }
.lla-af__prev { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; padding: 5px; border-radius: 6px; background: rgba(0, 0, 0, .05); }
.lla-af__plogo { display: grid; flex: none; place-items: center; width: 24px; height: 24px; border-radius: 5px; background: #0b1220; color: #fff; font-size: 12px; font-weight: 800; }
.lla-af__prev > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.lla-af__prev b { font-size: 9.5px; font-weight: 700; }
.lla-af__prev small { overflow: hidden; color: #667781; font-size: 8.5px; text-overflow: ellipsis; white-space: nowrap; }
.lla-af__msg--out, .lla-af__msg--late { display: none; }
.lla-af[data-sent] .lla-af__msg--out, .lla-af[data-thanks] .lla-af__msg--late { display: block; animation: lla-af-in .4s var(--lla-ease) both; }
.lla-af__wabar { display: flex; align-items: center; gap: 6px; margin: 0 6px 20px; }
.lla-af__wabar span { display: flex; flex: 1; align-items: center; min-height: 26px; overflow: hidden; padding: 4px 10px; border-radius: 999px; background: #fff; font-size: 9.5px; white-space: nowrap; }
.lla-af__wabar .bi { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #00a884; color: #fff; font-size: 11px; transition: transform .15s var(--lla-ease); }
.lla-af__wabar .bi.is-pressed { transform: scale(.88); }

/* ---------- Aviso de comisión ---------- */
.lla-af__toast { position: absolute; left: 286px; top: 0; z-index: 6; display: flex; align-items: center; gap: 8px; padding: 8px 13px 8px 9px; border: 1px solid var(--lla-border); border-radius: 13px; background: #fff; box-shadow: var(--lla-shadow); opacity: 0; transform: translateY(-8px) scale(.96); transition: opacity .4s var(--lla-ease), transform .5s var(--lla-ease); }
.lla-af__toast > span:first-child { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(0, 201, 167, .14); color: #00a389; font-size: 15px; }
.lla-af__toast > span:last-child { display: flex; flex-direction: column; }
.lla-af__toast b { color: #00a389; font-size: 13px; font-weight: 800; }
.lla-af__toast small { color: var(--lla-muted); font-size: 10px; }
.lla-af[data-paid] .lla-af__toast { opacity: 1; transform: none; }
.lla-af[data-fade] .lla-af__toast { opacity: 0; }

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

/* ---------- Angosto ---------- */
@container (max-width: 479px) {
  .lla .lla-af__stage { --lla-w: 510; --lla-h: 960; }
  .lla-af__win { left: 11px; top: 70px; }
  .lla-af__phone { left: 152px; top: 560px; height: 390px; }
  .lla-af__toast { left: 140px; top: 8px; }
}

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