/* ═══════════════════════════════════════════════════════════
   🥚 LIMPIAAI v17 — NEXUS EDITION
   Mapa forense · Huella espectral · Timeline · Rachas · Consejero
   ═══════════════════════════════════════════════════════════ */

.nx-sub {
  font-size: .72rem;
  color: var(--t3, #64748b);
  margin-bottom: 12px;
  line-height: 1.5;
}

.nx-h4 {
  font-size: .78rem;
  font-family: var(--font-royal, inherit);
  color: var(--gold1, #fde68a);
  margin: 18px 0 10px;
  text-align: center;
  letter-spacing: .04em;
}

/* ─── MAPA FORENSE ─────────────────────────────────────── */
.nx-forensic-stage {
  position: relative;
  border-radius: var(--r, 14px);
  overflow: hidden;
  background: #05050f;
  border: 1px solid rgba(251, 191, 36, .22);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5), inset 0 0 40px rgba(139, 92, 246, .08);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 180px;
}

.nx-forensic-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: calc(var(--r, 14px) - 2px);
}

.nx-forensic-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(3, 3, 17, .82);
  color: var(--gold1, #fde68a);
  font-size: .74rem;
  backdrop-filter: blur(3px);
}

.nx-overlay-controls {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.nx-ov-btn {
  flex: 1 1 auto;
  min-width: 72px;
  padding: 8px 6px;
  font-size: .66rem;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, .2);
  background: rgba(255, 255, 255, .03);
  color: var(--t2, #94a3b8);
  cursor: pointer;
  transition: transform .18s cubic-bezier(.34, 1.56, .64, 1), background .2s, color .2s, border-color .2s;
}

.nx-ov-btn:hover { border-color: rgba(251, 191, 36, .45); color: var(--t1, #f1f5f9); }
.nx-ov-btn:active { transform: scale(.94); }

.nx-ov-btn.on {
  background: linear-gradient(135deg, rgba(251, 191, 36, .18), rgba(139, 92, 246, .18));
  border-color: rgba(251, 191, 36, .55);
  color: var(--gold1, #fde68a);
  box-shadow: 0 0 14px rgba(251, 191, 36, .2);
}

.nx-export-btn {
  background: linear-gradient(135deg, rgba(139, 92, 246, .22), rgba(251, 191, 36, .16));
  border-color: rgba(139, 92, 246, .45);
  color: #ddd6fe;
}
.nx-export-btn:hover { border-color: rgba(167, 139, 250, .7); color: #fff; }

.nx-img-picker {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.nx-pick {
  position: relative;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid rgba(148, 163, 184, .22);
  background: none;
  padding: 0;
  cursor: pointer;
  transition: border-color .2s, transform .18s;
}

.nx-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nx-pick span {
  position: absolute; bottom: 1px; right: 3px;
  font-size: .55rem; font-weight: 800; color: #fff;
  text-shadow: 0 1px 3px #000;
}
.nx-pick.on { border-color: var(--gold2, #fbbf24); transform: translateY(-2px); }
.nx-pick:active { transform: scale(.92); }

/* ─── MÉTRICAS GLCM ────────────────────────────────────── */
.nx-metrics {
  margin-top: 14px;
  padding: 12px;
  border-radius: var(--r, 14px);
  background: rgba(255, 255, 255, .022);
  border: 1px solid rgba(148, 163, 184, .13);
}

.nx-metric-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .7rem;
  font-weight: 700;
  color: var(--gold1, #fde68a);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, .12);
}

.nx-hot-badge {
  font-size: .6rem;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(239, 68, 68, .14);
  border: 1px solid rgba(239, 68, 68, .3);
  color: #fca5a5;
  font-weight: 700;
}

.nx-metric {
  display: grid;
  grid-template-columns: 18px 1fr 76px 26px;
  align-items: center;
  gap: 7px;
  padding: 5px 0;
}

.nx-m-icon { font-size: .78rem; text-align: center; }
.nx-m-label { font-size: .66rem; color: var(--t2, #94a3b8); }
.nx-m-val {
  font-size: .64rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--t1, #f1f5f9);
  text-align: right;
  font-weight: 600;
}

.nx-m-bar {
  height: 6px;
  border-radius: 20px;
  background: rgba(148, 163, 184, .14);
  overflow: hidden;
  display: block;
}

.nx-m-bar > i {
  display: block;
  height: 100%;
  border-radius: 20px;
  transition: width .9s cubic-bezier(.22, 1, .36, 1);
}

.nx-notes { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; }

.nx-note {
  font-size: .655rem;
  line-height: 1.45;
  padding: 7px 9px;
  border-radius: 9px;
  border-left: 3px solid;
}

.nx-note.sev-ok { background: rgba(52, 211, 153, .07); border-color: #34d399; color: #a7f3d0; }
.nx-note.sev-warn { background: rgba(251, 191, 36, .07); border-color: #fbbf24; color: #fde68a; }
.nx-note.sev-alert { background: rgba(239, 68, 68, .07); border-color: #ef4444; color: #fca5a5; }

/* ─── HUELLA ESPECTRAL ─────────────────────────────────── */
.nx-spectral-wrap { margin-top: 8px; text-align: center; }

.nx-spectral-canvas {
  width: 100%;
  max-width: 300px;
  height: auto;
  filter: drop-shadow(0 6px 22px rgba(139, 92, 246, .28));
}

.nx-spectral-caption {
  font-size: .68rem;
  color: var(--t2, #94a3b8);
  margin-top: 4px;
  line-height: 1.6;
}

.nx-spec-eff {
  display: inline-block;
  margin-left: 5px;
  font-size: .58rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--t3, #64748b);
}

.nx-hue-chips {
  display: flex;
  gap: 5px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 7px;
}

.nx-hue-chip {
  font-size: .56rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  color: var(--hc, #fbbf24);
  border: 1px solid color-mix(in srgb, var(--hc, #fbbf24) 45%, transparent);
  background: color-mix(in srgb, var(--hc, #fbbf24) 12%, transparent);
}

@supports not (color: color-mix(in srgb, red 50%, transparent)) {
  .nx-hue-chip { border-color: rgba(148, 163, 184, .3); background: rgba(255, 255, 255, .05); }
}

/* ─── RACHAS / RANGO DE ADEPTO ─────────────────────────── */
.nx-streak-card {
  margin: 14px 0;
  padding: 14px;
  border-radius: var(--r, 14px);
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(251, 191, 36, .09), transparent 60%),
    rgba(255, 255, 255, .025);
  border: 1px solid rgba(251, 191, 36, .2);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .34);
}

.nx-streak-top { display: flex; align-items: center; gap: 11px; }

.nx-rank-medal {
  width: 46px; height: 46px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  background: radial-gradient(circle at 32% 28%, #fde68a, #d97706 62%, #92400e);
  box-shadow: 0 0 0 2px rgba(253, 230, 138, .35), 0 6px 16px rgba(217, 119, 6, .4), inset 0 -3px 8px rgba(0, 0, 0, .3);
}

.nx-rank-info { flex: 1; min-width: 0; }

.nx-rank-name {
  font-size: .84rem;
  font-weight: 800;
  font-family: var(--font-royal, inherit);
  background: linear-gradient(92deg, #fde68a, #fbbf24 40%, #fff7d6 55%, #d97706);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nx-rank-xp {
  font-size: .62rem;
  color: var(--t3, #64748b);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nx-tl-btn {
  flex-shrink: 0;
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  border: 1px solid rgba(251, 191, 36, .3);
  background: rgba(251, 191, 36, .1);
  color: var(--gold2, #fbbf24);
  cursor: pointer;
  transition: transform .18s cubic-bezier(.34, 1.56, .64, 1), background .2s;
}
.nx-tl-btn:hover { background: rgba(251, 191, 36, .2); }
.nx-tl-btn:active { transform: scale(.9); }

.nx-xp-bar {
  height: 6px;
  border-radius: 20px;
  background: rgba(148, 163, 184, .15);
  overflow: hidden;
  margin: 11px 0;
}

.nx-xp-bar > i {
  display: block;
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(90deg, #d97706, #fbbf24 50%, #fde68a);
  box-shadow: 0 0 12px rgba(251, 191, 36, .5);
  transition: width 1.1s cubic-bezier(.22, 1, .36, 1);
}

.nx-streak-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.nx-streak-item {
  text-align: center;
  padding: 8px 3px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(148, 163, 184, .1);
}

.nx-streak-item .v {
  display: block;
  font-size: .78rem;
  font-weight: 800;
  color: var(--t1, #f1f5f9);
}

.nx-streak-item .l {
  display: block;
  font-size: .55rem;
  color: var(--t3, #64748b);
  margin-top: 2px;
  line-height: 1.2;
}

/* ─── MODAL GENÉRICO NEXUS ─────────────────────────────── */
.nx-modal {
  position: fixed;
  inset: 0;
  z-index: 9200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.nx-modal.on { display: flex; }

.nx-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 3, 17, .85);
  backdrop-filter: blur(7px);
}

.nx-modal-content {
  position: relative;
  width: 100%;
  max-width: 680px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(160deg, #0e0e2a, #080820);
  border: 1px solid rgba(251, 191, 36, .28);
  box-shadow: 0 26px 70px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(253, 230, 138, .12);
  animation: nxPop .34s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes nxPop {
  from { opacity: 0; transform: translateY(22px) scale(.95); }
  to { opacity: 1; transform: none; }
}

.nx-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 11px;
  border-bottom: 1px solid rgba(148, 163, 184, .14);
}

.nx-modal-head h3 {
  font-size: 1rem;
  font-family: var(--font-royal, inherit);
  color: var(--gold1, #fde68a);
}

.nx-empty {
  text-align: center;
  padding: 34px 14px;
  color: var(--t3, #64748b);
  font-size: .76rem;
}

/* ─── TIMELINE ─────────────────────────────────────────── */
.nx-tl-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-bottom: 14px;
}

.nx-tl-stat {
  text-align: center;
  padding: 9px 4px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(148, 163, 184, .11);
}

.nx-tl-stat .v {
  display: block;
  font-size: .92rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--t1, #f1f5f9);
}

.nx-tl-stat .l {
  display: block;
  font-size: .55rem;
  color: var(--t3, #64748b);
  margin-top: 3px;
}

.nx-trend-up { color: #34d399 !important; }
.nx-trend-down { color: #ef4444 !important; }
.nx-trend-flat { color: #fbbf24 !important; }

.nx-tl-svg {
  width: 100%;
  height: auto;
  border-radius: 12px;
  background: rgba(0, 0, 0, .28);
  border: 1px solid rgba(148, 163, 184, .1);
}

.nx-dot { transition: r .2s; cursor: pointer; }
.nx-dot:hover { r: 6.5; }

.nx-tl-legend {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: .6rem;
  color: var(--t3, #64748b);
}

.nx-tl-legend span { display: inline-flex; align-items: center; gap: 5px; }
.nx-tl-legend i { width: 16px; height: 2px; border-radius: 2px; display: inline-block; }
.nx-tl-legend .lg-line { background: linear-gradient(90deg, #8b5cf6, #22d3ee, #fbbf24); height: 2.5px; }
.nx-tl-legend .lg-ma { background: repeating-linear-gradient(90deg, #fde68a 0 4px, transparent 4px 7px); }
.nx-tl-legend .lg-tr { background: repeating-linear-gradient(90deg, #34d399 0 2px, transparent 2px 5px); }

.nx-tl-verdict {
  margin-top: 13px;
  padding: 11px 13px;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: .7rem;
  border-left: 3px solid;
}

.nx-tl-verdict.up { background: rgba(52, 211, 153, .08); border-color: #34d399; color: #a7f3d0; }
.nx-tl-verdict.down { background: rgba(239, 68, 68, .08); border-color: #ef4444; color: #fca5a5; }
.nx-tl-verdict.flat { background: rgba(251, 191, 36, .08); border-color: #fbbf24; color: #fde68a; }
.nx-tl-verdict b { font-family: 'JetBrains Mono', monospace; }

/* ─── CONSEJERO ADAPTATIVO ─────────────────────────────── */
.nx-advice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px;
  margin-bottom: 8px;
  border-radius: 13px;
  background: rgba(255, 255, 255, .025);
  border: 1px solid rgba(148, 163, 184, .1);
  border-left: 3px solid rgba(148, 163, 184, .3);
  transition: transform .2s, border-color .2s;
}

.nx-advice:hover { transform: translateX(3px); }
.nx-advice.prio-high { border-left-color: #ef4444; background: rgba(239, 68, 68, .05); }
.nx-advice.prio-mid { border-left-color: #fbbf24; background: rgba(251, 191, 36, .04); }
.nx-advice.prio-low { border-left-color: #8b5cf6; }
.nx-advice.prio-good { border-left-color: #34d399; background: rgba(52, 211, 153, .05); }

.nx-advice-rank {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: .64rem;
  font-weight: 800;
  color: #1a1206;
  background: radial-gradient(circle at 34% 28%, #fde68a, #d97706 70%);
  box-shadow: 0 2px 7px rgba(217, 119, 6, .4);
}

.nx-advice-body { flex: 1; min-width: 0; }

.nx-advice-title {
  font-size: .74rem;
  font-weight: 700;
  color: var(--t1, #f1f5f9);
  margin-bottom: 3px;
}

.nx-advice-text {
  font-size: .67rem;
  line-height: 1.5;
  color: var(--t2, #94a3b8);
}

.nx-advice-why {
  font-size: .59rem;
  color: var(--t3, #64748b);
  margin-top: 5px;
  font-style: italic;
}

.nx-advice-why i { margin-right: 3px; opacity: .7; }

.nx-advice-go {
  flex-shrink: 0;
  align-self: center;
  padding: 6px 10px;
  font-size: .62rem;
  font-weight: 700;
  border-radius: 9px;
  border: 1px solid rgba(251, 191, 36, .35);
  background: rgba(251, 191, 36, .12);
  color: var(--gold1, #fde68a);
  cursor: pointer;
  white-space: nowrap;
  transition: transform .18s cubic-bezier(.34, 1.56, .64, 1), background .2s;
}

.nx-advice-go:hover { background: rgba(251, 191, 36, .22); }
.nx-advice-go:active { transform: scale(.92); }

/* ─── RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 420px) {
  .nx-streak-grid, .nx-tl-stats { grid-template-columns: repeat(2, 1fr); }
  .nx-metric { grid-template-columns: 16px 1fr 54px 24px; }
  .nx-advice { flex-wrap: wrap; }
  .nx-advice-go { width: 100%; margin-top: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .nx-modal-content { animation: none; }
  .nx-xp-bar > i, .nx-m-bar > i { transition: none; }
  .nx-advice:hover { transform: none; }
}
