/* Base común de las demos de QA Control.
   Cada demo define su propia marca ficticia sobre estos tokens (--acento, --fondo…);
   la barra superior de demo siempre usa la identidad de QA Control. */

:root {
  --qa-fondo: #080A0D;
  --qa-panel: #0D1117;
  --qa-borde: rgba(255, 255, 255, .08);
  --qa-texto: #FFFFFF;
  --qa-suave: #98A2B3;
  --qa-azul: #3B82F6;
  --qa-azul-2: #2563EB;
  --qa-cian: #22D3EE;

  /* Tokens que cada demo puede sobrescribir */
  --fondo: #0B0E13;
  --superficie: #11161E;
  --superficie-2: #161C26;
  --borde: rgba(255, 255, 255, .08);
  --texto: #F4F6FA;
  --suave: #98A2B3;
  --tenue: #5E6878;
  --acento: #3B82F6;
  --acento-2: #22D3EE;
  --acento-texto: #FFFFFF;
  --ok: #22C55E;
  --aviso: #F59E0B;
  --error: #F97066;
  --radio: 12px;
  --sombra: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 12px 32px -12px rgba(0, 0, 0, .6);
  --sk-base: rgba(255, 255, 255, .06);
  --sk-brillo: rgba(255, 255, 255, .12);
  --barra-alto: 52px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --fuente: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  color-scheme: dark;
}

/* Demos con tema claro: <body class="claro"> */
body.claro {
  --fondo: #F6F7F9;
  --superficie: #FFFFFF;
  --superficie-2: #F1F3F6;
  --borde: rgba(15, 23, 42, .09);
  --texto: #0F172A;
  --suave: #475467;
  --tenue: #98A2B3;
  --sombra: 0 1px 2px rgba(15, 23, 42, .05), 0 12px 32px -16px rgba(15, 23, 42, .18);
  --sk-base: rgba(15, 23, 42, .06);
  --sk-brillo: rgba(15, 23, 42, .11);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--fondo);
  color: var(--texto);
  font-family: var(--fuente);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-top: var(--barra-alto);
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.03em; line-height: 1.1; text-wrap: balance; }
p { margin: 0; }
::selection { background: color-mix(in srgb, var(--acento) 35%, transparent); }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
.oculto { display: none !important; }

/* ── Barra de demo (identidad QA Control) ─────────────────────────────── */
.qa-barra {
  position: fixed; inset: 0 0 auto 0; z-index: 1000;
  height: var(--barra-alto);
  display: flex; align-items: center; gap: 12px;
  padding: 0 max(16px, env(safe-area-inset-left)) 0 max(16px, env(safe-area-inset-right));
  background: rgba(8, 10, 13, .82);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--qa-borde);
  color: var(--qa-texto);
  font-family: var(--fuente);
  font-size: 14px;
  animation: qa-bajar .5s var(--ease) both;
}
.qa-barra a { text-decoration: none; }
.qa-volver { display: flex; align-items: center; gap: 8px; color: var(--qa-suave); white-space: nowrap; transition: color .15s; }
.qa-volver:hover { color: #fff; }
.qa-logo { display: flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: -.02em; color: #fff; }
.qa-logo svg { width: 20px; height: 20px; }
.qa-sep { width: 1px; height: 20px; background: var(--qa-borde); flex: none; }
.qa-titulo { display: flex; align-items: center; gap: 10px; min-width: 0; }
.qa-chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--qa-cian); padding: 3px 8px; border-radius: 999px;
  background: rgba(34, 211, 238, .08); box-shadow: inset 0 0 0 1px rgba(34, 211, 238, .25);
}
.qa-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: qa-latido 1.6s ease-in-out infinite; }
.qa-nombre { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qa-nota { color: var(--qa-suave); white-space: nowrap; font-size: 13px; }
.qa-acciones { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.qa-precio { font-family: var(--mono); font-size: 12.5px; color: var(--qa-suave); white-space: nowrap; }
.qa-cta {
  height: 34px; padding: 0 14px; display: inline-flex; align-items: center; gap: 6px;
  border-radius: 8px; background: linear-gradient(180deg, var(--qa-azul), var(--qa-azul-2));
  color: #fff; font-weight: 500; white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 0 0 1px rgba(59, 130, 246, .5);
  transition: transform .2s var(--ease), box-shadow .2s;
}
.qa-cta:hover { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 0 0 1px rgba(96, 165, 250, .8), 0 8px 24px -8px rgba(37, 99, 235, .8); }
.qa-progreso { position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: linear-gradient(90deg, var(--qa-azul), var(--qa-cian)); transition: width .1s linear; }
@media (max-width: 860px) { .qa-nota, .qa-precio { display: none; } }
@media (max-width: 560px) { .qa-logo span, .qa-sep:first-of-type { display: none; } .qa-cta .largo { display: none; } }

/* ── Skeletons ─────────────────────────────────────────────────────────── */
.sk {
  position: relative; overflow: hidden; border-radius: 8px;
  background: var(--sk-base);
  color: transparent !important; user-select: none; pointer-events: none;
}
.sk::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--sk-brillo), transparent);
  animation: qa-brillo 1.3s ease-in-out infinite;
}
.sk-linea { height: 12px; border-radius: 6px; }
.sk-linea.corta { width: 40%; }
.sk-linea.media { width: 65%; }
.sk-titulo { height: 22px; width: 55%; border-radius: 7px; }
.sk-circulo { border-radius: 50%; }
.sk-bloque { height: 120px; }
.sk-grupo { display: grid; gap: 10px; }

