/* ============================================================
   NS JUICIO — Sistema de diseño
   Dark theme con acentos dorados/judiciales
   ============================================================ */
:root {
  --bg:         #080c14;
  --surface:    #0e1420;
  --surface2:   #131928;
  --surface3:   #1a2236;
  --border:     #1e2a40;
  --border2:    #253047;

  --gold:       #d4a017;
  --gold-light: #f0c040;
  --gold-dim:   rgba(212,160,23,.15);
  --gold-glow:  rgba(212,160,23,.25);

  --cyan:       #22d3ee;
  --cyan-dim:   rgba(34,211,238,.12);

  --green:      #22c55e;
  --red:        #ef4444;
  --orange:     #f97316;
  --purple:     #a855f7;

  --text:       #e2e8f0;
  --muted:      #64748b;
  --muted2:     #475569;
  --radius:     12px;
  --radius-sm:  8px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; max-width: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.65;
  min-height: 100vh;
}
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ---- Tipografía ---- */
h1,h2,h3,h4 { line-height: 1.3; font-weight: 700; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

/* ---- Layout helpers ---- */
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.flex  { display: flex; }
.grid  { display: grid; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

/* ---- Botones ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .92rem; cursor: pointer;
  border: none; transition: all .2s; white-space: nowrap;
}
.btn-gold { background: var(--gold); color: #0a0a0f; user-select: none; }
a.btn-gold, a.btn-gold:link, a.btn-gold:visited, a.btn-gold:hover, a.btn-gold:active, a.btn-gold:focus { color: #0a0a0f !important; }
.btn-gold:hover { background: var(--gold-light); transform: translateY(-1px); }
.btn-gold:active { transform: translateY(0); }
.btn-outline {
  background: transparent; border: 1px solid var(--border2);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: .85rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }

/* ---- Tarjetas ---- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.card-sm { padding: 16px; }
.card:hover { border-color: var(--border2); }

/* ---- Formularios ---- */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; font-size: .85rem; font-weight: 600;
  color: var(--muted); text-transform: uppercase;
  letter-spacing: .05em; margin-bottom: 6px;
}
.form-control {
  width: 100%; padding: 10px 14px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: .95rem; transition: border-color .2s;
}
.form-control:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}
.form-control::placeholder { color: var(--muted2); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; }

.range-group { display: flex; align-items: center; gap: 12px; }
.range-group input[type=range] {
  flex: 1; accent-color: var(--gold); cursor: pointer;
}
.range-val {
  min-width: 32px; text-align: center; font-weight: 700;
  color: var(--gold); font-size: .9rem;
}

/* ---- Badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 99px;
  font-size: .76rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em;
}
.badge-gold    { background: var(--gold-dim);   color: var(--gold-light); border: 1px solid var(--gold); }
.badge-green   { background: rgba(34,197,94,.15); color: var(--green);    border: 1px solid rgba(34,197,94,.3); }
.badge-red     { background: rgba(239,68,68,.15); color: var(--red);      border: 1px solid rgba(239,68,68,.3); }
.badge-orange  { background: rgba(249,115,22,.15);color: var(--orange);   border: 1px solid rgba(249,115,22,.3); }
.badge-muted   { background: var(--surface3);   color: var(--muted);     border: 1px solid var(--border); }
.badge-purple  { background: rgba(168,85,247,.15);color: var(--purple);  border: 1px solid rgba(168,85,247,.3); }

/* ---- Navbar ---- */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(8,12,20,.9); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}
.navbar-inner {
  display: flex; align-items: center; justify-content: space-between;
}
.navbar-brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.15rem; font-weight: 800; color: var(--gold);
}
.navbar-brand span { color: var(--text); font-weight: 400; font-size: .85rem; }
.navbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.navbar-hide-sm { }
@media (max-width: 600px) {
  .navbar-brand span  { display: none; }
  .navbar-actions     { gap: 6px; }
  .navbar-hide-sm     { display: none !important; }
  .btn.btn-ghost.btn-sm { padding: 4px 8px; font-size: .78rem; }
}

