/* ============================================================
   ext-demos.css — demos animadas de las extensiones (ciclo de 9 s)
   Cost Lens: calcula → costo alto (D) → sugerencia → costo bajo (A)
   Comparador: producto → clic en comparar → veredicto con ahorro
   ============================================================ */
.dx { --t: 9s; position: relative; border-radius: 16px; overflow: hidden; background: #0b1020; border: 1px solid rgba(255,255,255,.14); box-shadow: 0 40px 80px -30px rgba(0,0,0,.9); font-size: 14px; text-align: left; }
.dx-bar { display: flex; align-items: center; gap: 6px; padding: 9px 12px; background: #111827; border-bottom: 1px solid rgba(255,255,255,.08); }
.dx-bar i { width: 9px; height: 9px; border-radius: 50%; background: #334155; }
.dx-bar i:nth-child(1) { background: #f87171; } .dx-bar i:nth-child(2) { background: #fbbf24; } .dx-bar i:nth-child(3) { background: #34d399; }
.dx-bar span { margin-left: 8px; font: 500 .72rem/1 var(--font-mono, monospace); color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dx-bar em { margin-left: auto; font-style: normal; font-size: .62rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #64748b; border: 1px solid #334155; padding: 1px 6px; border-radius: 5px; }
.dx-body { position: relative; padding: 16px; min-height: 196px; }

/* ---- Cost Lens ---- */
.dx-cl { box-shadow: 0 40px 80px -30px rgba(0,0,0,.9), 0 0 50px -12px rgba(168,85,247,.55); }
.dx-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.dx-run { padding: 6px 14px; border-radius: 6px; font-weight: 700; font-size: .8rem; color: #fff; background: #1a73e8; }
.dx-pill { position: relative; display: inline-grid; min-width: 172px; height: 30px; border-radius: 999px; background: #fff; color: #0f172a; font-size: .8rem; box-shadow: 0 6px 18px rgba(0,0,0,.4); }
.dx-s { grid-area: 1 / 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; opacity: 0; white-space: nowrap; }
.dx-s b { font-weight: 800; } .dx-s em { font-style: normal; font-weight: 800; padding: 0 6px; border-radius: 5px; }
.g-d { color: #b91c1c; background: #fee2e2; } .g-a { color: #15803d; background: #dcfce7; }
.dx-dot { width: 8px; height: 8px; border-radius: 50%; } .is-red { background: #ef4444; } .is-green { background: #16a34a; }
.dx-spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #c7d2fe; border-top-color: #6366f1; animation: dxSpin .8s linear infinite; }
.dx-s1 { animation: dxS1 var(--t) infinite; } .dx-s2 { animation: dxS2 var(--t) infinite; } .dx-s3 { animation: dxS3 var(--t) infinite; }
@keyframes dxS1 { 0%, 14% { opacity: 1; } 18%, 100% { opacity: 0; } }
@keyframes dxS2 { 0%, 16% { opacity: 0; } 20%, 58% { opacity: 1; } 62%, 100% { opacity: 0; } }
@keyframes dxS3 { 0%, 60% { opacity: 0; } 64%, 96% { opacity: 1; } 100% { opacity: 0; } }
@keyframes dxSpin { to { transform: rotate(360deg); } }
.dx-code { margin: 0; padding: 12px 14px; border-radius: 10px; background: #020617; color: #e2e8f0; font: 500 .82rem/1.7 var(--font-mono, monospace); white-space: pre; overflow: hidden; }
.dx-code .k { color: #c084fc; } .dx-code .s { color: #86efac; }
.dx-star { display: inline-block; color: #fca5a5; animation: dxStar var(--t) infinite; }
.dx-cols { display: inline-block; max-width: 0; overflow: hidden; vertical-align: bottom; color: #67e8f9; white-space: nowrap; animation: dxCols var(--t) infinite; }
@keyframes dxStar { 0%, 56% { opacity: 1; max-width: 1ch; } 60%, 96% { opacity: 0; max-width: 0; } 100% { opacity: 1; } }
@keyframes dxCols { 0%, 57% { max-width: 0; } 63%, 96% { max-width: 20ch; } 100% { max-width: 0; } }
.dx-toast { position: absolute; right: 14px; bottom: 14px; display: flex; gap: 10px; align-items: center; max-width: 82%; padding: 10px 14px; border-radius: 12px; color: #fff; background: linear-gradient(90deg, #22d3ee, #6366f1 55%, #a855f7); box-shadow: 0 14px 30px -8px rgba(99,102,241,.7); opacity: 0; transform: translateY(10px); animation: dxToast var(--t) infinite; }
.dx-toast b { display: block; font-size: .86rem; } .dx-toast small { display: block; font-size: .74rem; opacity: .9; }
@keyframes dxToast { 0%, 30% { opacity: 0; transform: translateY(10px); } 34%, 58% { opacity: 1; transform: none; } 62%, 100% { opacity: 0; transform: translateY(10px); } }

/* ---- Comparador ---- */
.dx-cp { box-shadow: 0 40px 80px -30px rgba(0,0,0,.9), 0 0 50px -12px rgba(52,211,153,.5); }
.dx-product { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: start; background: #f8fafc; color: #0f172a; }
.dx-ph { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; border-radius: 12px; font-size: 2.4rem; color: #475569; background: linear-gradient(135deg, #e2e8f0, #cbd5e1); }
.dx-info small { display: block; font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #64748b; }
.dx-info b { display: block; margin: 2px 0 6px; font-size: .95rem; line-height: 1.3; }
.dx-price { display: block; font-size: 1.35rem; font-weight: 800; animation: dxStrike var(--t) infinite; }
@keyframes dxStrike { 0%, 46% { color: #0f172a; text-decoration: none; } 50%, 96% { color: #94a3b8; text-decoration: line-through; text-decoration-color: #ef4444; } 100% { color: #0f172a; } }
.dx-btn { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 7px 12px; border-radius: 8px; font-size: .78rem; font-weight: 700; color: #fff; background: #7c3aed; animation: dxPress var(--t) infinite; }
@keyframes dxPress { 0%, 22% { transform: none; box-shadow: 0 0 0 0 rgba(124,58,237,.6); } 26% { transform: scale(.94); box-shadow: 0 0 0 8px rgba(124,58,237,.15); } 30%, 100% { transform: none; box-shadow: 0 0 0 0 rgba(124,58,237,0); } }
.dx-verdict { position: absolute; right: 14px; bottom: 14px; width: min(230px, 60%); padding: 12px 14px; border-radius: 14px; color: #fff; background: #0b1020; border: 1px solid rgba(52,211,153,.5); box-shadow: 0 18px 36px -10px rgba(0,0,0,.6); opacity: 0; transform: translateY(12px) scale(.96); animation: dxVerdict var(--t) infinite; }
.dx-verdict small { font-size: .66rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #94a3b8; }
.dx-v-row { display: flex; justify-content: space-between; align-items: baseline; margin: 4px 0 8px; }
.dx-v-row span { font-size: .84rem; color: #cbd5e1; } .dx-v-row b { font-size: 1.3rem; color: #6ee7b7; }
.dx-save { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 800; color: #052e1f; background: linear-gradient(90deg, #34d399, #a3e635); }
@keyframes dxVerdict { 0%, 32% { opacity: 0; transform: translateY(12px) scale(.96); } 38%, 94% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* Pila de dos demos: Cost Lens arriba a la derecha, comparador abajo a la
   izquierda, solapados apenas en el borde para que ambos se lean completos. */
.dx-stack { position: relative; display: grid; }
.dx-stack .dx-cl { width: 88%; margin-left: auto; }
.dx-stack .dx-cl .dx-body { min-height: 0; padding-bottom: 70px; }
.dx-stack .dx-cp { width: 84%; margin-top: -54px; z-index: 2; }
.dx-stack .dx-cp .dx-body { min-height: 150px; }
.dx-stack .dx-cp .dx-verdict, .dx-stack .dx-cp .dx-price, .dx-stack .dx-cp .dx-btn { animation-delay: 1.2s; }

@media (max-width: 560px) {
    .dx { font-size: 13px; }
    .dx-stack .dx-cl { width: 100%; }
    .dx-stack .dx-cp { width: 94%; margin-top: -40px; }
    .dx-product { grid-template-columns: 70px 1fr; }
    .dx-pill { min-width: 150px; }
}
@media (prefers-reduced-motion: reduce) {
    .dx *, .dx *::before { animation: none !important; }
    .dx-s1, .dx-s3 { opacity: 0; } .dx-s2 { opacity: 1; }
    .dx-toast, .dx-verdict { opacity: 1; transform: none; }
    .dx-cols { max-width: 0; }
}
.dx-note { margin: 14px 0 0; font-size: .76rem; color: #64748b; text-align: center; }
.dx-stack .dx-cl .dx-body { padding-bottom: 118px; }
.dx-stack .dx-cl .dx-toast { bottom: 64px; }
@media (max-width: 560px) { .dx-stack .dx-cl .dx-body { padding-bottom: 104px; } .dx-stack .dx-cl .dx-toast { bottom: 50px; max-width: 92%; } }
@media (max-width: 560px) {
    .dx-verdict { position: relative; right: auto; bottom: auto; width: auto; grid-column: 1 / -1; margin-top: 4px; }
    .dx-stack .dx-cp { margin-top: -40px; }
}
