/**
 * app.css — Estilos de componentes de resultado, debug panel,
 * toasts y overlays para DocValidar / QR Poncho
 */

/* ── Resultados / área de output ──────────────────────────── */
.results-area { margin-top: 24px; }
.results-area.hidden { display: none; }

/* Score row */
.score-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}
.score-card {
  flex: 1 1 120px;
  background: #F0F4FA;
  border: 1px solid #DDE3EE;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  min-width: 120px;
}
.score-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: #242C4F;
  line-height: 1;
  margin: 4px 0;
}
.score-value.sm { font-size: 1.6rem; }
.score-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #666;
}
.gauge-svg { width: 100%; max-width: 120px; height: auto; display: block; margin: 0 auto 4px; }

/* Gauge animado */
#urlGaugePath, #pdfTrustGauge, #pdfIntegrityGauge, #pdfCryptoGauge {
  transition: stroke-dashoffset .8s cubic-bezier(.4,0,.2,1), stroke .4s;
}

/* Badge row */
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.badge-row .badge-item {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .03em;
}
.badge-item.success { background: #E8F5E9; color: #1B5E20; border: 1px solid #A5D6A7; }
.badge-item.danger  { background: #FDECEA; color: #B71C1C; border: 1px solid #EF9A9A; }
.badge-item.warn    { background: #FFF8E1; color: #E65100; border: 1px solid #FFE082; }
.badge-item.info    { background: #E3F2FD; color: #0D47A1; border: 1px solid #90CAF9; }
.badge-item.neutral { background: #F3F4F6; color: #374151; border: 1px solid #D1D5DB; }

/* Data panel */
.data-panel {
  background: #fff;
  border: 1px solid #E5E9F0;
  border-radius: 6px;
  margin-bottom: 20px;
  overflow: hidden;
}
.data-panel-header {
  background: #F0F4FA;
  padding: 10px 16px;
  border-bottom: 1px solid #E5E9F0;
}
.data-panel-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #242C4F;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0;
}
.data-item {
  padding: 10px 16px;
  border-bottom: 1px solid #F0F2F5;
  border-right: 1px solid #F0F2F5;
}
.data-item:last-child { border-bottom: none; }
.data-item-key {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #888;
  margin-bottom: 2px;
}
.data-item-val {
  font-size: 14px;
  color: #222;
  word-break: break-all;
}
.data-item-val.highlight { color: #0072BC; font-weight: 700; }
.data-item-val.mono-sm   { font-family: 'Courier New', monospace; font-size: 12px; color: #555; }

/* ── Timeline de validaciones ─────────────────────────────── */
.validation-timeline { margin-bottom: 20px; }
.validation-timeline h3 { font-size: 14px; font-weight: 700; color: #242C4F; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 12px; }
.timeline-items { display: flex; flex-direction: column; gap: 4px; }
.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 4px;
  background: #F8FAFC;
  border-left: 3px solid #CCC;
}
.timeline-item.success { border-left-color: #3BB44A; background: #F1FDF2; }
.timeline-item.danger  { border-left-color: #D0021B; background: #FEF0F0; }
.timeline-item.warn    { border-left-color: #F5A800; background: #FFFBF0; }
.timeline-item.info    { border-left-color: #0072BC; background: #F0F7FF; }
.timeline-dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
  flex-shrink: 0;
  color: #fff;
}
.timeline-item.success .timeline-dot { background: #3BB44A; }
.timeline-item.danger  .timeline-dot { background: #D0021B; }
.timeline-item.warn    .timeline-dot { background: #F5A800; }
.timeline-item.info    .timeline-dot { background: #0072BC; }
.timeline-content { flex: 1; min-width: 0; }
.timeline-label  { font-size: 13px; font-weight: 600; color: #222; }
.timeline-detail { font-size: 12px; color: #666; word-break: break-all; margin-top: 1px; }

/* ── Panel técnico expandible ─────────────────────────────── */
.tech-panel {
  border: 1px solid #E5E9F0;
  border-radius: 6px;
  margin-bottom: 20px;
  overflow: hidden;
}
.tech-panel summary {
  cursor: pointer;
  padding: 10px 16px;
  background: #F0F4FA;
  font-size: 13px;
  font-weight: 700;
  color: #242C4F;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tech-panel summary::-webkit-details-marker { display: none; }
.tech-panel[open] summary { border-bottom: 1px solid #E5E9F0; }
.tech-panel-body {
  padding: 16px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: #333;
  background: #FAFAFA;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 320px;
  overflow-y: auto;
}

/* ── Progreso PDF ─────────────────────────────────────────── */
.pdf-progress { margin: 16px 0; }
.pdf-progress.hidden { display: none; }
.progress-steps-list { display: flex; flex-direction: column; gap: 6px; }
.progress-step {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; padding: 6px 12px;
  border-radius: 4px; background: #F5F7FA;
  border-left: 3px solid #CCC;
  transition: border-color .3s, background .3s;
}
.progress-step.running { border-left-color: #0072BC; background: #EBF5FF; }
.progress-step.done    { border-left-color: #3BB44A; background: #F1FDF2; }
.progress-step.error   { border-left-color: #D0021B; background: #FEF0F0; }
.progress-step-icon { font-size: 14px; width: 20px; text-align: center; }

/* ── Firmas digitales panel ───────────────────────────────── */
.signatures-panel { margin-bottom: 20px; }
.signatures-panel.hidden { display: none; }
.panel-title {
  font-size: 14px; font-weight: 700; color: #242C4F;
  text-transform: uppercase; letter-spacing: .05em;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.signature-card {
  border: 1px solid #E5E9F0; border-radius: 6px;
  margin-bottom: 12px; overflow: hidden;
}
.signature-card-header {
  background: #F0F4FA; padding: 10px 16px;
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 13px; color: #242C4F;
  border-bottom: 1px solid #E5E9F0;
}
.signature-card-body { padding: 12px 16px; }
.sig-field { display: flex; gap: 6px; font-size: 13px; margin-bottom: 4px; }
.sig-field-key { font-weight: 600; color: #555; min-width: 110px; }
.sig-field-val { color: #222; word-break: break-all; }
.sig-digest-ok   { color: #1B5E20; font-weight: 700; }
.sig-digest-fail { color: #B71C1C; font-weight: 700; }
.sig-digest-unk  { color: #856404; }

/* ── Disclaimer criptográfico ─────────────────────────────── */
.crypto-disclaimer {
  background: #F0F4FA; border: 1px solid #DDE3EE;
  border-radius: 6px; padding: 12px 16px;
  font-size: 12px; color: #555;
  display: flex; gap: 10px; align-items: flex-start;
  margin-top: 16px;
}
.crypto-disclaimer .fa { color: #0072BC; margin-top: 2px; flex-shrink: 0; }

/* ── Compare results ──────────────────────────────────────── */
.compare-result-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 12px; border-radius: 4px; margin-bottom: 6px;
  font-size: 13px;
}
.compare-result-item.match    { background: #F1FDF2; border-left: 3px solid #3BB44A; }
.compare-result-item.mismatch { background: #FEF0F0; border-left: 3px solid #D0021B; }
.compare-result-item.warn     { background: #FFFBF0; border-left: 3px solid #F5A800; }
.compare-result-item.info     { background: #F0F7FF; border-left: 3px solid #0072BC; }
.compare-result-icon { font-size: 14px; margin-top: 1px; flex-shrink: 0; }
.compare-result-label { font-weight: 700; color: #222; }
.compare-result-detail { font-size: 12px; color: #555; word-break: break-all; margin-top: 1px; }

/* ── Toasts ───────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 1100; display: flex; flex-direction: column; gap: 8px;
  max-width: 360px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  font-size: 13px; font-weight: 600;
  animation: toastIn .25s ease;
  cursor: pointer;
}
.toast.out { animation: toastOut .3s ease forwards; }
.toast.success { background: #1B5E20; color: #fff; }
.toast.danger  { background: #B71C1C; color: #fff; }
.toast.warn    { background: #E65100; color: #fff; }
.toast.info    { background: #0D47A1; color: #fff; }
.toast-icon { font-size: 16px; flex-shrink: 0; }
@keyframes toastIn  { from { opacity:0; transform: translateY(12px); } to { opacity:1; transform: none; } }
@keyframes toastOut { to   { opacity:0; transform: translateY(12px); } }

/* ── Rate limit overlay ───────────────────────────────────── */
.rate-limit-overlay {
  position: fixed; inset: 0; background: rgba(36,44,79,.65);
  z-index: 2000; display: flex; align-items: center; justify-content: center;
}
.rate-limit-overlay.hidden { display: none; }
.rate-limit-dialog {
  background: #fff; border-radius: 10px; padding: 36px 40px;
  text-align: center; max-width: 380px; width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
}
.rate-limit-dialog h3 { margin: 16px 0 8px; color: #242C4F; }
.rate-limit-dialog .progress { margin-top: 16px; border-radius: 6px; }

/* ── Utilidades ───────────────────────────────────────────── */
.hidden { display: none !important; }
.mt-1  { margin-top: 8px; }
.mt-2  { margin-top: 16px; }

/* ── QR detected banner ───────────────────────────────────── */
.qr-detected-banner {
  display: flex; align-items: center; gap: 10px;
  background: #E8F5E9; color: #1B5E20;
  border: 1px solid #A5D6A7; border-radius: 6px;
  padding: 10px 16px; font-weight: 700; font-size: 14px;
  margin-bottom: 16px;
}
.qr-detected-banner .fa { font-size: 18px; }

/* ── Responsive ajustes ───────────────────────────────────── */
@media (max-width: 767px) {
  .score-row { gap: 8px; }
  .score-value { font-size: 1.6rem; }
  .data-grid { grid-template-columns: 1fr 1fr; }
  .toast-container { bottom: 12px; right: 12px; left: 12px; max-width: none; }
  .debug-panel { width: 100% !important; right: 0 !important; bottom: 0 !important; border-radius: 12px 12px 0 0; }
}
@media (max-width: 480px) {
  .data-grid { grid-template-columns: 1fr; }
  h1.activities-sidbar { font-size: 1.5rem; }
}

/* ═══════════════════════════════════════════════════════════
   DEBUG PANEL
═══════════════════════════════════════════════════════════ */
.debug-panel {
  position: fixed;
  bottom: 0; right: 0;
  width: 480px; max-width: 100%;
  height: 380px;
  background: #0D1117;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -4px 32px rgba(0,0,0,.45);
  z-index: 1050;
  display: flex; flex-direction: column;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.debug-panel.hidden { display: none; }

.debug-panel-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: #161B22;
  border-radius: 12px 12px 0 0;
  border-bottom: 1px solid #30363D;
  color: #C9D1D9;
  font-family: 'Encode Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
}
.debug-panel-header .fa { color: #58A6FF; }
.debug-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; background: #3BB44A; color: #fff;
  font-size: 11px; font-weight: 800; font-family: sans-serif;
  margin-left: 2px;
}
.debug-controls { display: flex; gap: 6px; align-items: center; margin-left: auto; }

.debug-select {
  background: #21262D; color: #C9D1D9; border: 1px solid #30363D;
  border-radius: 4px; font-size: 11px; padding: 3px 6px;
  cursor: pointer;
}
.debug-btn {
  background: #21262D; color: #8B949E;
  border: 1px solid #30363D; border-radius: 4px;
  padding: 4px 8px; cursor: pointer; font-size: 12px;
  transition: color .15s, background .15s;
  line-height: 1;
}
.debug-btn:hover { background: #30363D; color: #C9D1D9; }
.debug-btn-close:hover { background: #D0021B; color: #fff; border-color: #D0021B; }

.debug-filter-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px;
  border-bottom: 1px solid #21262D;
}
.debug-search {
  flex: 1; background: #0D1117; color: #C9D1D9;
  border: 1px solid #30363D; border-radius: 4px;
  padding: 4px 8px; font-size: 12px;
  font-family: 'Courier New', monospace;
}
.debug-search:focus { outline: none; border-color: #58A6FF; }
.debug-count-info { color: #8B949E; font-size: 11px; white-space: nowrap; font-family: sans-serif; }

.debug-log-body {
  flex: 1; overflow-y: auto; padding: 6px 0;
  scrollbar-width: thin; scrollbar-color: #30363D #0D1117;
}
.debug-log-body::-webkit-scrollbar { width: 6px; }
.debug-log-body::-webkit-scrollbar-track { background: #0D1117; }
.debug-log-body::-webkit-scrollbar-thumb { background: #30363D; border-radius: 3px; }

.debug-entry {
  display: grid;
  grid-template-columns: 80px 52px 1fr;
  gap: 0 8px;
  padding: 4px 14px;
  border-bottom: 1px solid #0D1117;
  line-height: 1.45;
  transition: background .1s;
}
.debug-entry:hover { background: #161B22; }
.debug-entry.hidden-entry { display: none; }

.debug-ts    { color: #8B949E; font-size: 11px; }
.debug-level { font-size: 11px; font-weight: 800; text-align: center; border-radius: 3px; padding: 1px 4px; }
.debug-msg   { color: #C9D1D9; word-break: break-word; }

.debug-entry[data-level="info"]    .debug-level { color: #58A6FF; background: rgba(88,166,255,.12); }
.debug-entry[data-level="success"] .debug-level { color: #3BB44A; background: rgba(59,180,74,.12); }
.debug-entry[data-level="warn"]    .debug-level { color: #F5A800; background: rgba(245,168,0,.12); }
.debug-entry[data-level="error"]   .debug-level { color: #D0021B; background: rgba(208,2,27,.12); }

.debug-entry[data-level="warn"]  .debug-msg { color: #FFF0B0; }
.debug-entry[data-level="error"] .debug-msg { color: #FFAAB0; }
.debug-entry[data-level="success"] .debug-msg { color: #ADFFC0; }
