/* ==================================================
   SECURITY LOADER — Capa inmersiva de arranque (estilo XN Protect)
   Modal glassmorphism + túnel hyperspace (canvas) + reveal zoom-out.
   Relacionado con: /js/security-loader.js
   ================================================== */

:root {
  --sc-font: ui-monospace, 'Cascadia Mono', 'JetBrains Mono', 'SF Mono', 'Fira Code', Consolas, monospace;
  --sc-violet: #a78bfa;
  --sc-teal: #22d3ee;
  --sc-text: #dbe0f2;
  --sc-mut: #7c86a6;
  --sc-load-spring: cubic-bezier(0.32, 0.72, 0, 1);
}

#secload {
  position: fixed;
  inset: 0;
  z-index: 99990;
  overflow: hidden;
  background:
    radial-gradient(52% 44% at 50% 46%, rgba(91, 33, 182, 0.16), transparent 70%),
    radial-gradient(120% 90% at 50% 118%, rgba(14, 116, 144, 0.10), transparent 60%),
    linear-gradient(180deg, #04060d 0%, #05070f 55%, #04060d 100%);
  font-family: var(--sc-font);
  color: var(--sc-text);
}

#secload canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
}

/* Bloqueo de scroll mientras la capa de seguridad está activa */
body.sc-lock {
  overflow: hidden;
}

.sc-shell {
  position: relative;
  z-index: 2;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 22px;
  box-sizing: border-box;
}

.sc-card {
  position: relative;
  width: min(440px, 100%);
  padding: 30px 32px 22px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(24, 29, 48, 0.72), rgba(10, 12, 24, 0.55));
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow:
    0 0 0 1px rgba(168, 85, 247, 0.16),
    0 30px 90px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  animation: scCardIn 0.55s var(--sc-load-spring) both;
}

.sc-card-notch {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.sc-card-notch::before,
.sc-card-notch::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-style: solid;
  border-color: rgba(167, 139, 250, 0.55);
}
.sc-card-notch::before {
  top: -1px;
  left: -1px;
  border-width: 2px 0 0 2px;
  border-top-left-radius: 20px;
}
.sc-card-notch::after {
  bottom: -1px;
  right: -1px;
  border-width: 0 2px 2px 0;
  border-bottom-right-radius: 20px;
}

/* Badge de verificación con escudo */
.sc-badge {
  position: relative;
  width: 84px;
  height: 84px;
  margin: 4px auto 16px;
  display: grid;
  place-items: center;
}
.sc-shield {
  width: 46px;
  height: 46px;
  color: #c4b5fd;
  filter: drop-shadow(0 0 10px rgba(167, 139, 250, 0.55));
  transition: color 0.3s ease, filter 0.3s ease;
  animation: scShieldPulse 2.4s ease-in-out infinite;
}
.sc-badge-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px dashed rgba(167, 139, 250, 0.4);
  animation: scSpin 9s linear infinite;
}
.sc-badge-ring::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 1px solid rgba(34, 211, 238, 0.35);
  animation: scRingGrow 2.4s var(--sc-load-spring) infinite;
}
.sc-badge-scan {
  position: absolute;
  left: 12px;
  right: 12px;
  height: 2px;
  top: 8%;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.9), transparent);
  filter: drop-shadow(0 0 6px rgba(34, 211, 238, 0.8));
  animation: scScan 2.2s ease-in-out infinite;
}
#secload.sc-granted .sc-shield {
  color: #6ee7d6;
  filter: drop-shadow(0 0 14px rgba(34, 211, 238, 0.8));
}
#secload.sc-granted .sc-badge-scan { animation-duration: 1.4s; }

/* Cabecera de sistema */
.sc-kicker {
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.34em;
  color: var(--sc-mut);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.sc-kicker .sc-dot { color: var(--sc-teal); }
.sc-kicker .sc-ver { color: var(--sc-violet); }

.sc-title {
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #eef0fb;
}
.sc-title .sc-node { color: var(--sc-violet); }
.sc-cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  margin-left: 6px;
  vertical-align: -2px;
  background: var(--sc-teal);
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.7);
  animation: scBlink 1s steps(1) infinite;
}

