/* SnapVault — sistema de diseño glass (rama feature/frontend-redesign).
 *
 * Lenguaje de los artes conceptuales de Angel: glassmorphism (cristal,
 * blur, bordes suaves), gradientes azul/violeta, tipografía Inter, modo
 * claro y modo oscuro con interruptor funcional. Un solo archivo de
 * tokens: el resto del CSS hereda estas variables; los valores sueltos
 * de la paleta vieja (cian neón, Orbitron) quedan fuera de las pantallas
 * nuevas y solo sobreviven como alias para no romper el CSS viejo que
 * aún se carga en el dashboard.
 *
 * Textos honestos: ningún texto de este archivo promete almacenamiento
 * ilimitado, seguridad de grado militar ni validez legal del Baúl sin
 * notario. Los límites reales viven en PLAN_QUOTAS (js) y en la tabla
 * de planes de la landing.
 */

/* ---------- Tokens ---------- */
:root {
  --sv-font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --sv-accent: #5b5ff0;
  --sv-accent-2: #8b5cf6;
  --sv-accent-grad: linear-gradient(135deg, #3b82f6 0%, #7c5cf0 55%, #a855f7 100%);
  --sv-ok: #16a34a;
  --sv-warn: #d97706;
  --sv-danger: #dc2626;
  --sv-radius: 18px;
  --sv-radius-sm: 12px;
  --sv-shadow: 0 12px 40px rgba(30, 30, 90, 0.18);
  /* Alias de compatibilidad con el CSS viejo (base/layout/discover). */
  --neon-blue: #5b5ff0;
  --neon-green: #16a34a;
  --neon-red: #dc2626;
  --electric-violet: #8b5cf6;
}

html[data-theme="light"] {
  color-scheme: light;
  --sv-bg: #eef2fb;
  --sv-bg-blob-1: rgba(96, 165, 250, 0.55);
  --sv-bg-blob-2: rgba(168, 85, 247, 0.45);
  --sv-bg-blob-3: rgba(56, 189, 248, 0.35);
  --sv-surface: rgba(255, 255, 255, 0.62);
  --sv-surface-solid: #ffffff;
  --sv-surface-2: rgba(255, 255, 255, 0.4);
  --sv-text: #131a2e;
  --sv-muted: rgba(19, 26, 46, 0.68);
  --sv-faint: rgba(19, 26, 46, 0.5);
  --sv-border: rgba(255, 255, 255, 0.75);
  --sv-border-strong: rgba(91, 95, 240, 0.35);
  --sv-input-bg: rgba(255, 255, 255, 0.85);
  --sv-hover: rgba(91, 95, 240, 0.10);
  --sv-nav-active: rgba(91, 95, 240, 0.16);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --sv-bg: #070b1d;
  --sv-bg-blob-1: rgba(37, 99, 235, 0.5);
  --sv-bg-blob-2: rgba(139, 92, 246, 0.45);
  --sv-bg-blob-3: rgba(14, 165, 233, 0.3);
  --sv-surface: rgba(17, 24, 48, 0.62);
  --sv-surface-solid: #111830;
  --sv-surface-2: rgba(255, 255, 255, 0.06);
  --sv-text: #eef1fb;
  --sv-muted: rgba(238, 241, 251, 0.72);
  --sv-faint: rgba(238, 241, 251, 0.52);
  --sv-border: rgba(255, 255, 255, 0.16);
  --sv-border-strong: rgba(139, 92, 246, 0.5);
  --sv-input-bg: rgba(255, 255, 255, 0.08);
  --sv-hover: rgba(139, 92, 246, 0.16);
  --sv-nav-active: rgba(139, 92, 246, 0.28);
  --sv-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.sv-glass {
  margin: 0;
  font-family: var(--sv-font);
  background: var(--sv-bg);
  color: var(--sv-text);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
/* Blobs de fondo (los gradientes azul/violeta de los artes). */
body.sv-glass::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(560px 420px at 12% -5%, var(--sv-bg-blob-1), transparent 70%),
    radial-gradient(620px 480px at 95% 8%, var(--sv-bg-blob-2), transparent 70%),
    radial-gradient(520px 420px at 55% 110%, var(--sv-bg-blob-3), transparent 70%);
}
body.sv-glass h1, body.sv-glass h2, body.sv-glass h3 {
  font-family: var(--sv-font);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 0.4em;
}
body.sv-glass p { margin: 0 0 0.75em; }
body.sv-glass a { color: var(--sv-accent); }
body.sv-glass :focus-visible {
  outline: 3px solid var(--sv-accent-2);
  outline-offset: 2px;
  border-radius: 6px;
}
body.sv-glass button, body.sv-glass input, body.sv-glass select, body.sv-glass textarea {
  font-family: var(--sv-font);
  font-size: 1rem;
}

/* ---------- Cristal ---------- */
.sv-glass-card {
  background: var(--sv-surface);
  border: 1px solid var(--sv-border);
  border-radius: var(--sv-radius);
  box-shadow: var(--sv-shadow);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  padding: 20px;
}
.sv-glass-card h2 { font-size: 1.15rem; }
.sv-muted { color: var(--sv-muted); }
.sv-small { font-size: 0.85rem; }
.sv-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }

/* ---------- Botones ---------- */
.sv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.sv-btn:hover { transform: translateY(-1px); }
.sv-btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.sv-btn-primary {
  background: var(--sv-accent-grad);
  color: #fff;
  box-shadow: 0 6px 20px rgba(91, 95, 240, 0.45);
}
.sv-btn-secondary {
  background: var(--sv-surface-2);
  color: var(--sv-text);
  border-color: var(--sv-border-strong);
}
.sv-btn-danger {
  background: transparent;
  color: var(--sv-danger);
  border-color: var(--sv-danger);
}
.sv-btn-block { width: 100%; }
.sv-btn[disabled] { pointer-events: none; }

/* ---------- Formularios (con <label> visible, nunca solo placeholder) ---------- */
.sv-field { margin: 0 0 14px; }
.sv-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 5px;
}
.sv-field .sv-hint { font-size: 0.8rem; color: var(--sv-muted); margin-top: 4px; }
.sv-input, .sv-select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--sv-radius-sm);
  border: 1px solid var(--sv-border-strong);
  background: var(--sv-input-bg);
  color: var(--sv-text);
}
.sv-input::placeholder { color: var(--sv-faint); }
.sv-check { display: flex; align-items: flex-start; gap: 8px; font-size: 0.9rem; margin: 6px 0; }
.sv-check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--sv-accent); }
.sv-error { color: var(--sv-danger); font-size: 0.85rem; }
.sv-ok-text { color: var(--sv-ok); font-size: 0.85rem; }

