/* ==========================================================================
   Variables y tokens de diseño corporativos Fijate Tools
   Herramienta: Detector de alertas y trampas en ofertas de trabajo (Red Flags)
   ========================================================================== */

:root {
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Tema oscuro */
  --bg-primary: #0f172a;
  --bg-surface: #1e293b;
  --bg-card: #182234;
  --bg-card-hover: #1e293b;
  --bg-input: #0b1120;
  --border-color: #334155;
  --border-focus: #3b82f6;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #cbd5e1;

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-rgb: 59, 130, 246;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #f8fafc;
  --border-color: #cbd5e1;
  --border-focus: #2563eb;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #334155;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-rgb: 37, 99, 235;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-main);
}

.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  width: 100%;
}

.tool-with-sidebar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 1536px) {
  .tool-with-sidebar {
    grid-template-columns: 1fr 300px;
  }
}

.tool-main-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
}

/* Hero */
.intro-hero {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.intro-badge-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.tag-badge {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background: rgba(var(--primary-rgb), 0.15);
  color: var(--primary);
  border: 1px solid rgba(var(--primary-rgb), 0.3);
}

.intro-title {
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
}

.intro-lead {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-muted);
}

/* Tarjeta de entrada y presets */
.scanner-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.presets-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.presets-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.btn-preset {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-dim);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s;
  min-height: 32px;
}

.btn-preset:hover {
  border-color: var(--primary);
  color: var(--text-main);
  background: var(--bg-card-hover);
}

.textarea-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.job-textarea {
  width: 100%;
  min-height: 160px;
  padding: 1rem;
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.5;
  resize: vertical;
}

.job-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.2);
}

.scanner-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .scanner-actions {
    flex-direction: row;
    justify-content: flex-end;
  }
}

/* Resultados */
.results-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.risk-meter-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.meter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.meter-score-row {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.score-num {
  font-family: var(--font-mono);
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1;
}

.score-max {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--text-muted);
}

.progress-track {
  width: 100%;
  height: 12px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: var(--radius-full);
  transition: width 0.6s ease;
}

.progress-fill.score-low { background: #10b981; }
.progress-fill.score-medium { background: #f59e0b; }
.progress-fill.score-high { background: #f97316; }
.progress-fill.score-critical { background: #ef4444; }

.risk-verdict-box {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.verdict-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.verdict-desc {
  font-size: 0.9rem;
  line-height: 1.45;
}

.risk-verdict-box.score-low {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
}
.risk-verdict-box.score-low .verdict-desc { color: var(--text-dim); }

.risk-verdict-box.score-medium {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}
.risk-verdict-box.score-medium .verdict-desc { color: var(--text-dim); }

.risk-verdict-box.score-high {
  background: rgba(249, 115, 22, 0.12);
  border-color: rgba(249, 115, 22, 0.3);
  color: #fb923c;
}
.risk-verdict-box.score-high .verdict-desc { color: var(--text-dim); }

.risk-verdict-box.score-critical {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #f87171;
}
.risk-verdict-box.score-critical .verdict-desc { color: var(--text-dim); }

/* Banderas rojas listado */
.flags-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.empty-flags-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.flag-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: var(--shadow-sm);
  border-left-width: 5px;
}

.flag-card.cat-culture { border-left-color: #a855f7; }
.flag-card.cat-salary { border-left-color: #f59e0b; }
.flag-card.cat-legal { border-left-color: #ef4444; }
.flag-card.cat-schedule { border-left-color: #06b6d4; }

.flag-header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.flag-badge-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.flag-index {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.1);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
}

.flag-cat-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg-surface);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.flag-level-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
}

.flag-level-badge.low { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.flag-level-badge.medium { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.flag-level-badge.high { background: rgba(249, 115, 22, 0.15); color: #fb923c; }
.flag-level-badge.critical { background: rgba(239, 68, 68, 0.15); color: #f87171; }

.flag-title {
  font-size: 1.2rem;
  color: var(--text-main);
}

.flag-desc {
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text-dim);
}

.flag-legal-box {
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  font-size: 0.82rem;
  color: var(--text-dim);
  border: 1px solid var(--border-color);
}

.flag-legal-box svg {
  flex-shrink: 0;
  color: var(--primary);
  margin-top: 2px;
}

.flag-legal-box strong {
  color: var(--text-main);
  display: block;
  margin-bottom: 0.2rem;
}

.flag-question-box {
  background: rgba(var(--primary-rgb), 0.08);
  border: 1px dashed rgba(var(--primary-rgb), 0.3);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.question-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.question-lbl {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
}

.btn-copy-q {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-copy-q:hover {
  background: var(--primary);
  color: #ffffff;
}

.question-quote {
  font-size: 0.9rem;
  font-style: italic;
  color: var(--text-main);
}

/* Checklist interactivo */
.checklist-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.checklist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.checklist-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.chk-item-label {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.88rem;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.chk-item-label:hover {
  background: var(--bg-surface);
}

.audit-chk {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  margin-top: 2px;
  flex-shrink: 0;
}

.metric-pill {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
}

.pill-success { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.pill-warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.pill-danger  { background: rgba(239, 68, 68, 0.15); color: #f87171; }

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  min-height: 42px;
  width: 100%;
}

@media (min-width: 640px) {
  .btn { width: auto; }
}

.btn-primary { background: var(--primary); color: #ffffff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--bg-surface); color: var(--text-main); border-color: var(--border-color); }
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--primary); }

.hidden { display: none !important; }

/* Modal */
.custom-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
}

.custom-modal-overlay.active { display: flex; }

.custom-modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 480px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: var(--shadow-lg);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* @media print */
#print-sheet { display: none; }

@media print {
  header.app-header,
  footer.fijate-footer,
  aside.tool-ad-sidebar,
  section.tools-ad-banner-section,
  .intro-hero,
  .scanner-card,
  .results-card,
  .checklist-card,
  .custom-modal-overlay {
    display: none !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 10pt;
    padding: 0;
    margin: 0;
  }

  #print-sheet {
    display: block !important;
    padding: 10mm;
  }

  .print-report-header {
    border-bottom: 2px solid #0f172a;
    padding-bottom: 4mm;
    margin-bottom: 4mm;
  }

  .print-title {
    font-size: 14pt;
    font-weight: 800;
    margin-bottom: 2mm;
  }

  .print-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2mm 6mm;
    font-size: 9pt;
  }

  .print-flag-block {
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 3mm;
    margin-bottom: 3mm;
    page-break-inside: avoid;
    font-size: 8.5pt;
  }

  .print-flag-header {
    font-weight: bold;
    margin-bottom: 1mm;
  }

  .print-flag-legal {
    font-size: 8pt;
    color: #334155;
    margin: 1.5mm 0;
  }

  .print-flag-q {
    font-style: italic;
    background: #f8fafc;
    padding: 1.5mm 2mm;
    border-left: 2px solid #0f172a;
  }
}