/* ---- Indicador de barras ---- */
.indicator-bar-wrap { margin-bottom: 8px; }
.indicator-label {
  display: flex; justify-content: space-between;
  font-size: .78rem; color: var(--muted); margin-bottom: 3px;
}
.indicator-bar {
  height: 6px; background: var(--surface3);
  border-radius: 3px; overflow: hidden;
}
.indicator-bar-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  transition: width .6s ease;
}
.indicator-bar-fill.green { background: linear-gradient(90deg,#16a34a,var(--green)); }
.indicator-bar-fill.red   { background: linear-gradient(90deg,#b91c1c,var(--red)); }
.indicator-bar-fill.purple{ background: linear-gradient(90deg,#7c3aed,var(--purple)); }

/* ---- Agent card ---- */
.agent-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  cursor: pointer; transition: all .2s;
  display: flex; align-items: center; gap: 12px;
}
.agent-card:hover { border-color: var(--gold); }
.agent-card.active {
  border-color: var(--gold);
  background: var(--gold-dim);
  box-shadow: 0 0 0 2px var(--gold-glow);
}
.agent-card.speaking { animation: speaking-pulse 1.5s ease infinite; }
@keyframes speaking-pulse {
  0%,100% { box-shadow: 0 0 0 0 var(--gold-glow); }
  50%      { box-shadow: 0 0 0 6px transparent; }
}
.agent-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 700; flex-shrink: 0;
}
.av-juez        { background: #1e3a5f; color: #60a5fa; }
.av-querellante { background: #3b1515; color: #f87171; }
.av-defensor    { background: #14351f; color: #4ade80; }
.av-jurado      { background: #2d1f4f; color: #c084fc; }
.agent-info h4  { font-size: .88rem; margin-bottom: 1px; }
.agent-info p   { font-size: .76rem; color: var(--muted); }

/* ---- Inclinación del jurado ---- */
.inclination {
  display: flex; align-items: center; gap: 6px;
  font-size: .78rem; font-weight: 700;
}
.inc-querellante { color: var(--red); }
.inc-defensa     { color: var(--green); }
.inc-neutro      { color: var(--muted); }
.inc-indeciso    { color: var(--orange); }

/* ---- Timeline de pasos ---- */
.step-timeline {
  display: flex; flex-direction: column; gap: 0;
}
.step-item {
  display: flex; gap: 12px; padding: 10px 0;
  border-left: 2px solid var(--border); margin-left: 16px;
  padding-left: 20px; position: relative; cursor: pointer;
}
.step-item::before {
  content: ''; position: absolute;
  left: -8px; top: 14px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface3); border: 2px solid var(--border2);
  transition: all .2s;
}
.step-item.done::before { background: var(--gold); border-color: var(--gold); }
.step-item.current::before {
  background: var(--gold-light); border-color: var(--gold);
  box-shadow: 0 0 0 4px var(--gold-glow);
}
.step-item:hover::before { border-color: var(--gold); }
.step-num { font-size: .75rem; color: var(--muted); min-width: 28px; }
.step-label { font-size: .82rem; color: var(--text); }
.step-actor-tag {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  padding: 1px 7px; border-radius: 4px;
}

/* ---- Panel principal de intervención ---- */
.intervention-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.intervention-header {
  padding: 16px 20px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.intervention-body {
  padding: 24px;
  max-height: 420px; overflow-y: auto;
  line-height: 1.8;
}
.intervention-body p + p { margin-top: 12px; }

/* ---- Typing animation ---- */
.typing-dots span {
  display: inline-block; width: 7px; height: 7px;
  background: var(--gold); border-radius: 50; margin: 0 2px;
  animation: typing-bounce .8s ease infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .15s; }
.typing-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes typing-bounce {
  0%,80%,100% { transform: translateY(0); }
  40%          { transform: translateY(-6px); }
}

/* ---- Navegación de simulación ---- */
.sim-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  background: var(--surface2); border-top: 1px solid var(--border);
}
.sim-progress {
  font-size: .82rem; color: var(--muted); text-align: center;
}
.sim-progress strong { color: var(--gold); font-size: 1rem; }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); }
.tab {
  padding: 10px 18px; font-size: .88rem; font-weight: 600;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent;
  transition: all .2s; background: none; border-top: none;
  border-left: none; border-right: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--gold); border-bottom-color: var(--gold); }

/* ---- Wizard de creación ---- */
.wizard-steps {
  display: flex; align-items: center; gap: 0;
  margin-bottom: 32px;
}
.wizard-step {
  display: flex; align-items: center; gap: 10px; flex: 1;
}
.wizard-step-num {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 700; flex-shrink: 0;
  background: var(--surface3); color: var(--muted);
  border: 2px solid var(--border);
  transition: all .3s;
}
.wizard-step.done .wizard-step-num {
  background: var(--gold); color: #0a0a0f; border-color: var(--gold);
}
.wizard-step.active .wizard-step-num {
  background: var(--gold-dim); color: var(--gold); border-color: var(--gold);
  box-shadow: 0 0 0 4px var(--gold-glow);
}
.wizard-step-label { font-size: .8rem; color: var(--muted); }
.wizard-step.active .wizard-step-label { color: var(--gold); font-weight: 600; }
.wizard-divider { flex: 1; height: 2px; background: var(--border); max-width: 40px; }
.wizard-divider.done { background: var(--gold); }

/* ---- Notificaciones / toasts ---- */
#toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  padding: 12px 18px; border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 600;
  animation: toast-in .3s ease;
  max-width: 340px;
}
.toast-success { background: #14532d; border: 1px solid var(--green); color: #86efac; }
.toast-error   { background: #450a0a; border: 1px solid var(--red);   color: #fca5a5; }
.toast-info    { background: var(--surface3); border: 1px solid var(--border2); color: var(--text); }
@keyframes toast-in {
  from { opacity:0; transform:translateY(16px); }
  to   { opacity:1; transform:translateY(0); }
}

/* ---- Objection overlay ---- */
.objection-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(8,12,20,.85); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  animation: fade-in .25s ease;
}
@keyframes fade-in { from{opacity:0} to{opacity:1} }
.objection-banner {
  background: #450a0a; border: 2px solid var(--red);
  border-radius: var(--radius); padding: 24px 40px;
  text-align: center;
}
.objection-banner h2 { color: var(--red); font-size: 1.8rem; letter-spacing: .1em; }
.objection-banner p  { color: var(--text); margin-top: 6px; }

/* ---- Layout simulación ---- */
.sim-layout {
  display: grid;
  grid-template-columns: 240px 1fr 280px;
  grid-template-rows: 1fr;
  gap: 16px;
  height: calc(100vh - 60px);
  padding: 16px;
  overflow: hidden;
}
.sim-left  { display:flex; flex-direction:column; gap:12px; overflow-y:auto; }
.sim-center { display:flex; flex-direction:column; gap:12px; overflow: hidden; }
.sim-right { display:flex; flex-direction:column; gap:12px; overflow-y:auto; }

/* ---- Historial de pasos ---- */
.history-panel {
  flex: 1; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.history-item {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .15s;
}
.history-item:last-child { border-bottom: none; }
.history-item:hover { background: var(--surface2); }
.history-item.active { background: var(--gold-dim); border-left: 3px solid var(--gold); }
.hi-meta { display:flex; align-items:center; gap:8px; margin-bottom:4px; }
.hi-step { font-size:.72rem; color:var(--muted); }
.hi-preview { font-size:.8rem; color:var(--muted); overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }

/* ---- Voz / audio ---- */
.audio-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .2s; flex-shrink: 0;
  color: var(--muted);
}
.audio-btn:hover { border-color: var(--gold); color: var(--gold); }
.audio-btn.playing { background: var(--gold-dim); border-color: var(--gold); color: var(--gold); }

/* ---- Responsive ---- */
@media (max-width: 1100px) {
  .sim-layout { grid-template-columns: 200px 1fr 240px; }
}
@media (max-width: 860px) {
  .sim-layout { grid-template-columns: 1fr; grid-template-rows: auto; height: auto; }
  .sim-left, .sim-right { display: none; }
}

/* ---- Misc ---- */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.text-gold   { color: var(--gold); }
.text-muted  { color: var(--muted); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-sm { font-size: .85rem; }
.text-xs { font-size: .75rem; }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }

/* ---- Tooltips globales ---- */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text);
  font-size: .75rem;
  font-weight: 400;
  line-height: 1.5;
  padding: 7px 11px;
  white-space: nowrap;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 3000;
  box-shadow: 0 6px 20px rgba(0,0,0,.55);
}
[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--border2);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
  z-index: 3001;
}
[data-tooltip]:hover::after  { opacity: 1; transform: translateX(-50%) translateY(0); }
[data-tooltip]:hover::before { opacity: 1; }

/* Tooltip arriba alineado a la derecha — para botones en borde derecho */
[data-tooltip-right] { position: relative; }
[data-tooltip-right]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  left: auto;
  transform: translateY(-4px);
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text);
  font-size: .75rem;
  font-weight: 400;
  padding: 7px 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 3000;
  box-shadow: 0 6px 20px rgba(0,0,0,.55);
}
[data-tooltip-right]:hover::after { opacity: 1; transform: translateY(0); }