/* ---------- Etiquetas de estado ---------- */
.sv-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--sv-nav-active);
  color: var(--sv-text);
  border: 1px solid var(--sv-border-strong);
}
.sv-badge-warn { background: rgba(217, 119, 6, 0.18); border-color: rgba(217, 119, 6, 0.5); }
.sv-badge-danger { background: rgba(220, 38, 38, 0.16); border-color: rgba(220, 38, 38, 0.5); }
.sv-badge-ok { background: rgba(22, 163, 74, 0.16); border-color: rgba(22, 163, 74, 0.5); }
.sv-mode-banner {
  border-radius: var(--sv-radius-sm);
  padding: 12px 14px;
  font-size: 0.9rem;
  margin: 0 0 16px;
  background: rgba(217, 119, 6, 0.12);
  border: 1px solid rgba(217, 119, 6, 0.45);
}

/* ---------- Medidor de espacio ---------- */
.sv-meter { margin: 10px 0; }
.sv-meter-track {
  height: 10px;
  border-radius: 999px;
  background: var(--sv-surface-2);
  border: 1px solid var(--sv-border);
  overflow: hidden;
}
.sv-meter-fill {
  height: 100%;
  background: var(--sv-accent-grad);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.sv-meter-label { font-size: 0.8rem; color: var(--sv-muted); display: flex; justify-content: space-between; }

/* ---------- Toast + modal propio (sustituyen alert()/confirm()) ---------- */
#sv-toasts {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(480px, calc(100vw - 32px));
}
.sv-toast {
  background: var(--sv-surface-solid);
  color: var(--sv-text);
  border: 1px solid var(--sv-border-strong);
  border-radius: var(--sv-radius-sm);
  box-shadow: var(--sv-shadow);
  padding: 12px 16px;
  font-size: 0.9rem;
}
.sv-toast-error { border-color: var(--sv-danger); }
.sv-toast-success { border-color: var(--sv-ok); }
.sv-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(5, 8, 25, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.sv-modal {
  background: var(--sv-surface-solid);
  color: var(--sv-text);
  border: 1px solid var(--sv-border-strong);
  border-radius: var(--sv-radius);
  box-shadow: var(--sv-shadow);
  padding: 22px;
  width: min(480px, 100%);
}
.sv-modal h2 { font-size: 1.1rem; }
.sv-modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* ---------- Landing ---------- */
.sv-landing { max-width: 1080px; margin: 0 auto; padding: 0 16px 64px; }
.sv-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 4px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.sv-topbar .sv-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; text-decoration: none; color: var(--sv-text); }
.sv-topbar .sv-brand img { width: 36px; height: 36px; border-radius: 10px; }
.sv-topbar nav { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sv-topbar nav a { color: var(--sv-text); text-decoration: none; font-size: 0.9rem; padding: 8px 10px; border-radius: 999px; }
.sv-topbar nav a:hover { background: var(--sv-hover); }
.sv-hero { text-align: center; padding: 48px 16px 32px; }
.sv-hero h1 { font-size: clamp(2rem, 5.5vw, 3.4rem); font-weight: 800; }
.sv-hero .sv-tagline { font-size: 1.15rem; color: var(--sv-muted); }
.sv-hero .sv-grad-text {
  background: var(--sv-accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.sv-hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.sv-section { margin-top: 40px; }
.sv-section > h2 { font-size: 1.5rem; text-align: center; margin-bottom: 6px; }
.sv-section > .sv-lede { text-align: center; color: var(--sv-muted); max-width: 640px; margin: 0 auto 20px; }
.sv-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.sv-plan-price { font-size: 1.8rem; font-weight: 800; }
.sv-plan-price s { font-size: 1rem; color: var(--sv-muted); font-weight: 400; }
.sv-plan-list { list-style: none; padding: 0; margin: 12px 0; font-size: 0.92rem; }
.sv-plan-list li { padding: 4px 0; }
.sv-plan-list li::before { content: "✓ "; color: var(--sv-ok); font-weight: 700; }
.sv-auth-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.sv-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.sv-tab {
  flex: 1; min-height: 44px; border-radius: 999px; border: 1px solid var(--sv-border-strong);
  background: transparent; color: var(--sv-text); font-weight: 600; cursor: pointer;
}
.sv-tab.active { background: var(--sv-accent-grad); color: #fff; border-color: transparent; }
.sv-form-content { display: none; }
.sv-form-content.active { display: block; }
.sv-social-row { display: grid; gap: 10px; margin-top: 14px; }
.sv-social-btn { width: 100%; min-height: 44px; border-radius: 999px; border: 1px dashed var(--sv-border-strong); background: transparent; color: var(--sv-muted); font-weight: 600; cursor: not-allowed; }
.sv-faq details { border: 1px solid var(--sv-border); border-radius: var(--sv-radius-sm); padding: 12px 14px; margin: 8px 0; background: var(--sv-surface); }
.sv-faq summary { cursor: pointer; font-weight: 600; min-height: 24px; }
.sv-footer { text-align: center; color: var(--sv-muted); font-size: 0.85rem; margin-top: 48px; }

/* ---------- Dashboard ---------- */
.sv-dash { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sv-sidebar {
  padding: 18px 12px;
  border-right: 1px solid var(--sv-border);
  background: var(--sv-surface);
  backdrop-filter: blur(18px) saturate(1.3);
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sv-sidebar .sv-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; padding: 4px 8px 14px; }
.sv-sidebar .sv-brand img { width: 34px; height: 34px; border-radius: 9px; }
.sv-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 12px; min-height: 44px;
  color: var(--sv-text); text-decoration: none; font-weight: 600; font-size: 0.95rem;
}
.sv-nav-item:hover { background: var(--sv-hover); }
.sv-nav-item.active { background: var(--sv-nav-active); }
.sv-nav-item .sv-ico { width: 22px; text-align: center; }
.sv-sidebar-foot { margin-top: auto; display: grid; gap: 8px; }
.sv-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--sv-accent-grad); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1rem; flex: none;
}
.sv-user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; }
.sv-user-chip .sv-email { font-size: 0.8rem; color: var(--sv-muted); word-break: break-all; }
.sv-main { padding: 20px 22px 90px; max-width: 1060px; width: 100%; margin: 0 auto; }
.sv-view-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.sv-view-head h1 { font-size: 1.6rem; margin: 0; }
.sv-view-head p { color: var(--sv-muted); margin: 0; }
.sv-cards { display: grid; gap: 16px; }
.sv-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.sv-toolbar .sv-input { flex: 1; min-width: 180px; }
.sv-toolbar .sv-select { width: auto; min-width: 150px; }
.sv-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.sv-file {
  border: 1px solid var(--sv-border);
  border-radius: var(--sv-radius-sm);
  background: var(--sv-surface);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sv-file .sv-file-ico { font-size: 1.6rem; }
.sv-file .sv-file-name { font-weight: 600; word-break: break-all; font-size: 0.9rem; }
.sv-file .sv-file-meta { font-size: 0.78rem; color: var(--sv-muted); }
.sv-file .sv-file-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.sv-mini-btn {
  min-height: 36px; padding: 6px 12px; border-radius: 999px; font-size: 0.82rem; font-weight: 600;
  border: 1px solid var(--sv-border-strong); background: transparent; color: var(--sv-text); cursor: pointer;
}
.sv-mini-btn:hover { background: var(--sv-hover); }
.sv-mini-btn-danger { color: var(--sv-danger); border-color: var(--sv-danger); }
.sv-steps { counter-reset: sv-step; list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
.sv-steps li {
  counter-increment: sv-step;
  border: 1px solid var(--sv-border);
  border-radius: var(--sv-radius-sm);
  background: var(--sv-surface);
  padding: 14px 14px 14px 52px;
  position: relative;
}
.sv-steps li::before {
  content: counter(sv-step);
  position: absolute; left: 14px; top: 14px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--sv-accent-grad); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.85rem;
}
.sv-actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.sv-kv { font-size: 0.9rem; }
.sv-kv dt { font-weight: 700; }
.sv-kv dd { margin: 0 0 8px; color: var(--sv-muted); }
.sv-sealed-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.sv-sealed-list li { border: 1px solid var(--sv-border); border-radius: var(--sv-radius-sm); padding: 10px 12px; font-size: 0.88rem; background: var(--sv-surface); }

/* ---------- Subida por clave API (standalone) ---------- */
.sv-upload { max-width: 780px; margin: 0 auto; padding: 0 16px 64px; }
.sv-code {
  background: var(--sv-surface-solid);
  border: 1px solid var(--sv-border-strong);
  border-radius: var(--sv-radius-sm);
  padding: 14px;
  font-size: 0.82rem;
  overflow-x: auto;
  white-space: pre;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.sv-log {
  background: var(--sv-surface-solid);
  border: 1px solid var(--sv-border-strong);
  border-radius: var(--sv-radius-sm);
  padding: 12px 14px;
  font-size: 0.88rem;
  min-height: 44px;
  white-space: pre-wrap;
  word-break: break-word;
}
.sv-drop {
  border: 2px dashed var(--sv-border-strong);
  border-radius: var(--sv-radius);
  padding: 28px 16px;
  text-align: center;
  color: var(--sv-muted);
  cursor: pointer;
}
.sv-drop:hover, .sv-drop.sv-drop-over { background: var(--sv-hover); }

/* ---------- Heredero ---------- */
.sv-heir { max-width: 560px; margin: 0 auto; padding: 24px 16px 64px; }

/* ---------- Compatibilidad con vistas viejas del dashboard ---------- */
/* Las vistas del router siguen siendo .view/.active; el contenedor viejo
   .dashboard-grid se sustituye por .sv-dash en dashboard/index.html. */
.view { display: none; }
.view.active { display: block; }
#dashboard-root .cta-button { font-family: var(--sv-font); text-transform: none; letter-spacing: normal; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .sv-dash { grid-template-columns: 1fr; }
  .sv-sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    height: auto; z-index: 100;
    flex-direction: row; align-items: center; overflow-x: auto;
    padding: 6px 8px; border-right: none; border-top: 1px solid var(--sv-border);
  }
  .sv-sidebar .sv-brand, .sv-sidebar-foot .sv-user-chip, .sv-sidebar-foot .sv-plan-line { display: none; }
  .sv-sidebar-foot { margin: 0 0 0 auto; display: flex; flex-direction: row; }
  .sv-nav-item { flex-direction: column; gap: 2px; font-size: 0.68rem; padding: 6px 10px; min-height: 48px; min-width: 56px; }
  .sv-nav-item .sv-ico { font-size: 1.05rem; }
  .sv-main { padding: 16px 14px 110px; }
  .sv-auth-wrap { grid-template-columns: 1fr; }
  .sv-hero { padding-top: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