/* ── Componentes comunes ──────────────────────────────────────────────── */
.btn {
  height: 40px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 10px; border: 1px solid var(--borde); background: var(--superficie-2); color: var(--texto);
  font-weight: 500; font-size: 14px; white-space: nowrap; text-decoration: none;
  transition: transform .18s var(--ease), background .18s, border-color .18s, box-shadow .18s;
}
.btn:hover { border-color: color-mix(in srgb, var(--texto) 22%, transparent); }
.btn:active { transform: scale(.97); }
.btn.primario { background: var(--acento); border-color: transparent; color: var(--acento-texto); box-shadow: 0 6px 20px -8px var(--acento); }
.btn.primario:hover { filter: brightness(1.08); box-shadow: 0 10px 28px -10px var(--acento); }
.btn.fantasma { background: transparent; }
.btn.chico { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn .giro { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: qa-girar .7s linear infinite; }

.tarjeta { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); }
.etiqueta { font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--tenue); }
.pastilla {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  background: color-mix(in srgb, var(--c, var(--acento)) 14%, transparent);
  color: var(--c, var(--acento));
}
.campo { display: grid; gap: 6px; }
.campo > span { font-size: 13px; color: var(--suave); }
.entrada {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 10px;
  background: var(--superficie-2); border: 1px solid var(--borde); color: var(--texto);
  transition: border-color .15s, box-shadow .15s;
}
textarea.entrada { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; }
.entrada:focus { outline: none; border-color: var(--acento); box-shadow: 0 0 0 3px color-mix(in srgb, var(--acento) 25%, transparent); }
.entrada.mal { border-color: var(--error); animation: qa-sacudir .35s; }
.icono { width: 18px; height: 18px; flex: none; }

/* Avisos (toasts) */
.qa-avisos { position: fixed; z-index: 1100; right: 16px; bottom: 16px; display: grid; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.qa-aviso {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
  background: #0F141C; color: #F4F6FA; border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .7); font-size: 14px;
  animation: qa-entrar-aviso .45s var(--ease) both;
}
.qa-aviso.sale { animation: qa-salir-aviso .3s ease-in both; }
.qa-aviso .icono { color: var(--c, var(--qa-cian)); margin-top: 1px; }

/* Diálogo */
.qa-velo { position: fixed; inset: 0; z-index: 1050; display: grid; place-items: center; padding: 16px; background: rgba(4, 6, 9, .6); backdrop-filter: blur(6px); animation: qa-aparecer .25s ease both; }
.qa-dialogo { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--superficie); color: var(--texto); border: 1px solid var(--borde); border-radius: 16px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7); animation: qa-pop .35s var(--ease) both; }
.qa-velo.sale { animation: qa-desaparecer .2s ease both; }

/* ── Animaciones ──────────────────────────────────────────────────────── */
[data-r] { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease), transform .6s var(--ease); transition-delay: var(--d, 0ms); }
[data-r].visto { opacity: 1; transform: none; }
.entra { animation: qa-subir .55s var(--ease) both; animation-delay: var(--d, 0ms); }
.escalonado > * { animation: qa-subir .5s var(--ease) both; }
.escalonado > *:nth-child(1) { animation-delay: 0ms; }
.escalonado > *:nth-child(2) { animation-delay: 50ms; }
.escalonado > *:nth-child(3) { animation-delay: 100ms; }
.escalonado > *:nth-child(4) { animation-delay: 150ms; }
.escalonado > *:nth-child(5) { animation-delay: 200ms; }
.escalonado > *:nth-child(6) { animation-delay: 250ms; }
.escalonado > *:nth-child(7) { animation-delay: 300ms; }
.escalonado > *:nth-child(8) { animation-delay: 350ms; }
.escalonado > *:nth-child(n+9) { animation-delay: 400ms; }

@keyframes qa-brillo { to { transform: translateX(100%); } }
@keyframes qa-subir { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes qa-bajar { from { opacity: 0; transform: translateY(-100%); } to { opacity: 1; transform: none; } }
@keyframes qa-aparecer { from { opacity: 0; } to { opacity: 1; } }
@keyframes qa-desaparecer { to { opacity: 0; } }
@keyframes qa-pop { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes qa-latido { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes qa-girar { to { transform: rotate(360deg); } }
@keyframes qa-sacudir { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
@keyframes qa-entrar-aviso { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes qa-salir-aviso { to { opacity: 0; transform: translateX(24px); } }
@keyframes qa-resaltar { from { background: color-mix(in srgb, var(--acento) 18%, transparent); } to { background: transparent; } }
.resaltado { animation: qa-resaltar 1.4s ease-out; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  [data-r] { opacity: 1; transform: none; }
}

/* ── Firma «Desarrollado por qacontrol.mx» ────────────────────────────── */
.qa-pie { display: flex; justify-content: center; padding: 40px 16px calc(28px + env(safe-area-inset-bottom)); }
.qa-firma {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 999px;
  font-size: 12.5px; color: var(--suave); text-decoration: none;
  border: 1px solid var(--borde); background: color-mix(in srgb, var(--superficie) 70%, transparent);
  transition: color .2s, border-color .2s, transform .2s var(--ease);
}
.qa-firma svg { width: 14px; height: 14px; }
.qa-firma strong { font-weight: 600; color: var(--texto); letter-spacing: -.01em; }
.qa-firma:hover { color: var(--texto); border-color: color-mix(in srgb, var(--qa-azul) 60%, transparent); transform: translateY(-1px); }
body.claro .qa-firma svg circle { stroke: #0F172A; }
.volteado { transform: scaleX(-1); }
.qa-cta .corto:empty { display: none; }