/* Secuencia de verificación */
.sc-lines {
  margin: 20px 0 0;
  display: grid;
  gap: 10px;
}
.sc-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--sc-mut);
  opacity: 0.55;
  transform: translateY(6px);
  transition: opacity 0.3s ease, color 0.3s ease, transform 0.3s var(--sc-load-spring);
}
.sc-line .sc-check {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(124, 134, 166, 0.5);
  border-radius: 50%;
  font-size: 10px;
  color: transparent;
  transition: all 0.25s ease;
}
.sc-line .sc-dots {
  margin-left: auto;
  display: inline-flex;
  gap: 3px;
}
.sc-line .sc-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(124, 134, 166, 0.7);
  animation: scDotPulse 1s infinite;
}
.sc-line .sc-dots i:nth-child(2) { animation-delay: 0.15s; }
.sc-line .sc-dots i:nth-child(3) { animation-delay: 0.3s; }

.sc-line.active {
  color: var(--sc-text);
  opacity: 1;
  transform: translateY(0);
}
.sc-line.active .sc-dots i { background: var(--sc-violet); }

.sc-line.done {
  color: #9aa3c0;
  opacity: 0.95;
}
.sc-line.done .sc-check {
  border-color: rgba(34, 211, 238, 0.65);
  background: rgba(34, 211, 238, 0.08);
  color: var(--sc-teal);
}
.sc-line.done .sc-dots { display: none; }

/* Barra de progreso estilo sistema */
.sc-bar {
  display: flex;
  gap: 5px;
  margin-top: 22px;
}
.sc-cell {
  flex: 1;
  height: 7px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.16);
}
.sc-cell.on {
  background: linear-gradient(90deg, var(--sc-violet), var(--sc-teal));
  box-shadow: 0 0 10px rgba(167, 139, 250, 0.55);
  animation: scCellIn 0.18s var(--sc-load-spring);
}

.sc-pct-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--sc-mut);
}
.sc-pct-row #sc-pct { color: var(--sc-teal); font-weight: 700; }
.sc-pct-row .sc-state { text-transform: uppercase; letter-spacing: 0.2em; }
#secload.sc-granted .sc-state {
  color: var(--sc-teal);
  text-shadow: 0 0 12px rgba(34, 211, 238, 0.6);
  animation: scBlinkP 0.8s steps(2) infinite;
}

/* Footer de estado */
.sc-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--sc-mut);
  text-transform: uppercase;
}
.sc-footer b {
  color: #6ee7d6;
  font-weight: 700;
}
.sc-nodefoot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--sc-violet);
}
.sc-nodefoot lord-icon,
.sc-nodefoot .sc-pulse-dot {
  width: 16px;
  height: 16px;
  vertical-align: middle;
}
.sc-nodefoot .sc-pulse-dot {
  border-radius: 50%;
  background: var(--sc-violet);
  box-shadow: 0 0 8px rgba(167, 139, 250, 0.9);
  animation: scDotPulse 1s infinite;
}

/* Reveal final: zoom-out + desaceleración */
#secload.sc-reveal {
  animation: scReveal 0.8s var(--sc-load-spring) forwards;
  pointer-events: none;
}

@keyframes scCardIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
@keyframes scReveal {
  0%   { opacity: 1; transform: scale(1); filter: blur(0); }
  100% { opacity: 0; transform: scale(1.08); filter: blur(7px); }
}
@keyframes scSpin { to { transform: rotate(360deg); } }
@keyframes scRingGrow {
  0%       { transform: scale(0.92); opacity: 0.9; }
  70%, 100% { transform: scale(1.12); opacity: 0; }
}
@keyframes scShieldPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}
@keyframes scScan {
  0%       { top: 8%; opacity: 0.2; }
  25%      { opacity: 1; }
  60%, 100% { top: 88%; opacity: 0.2; }
}
@keyframes scBlink { 50% { opacity: 0; } }
@keyframes scBlinkP { 50% { opacity: 0.35; } }
@keyframes scDotPulse {
  0%, 100% { opacity: 0.4; transform: scale(0.85); }
  50%      { opacity: 1; transform: scale(1); }
}
@keyframes scCellIn {
  from { transform: scaleX(0.4); }
  to   { transform: scaleX(1); }
}

@media (max-width: 560px) {
  .sc-card { padding: 24px 20px 18px; }
  .sc-badge { width: 72px; height: 72px; }
  .sc-shield { width: 40px; height: 40px; }
  .sc-line { font-size: 11.5px; }
  .sc-title { font-size: 15px; }
}