/* boot.css — pantalla de arranque (readiness). Compartida por el dashboard de
   escritorio y el móvil (/mobile). Port del hermano (15-boot.css). Cada token
   tiene fallback: el escritorio define --jv-*, el móvil --bg-0/--hud-*; sin
   ninguno de los dos, los literales del tema oscuro por defecto. */

.boot-screen {
  --b-bg: var(--jv-bg, var(--bg-0, #080c1a));
  --b-panel: var(--jv-surface, var(--bg-1, #0f1428));
  --b-border: var(--jv-border, rgba(0, 229, 255, 0.22));
  --b-text: var(--jv-text, var(--hud-text, #e4f7fe));
  --b-dim: var(--jv-text-2, var(--hud-text-dim, rgba(228, 247, 254, 0.6)));
  --b-accent: var(--jv-accent, var(--hud-cyan, #00e5ff));
  --b-ok: var(--jv-ok, #3ddc84);
  --b-warn: var(--jv-warn, #ffb454);
  --b-err: var(--jv-err, var(--hud-red, #ff3b6b));
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--b-text);
  font-family: inherit;
  background: color-mix(in srgb, var(--b-bg) 82%, transparent);
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  opacity: 1;
  transition: opacity .42s ease, transform .42s ease;
  animation: boot-veil-in .4s ease both;
}
.boot-screen[hidden] { display: none; }
.boot-screen.boot-leaving { opacity: 0; transform: scale(1.02); pointer-events: none; }
@keyframes boot-veil-in { from { opacity: 0; } to { opacity: 1; } }

.boot-card {
  position: relative;
  width: min(520px, 100%);
  max-height: calc(100vh - 48px);
  overflow: hidden auto;
  padding: 22px 24px 14px;
  background: var(--b-panel);
  border: 1px solid var(--b-border);
  border-radius: 14px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .45);
  animation: boot-card-in .5s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes boot-card-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
.boot-card::before {
  content: '';
  position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--b-accent), transparent);
  background-size: 200% 100%;
  animation: boot-sweep 2.4s linear infinite;
}
.boot-screen:not([data-phase="booting"]) .boot-card::before { animation: none; background: var(--b-accent); }
@keyframes boot-sweep { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.boot-head { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; align-items: end; margin-bottom: 12px; }
.boot-ring { grid-row: 1 / span 2; width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--b-border); position: relative; }
.boot-ring::before, .boot-ring::after {
  content: ''; position: absolute; inset: -1.5px; border-radius: 50%;
  border: 1.5px solid transparent; border-top-color: var(--b-accent);
}
.boot-ring::before { animation: boot-spin 1.6s linear infinite; }
.boot-ring::after  { inset: 6px; animation: boot-spin 2.6s linear infinite reverse; }
@keyframes boot-spin { to { transform: rotate(360deg); } }
.boot-screen[data-phase="ready"] .boot-ring::before, .boot-screen[data-phase="ready"] .boot-ring::after { animation: none; border-color: var(--b-ok); }
.boot-screen[data-phase="degraded"] .boot-ring::before, .boot-screen[data-phase="degraded"] .boot-ring::after { animation: none; border-color: var(--b-warn); }

.boot-phase { font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: 14px; color: var(--b-accent); }
.boot-screen[data-phase="ready"] .boot-phase { color: var(--b-ok); }
.boot-screen[data-phase="degraded"] .boot-phase { color: var(--b-warn); }
.boot-sub { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--b-dim); }

.boot-progress { height: 2px; margin: 0 0 12px; background: var(--b-border); overflow: hidden; }
.boot-progress > i { display: block; height: 100%; width: 0; background: var(--b-accent); transition: width .45s cubic-bezier(.2,.8,.2,1); }
.boot-screen[data-phase="ready"] .boot-progress > i { background: var(--b-ok); }
.boot-screen[data-phase="degraded"] .boot-progress > i { background: var(--b-warn); }

.boot-modules { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.boot-row {
  display: grid; grid-template-columns: 14px minmax(110px, auto) 1fr auto; gap: 10px; align-items: center;
  padding: 6px 8px; border-left: 2px solid transparent; font-size: 13.5px;
  animation: boot-row-in .45s ease both; animation-delay: calc(var(--i, 0) * 45ms);
}
@keyframes boot-row-in { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
.boot-row.boot-critical + .boot-row:not(.boot-critical) { margin-top: 8px; position: relative; }
.boot-row.boot-critical + .boot-row:not(.boot-critical)::before { content: ''; position: absolute; left: 8px; right: 8px; top: -5px; border-top: 1px dashed var(--b-border); }
.boot-row:not(.boot-critical) { color: var(--b-dim); }
.boot-name { font-weight: 600; letter-spacing: .02em; }
.boot-detail { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px; color: var(--b-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.boot-state { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--b-dim); }

.boot-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--b-dim); justify-self: center; }
.boot-row[data-state="pending"] .boot-dot { background: var(--b-accent); animation: boot-pulse 1.1s ease-in-out infinite; }
.boot-row[data-state="pending"] .boot-state { color: var(--b-accent); }
.boot-row[data-state="ok"] .boot-dot { background: var(--b-ok); }
.boot-row[data-state="ok"] .boot-state { color: var(--b-ok); }
.boot-row[data-state="failed"] { border-left-color: var(--b-err); background: color-mix(in srgb, var(--b-err) 10%, transparent); }
.boot-row[data-state="failed"] .boot-dot { background: var(--b-err); }
.boot-row[data-state="failed"] .boot-state, .boot-row[data-state="failed"] .boot-detail { color: var(--b-err); }
.boot-row[data-state="off"] { opacity: .55; }
@keyframes boot-pulse { 0%, 100% { transform: scale(.75); opacity: .55; } 50% { transform: scale(1.15); opacity: 1; } }
.boot-row.boot-flip .boot-dot { animation: boot-flip .5s ease; }
@keyframes boot-flip { 0% { transform: scale(1); } 40% { transform: scale(1.9); } 100% { transform: scale(1); } }

.boot-foot { display: flex; justify-content: flex-end; align-items: center; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--b-border); }
.boot-dismiss {
  background: transparent; color: var(--b-dim); border: 1px solid var(--b-border); border-radius: 999px;
  padding: 6px 12px; font: inherit; font-size: 12.5px; letter-spacing: .04em; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.boot-dismiss:hover { color: var(--b-text); border-color: var(--b-accent); }

.boot-banner {
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 8000;
  display: flex; align-items: center; gap: 10px; max-width: min(900px, calc(100vw - 32px));
  padding: 8px 12px; background: var(--jv-surface, var(--bg-1, #0f1428));
  border: 1px solid var(--jv-warn, #ffb454); border-radius: 10px;
  color: var(--jv-text, var(--hud-text, #e4f7fe)); font-size: 13px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .4);
}
.boot-banner[hidden] { display: none; }
.boot-banner-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.boot-banner-close { background: none; border: 0; color: inherit; opacity: .7; font-size: 16px; cursor: pointer; line-height: 1; }

@media (max-width: 600px) {
  .boot-screen { padding: 12px; align-items: flex-end; padding-bottom: calc(12px + var(--safe-bottom, 0px)); }
  .boot-card { padding: 16px 14px 10px; max-height: calc(100dvh - 24px); }
  .boot-row { grid-template-columns: 12px 1fr auto; gap: 6px 8px; font-size: 13px; padding: 5px 6px; }
  .boot-detail { display: none; }
  .boot-state { grid-column: 3; grid-row: 1; }
  .boot-row[data-state="failed"] .boot-detail { display: block; grid-column: 2 / -1; grid-row: 2; white-space: normal; }
  .boot-banner { top: auto; bottom: calc(84px + var(--safe-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) {
  .boot-screen, .boot-card, .boot-row, .boot-banner { animation: none; }
  .boot-card::before, .boot-ring::before, .boot-ring::after, .boot-dot { animation: none !important; }
}