/* Tooltip abajo alineado a la derecha del botón (para elementos en el borde derecho) */
[data-tooltip-down-left] { position: relative; }
[data-tooltip-down-left]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 10px);
  right: 0; left: auto;
  transform: translateY(-4px);
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text);
  font-size: .76rem;
  white-space: nowrap;
  padding: 6px 10px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s, transform .15s;
  z-index: 999;
}
[data-tooltip-down-left]:hover::after { opacity: 1; transform: translateY(0); }

/* ---- Footer ---- */
.app-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 40px 0 0;
  margin-top: 64px;
}
.footer-body {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  align-items: start;
}
/* Col izquierda: marca */
.footer-col { display: flex; flex-direction: column; gap: 8px; }
.footer-ns-link {
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; width: fit-content;
  margin-bottom: 2px;
}
.footer-ns-link img { flex-shrink: 0; }
.footer-ns-name {
  font-size: .9rem; font-weight: 700; color: var(--text);
  transition: color .2s;
}
.footer-ns-name sup { font-size: .55em; }
.footer-ns-link:hover .footer-ns-name { color: var(--gold); }
.footer-ns-tagline { font-size: .78rem; color: var(--muted); }

/* Col central: info app */
.footer-col--center { align-items: center; text-align: center; }
.footer-app-name { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.footer-app-desc { font-size: .78rem; color: var(--muted); margin-bottom: 6px; }
.footer-email { font-size: .8rem; color: var(--muted); transition: color .2s; }
.footer-email:hover { color: var(--gold); }

/* Col derecha: acción */
.footer-col--right { align-items: flex-end; }
.footer-credits-hint { font-size: .72rem; color: var(--muted); text-align: right; max-width: 200px; line-height: 1.4; position: relative; z-index: 1; }

/* Barra inferior */
.footer-bottom {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 14px 0;
  font-size: .75rem; color: var(--muted);
}
.footer-bottom a { color: var(--muted); }
.footer-bottom a:hover { color: var(--gold); }
.footer-sep { color: var(--border2); }

/* ---- Modal planes ---- */
.plans-modal {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 28px;
  width: 100%; max-width: 740px;
  max-height: 88vh; overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,.65);
}
.plans-modal-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 12px;
  margin-bottom: 24px; padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.plan-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
  transition: all .2s;
}
.plan-card:hover { border-color: var(--border2); transform: translateY(-2px); }
.plan-card.featured {
  border-color: var(--gold);
  background: linear-gradient(135deg, var(--surface2) 0%, rgba(212,160,23,.08) 100%);
  box-shadow: 0 4px 24px rgba(212,160,23,.12);
}
.plan-name { font-weight: 700; font-size: 1rem; color: var(--text); }
.plan-price { font-size: 1.6rem; font-weight: 800; color: var(--gold); line-height: 1; }
.plan-credits { font-size: .82rem; color: var(--muted); }
.plan-features {
  list-style: none; font-size: .8rem; color: var(--muted);
  display: flex; flex-direction: column; gap: 4px;
}
.plan-features li::before { content: '✓ '; color: var(--green); font-weight: 700; }
.plan-features li.no { color: var(--muted); }
.plan-features li.no::before { content: '✗ '; color: var(--muted); }
.plan-buy-btn { margin-top: auto !important; }

@media (max-width: 768px) {
  .footer-body {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .footer-col--center, .footer-col--right {
    align-items: flex-start; text-align: left;
  }
  .footer-credits-hint { text-align: left; }
  .plans-grid { grid-template-columns: 1fr; }
}
