:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel-2: #273449;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --accent-2: #6366f1;
  --good: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --border: #334155;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

/* Foco visible para navegación con teclado (accesibilidad). */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Encabezado / marca ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 0.6rem; }
.logo-mark { width: 34px; height: 34px; display: block; }
.topbar h1 { font-size: 1.2rem; margin: 0; font-weight: 700; }

.lang-select { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; }
.lang-select select {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
}

main { max-width: 800px; margin: 0 auto; padding: 1.5rem; }

/* ---------- Hero / intro ---------- */
.hero {
  text-align: center;
  padding: 1.4rem 1rem 1.1rem;
  background: radial-gradient(60% 120% at 50% 0%, rgba(56, 189, 248, 0.1), transparent 70%);
  border-radius: 16px;
}
.logo-hero {
  width: 100%;
  max-width: 240px;
  height: auto;
  display: block;
  margin: 0 auto 0.75rem;
  filter: drop-shadow(0 8px 24px rgba(14, 165, 233, 0.25));
}

/* Cómo funciona (3 pasos) */
.how { margin-bottom: 1.25rem; }
.steps { display: flex; gap: 0.75rem; }
.step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  font-size: 0.9rem;
  color: var(--muted);
  box-shadow: var(--shadow);
}
.step-num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--accent-strong);
  color: #04263a;
  font-weight: 800;
  font-size: 0.85rem;
}
.tagline {
  color: var(--text);
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.25;
  margin: 0 auto 0.5rem;
  max-width: 34ch;
}
.trust-line {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
}

/* Explicación de qué es un ATS (portada, colapsable). */
.ats-note {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 0.75rem 1.1rem;
  margin-bottom: 1.1rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  box-shadow: var(--shadow);
}
.ats-note summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.ats-note summary::-webkit-details-marker { display: none; }
.ats-note summary::before {
  content: "❓";
  font-size: 0.9rem;
}
.ats-note[open] summary { margin-bottom: 0.5rem; }
.ats-note p { margin: 0; }

/* Opción avanzada: leer oferta desde URL (colapsable). */
.url-advanced { margin-top: 0.85rem; }
.url-advanced summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.9rem;
  list-style: none;
}
.url-advanced summary::-webkit-details-marker { display: none; }
.url-advanced summary::before { content: "▸ "; }
.url-advanced[open] summary::before { content: "▾ "; }

/* Línea de confianza bajo el recuadro de subir el CV. */
.drop-trust {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0.6rem 0 0;
  text-align: center;
}

/* Pantalla de retorno tras pagar en Mercado Pago (pestaña nueva). */
.pay-return { display: flex; justify-content: center; padding: 2.5rem 0; }
.pay-return-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.25rem 1.9rem;
  text-align: center;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
}
.pay-return-icon { font-size: 2.6rem; line-height: 1; margin-bottom: 0.6rem; }
.pay-return-card h2 { margin: 0 0 0.5rem; font-size: 1.4rem; }
.pay-return-card p { color: var(--muted); margin: 0 0 1.3rem; }
.pay-return-card .primary { width: auto; padding: 0.7rem 1.5rem; }

/* Recuadro con el enlace guardable para recuperar el CV. */
.recovery-note {
  background: var(--panel-2);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--muted);
  word-break: break-all;
}
.recovery-note a { color: var(--accent); font-weight: 600; }

/* Aviso de éxito (verde). */
.success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid var(--good);
  color: #bbf7d0;
  border-radius: 10px;
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

/* ---------- Stepper del flujo de generación ---------- */
.stepper {
  display: flex;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
}
.step-pill {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 0.6rem;
  font-size: 0.88rem;
  color: var(--muted);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.pill-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 800;
  font-size: 0.8rem;
}
.step-pill.active {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(56, 189, 248, 0.12);
}
.step-pill.active .pill-num { background: var(--accent-strong); color: #04263a; }
.step-pill.done { color: var(--good); border-color: rgba(34, 197, 94, 0.5); }
.step-pill.done .pill-num { background: var(--good); color: #052e16; }
.step-pill.done .pill-num::after { content: "✓"; }
.step-pill.done .pill-num { font-size: 0; }
.step-pill.done .pill-num::after { font-size: 0.85rem; }

/* Aparición suave de secciones. */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.anim { animation: fadeIn 0.28s ease; }

/* ---------- Tarjetas ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.35rem;
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow);
}
.card h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.hint { color: var(--muted); font-size: 0.9rem; margin-top: 0; }

/* Honeypot: invisible para humanos, pero presente para bots. */
.hp {
  position: absolute;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
  opacity: 0; pointer-events: none;
}

/* Consejo destacado. */
.tip {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #bfe6fb;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  margin: 0 0 0.9rem;
}

.field-label {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0.4rem 0 0.35rem;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 2rem;
  cursor: pointer;
  text-align: center;
  color: var(--muted);
  transition: border-color 0.2s, background 0.2s;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: var(--panel-2);
}
.file-name { color: var(--accent); font-weight: 600; }

textarea, input[type="url"], .text-input {
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
  transition: border-color 0.15s;
}
textarea:focus, input[type="url"]:focus, .text-input:focus {
  border-color: var(--accent);
  outline: none;
}

.banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid var(--warn);
  color: #fcd9a0;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

.url-row { margin-top: 0.85rem; }
.url-row label { display: block; font-size: 0.9rem; color: var(--muted); margin-bottom: 0.35rem; }
.url-input { display: flex; gap: 0.5rem; }
.url-input input { flex: 1; }

/* ---------- Botones ---------- */
button {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.75rem 1.1rem;
  transition: transform 0.05s, background 0.2s, box-shadow 0.2s;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.6; cursor: not-allowed; }

.primary {
  background: var(--accent-strong);
  color: #04263a;
  width: 100%;
  font-size: 1.05rem;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
}
.primary:hover:not(:disabled) { background: var(--accent); }
.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
.secondary:hover:not(:disabled) { background: var(--border); }

.status { font-size: 0.85rem; color: var(--muted); min-height: 1.1rem; }
.error { color: var(--bad); font-weight: 600; min-height: 1.1rem; }

.hidden { display: none !important; }

/* ---------- Cargando ---------- */
#loading-section { text-align: center; padding: 3rem 0; }
.spinner {
  width: 44px; height: 44px; margin: 0 auto 1rem;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Resultados ---------- */
#results-title { font-size: 1.5rem; margin-bottom: 0.25rem; }

.scores { display: flex; gap: 1rem; margin: 1.25rem 0 1.5rem; }
.score-card {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.35rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.score-value { font-size: 2.6rem; font-weight: 800; line-height: 1.1; }
.score-max { font-size: 1.1rem; font-weight: 600; color: var(--muted); }
.score-bar {
  height: 8px;
  background: var(--panel-2);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.55rem 0 0.4rem;
}
.score-bar-fill { height: 100%; width: 0; border-radius: 999px; transition: width 0.6s ease; }
.score-quality { font-size: 0.9rem; font-weight: 700; margin-bottom: 0.35rem; }
.score-label { color: var(--text); font-size: 0.95rem; font-weight: 600; }
.score-desc { color: var(--muted); font-size: 0.85rem; line-height: 1.4; margin-top: 0.25rem; }

.result-block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.1rem 1.35rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.result-block h3 { margin: 0 0 0.6rem; font-size: 1.05rem; font-weight: 700; }
.result-block ul { margin: 0; padding-left: 1.2rem; }
.result-block li { margin-bottom: 0.4rem; }

/* Resumen destacado */
.summary-block {
  border-left: 4px solid var(--accent);
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.08), var(--panel) 40%);
}

.gap-item {
  border-left: 4px solid var(--warn);
  padding: 0.4rem 0 0.4rem 0.75rem;
  margin-bottom: 0.75rem;
}
.gap-item.alta { border-left-color: var(--bad); }
.gap-item.media { border-left-color: var(--warn); }
.gap-item.baja { border-left-color: var(--muted); }
.gap-item strong { display: block; }
.gap-item .sev { font-size: 0.75rem; text-transform: uppercase; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.85rem;
}

.pro-card {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-2));
  color: #fff;
  border-radius: 16px;
  padding: 1.35rem;
  margin: 1.5rem 0 1rem;
  box-shadow: var(--shadow-lg);
}
.pro-card h3 { margin-top: 0; font-size: 1.15rem; }
.pro-card .primary { background: #fff; color: #0b3a56; box-shadow: none; margin-top: 0.5rem; }
.pro-card .primary:hover:not(:disabled) { background: #eaf6ff; }

/* ---------- Fase 2: generación ---------- */
.gen-loading { text-align: center; padding: 2.5rem 0; }

.q-item { margin-bottom: 0.9rem; }
.q-item label {
  display: block;
  font-size: 0.92rem;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.q-item textarea { width: 100%; }

.cv-preview {
  background: #ffffff;
  color: #1f2937;
  border-radius: 16px;
  padding: 2rem 2.25rem;
  margin-top: 1rem;
  box-shadow: var(--shadow-lg);
}
.cv-head { border-bottom: 2px solid #0e7490; padding-bottom: 0.6rem; margin-bottom: 0.5rem; }
.cv-name { font-size: 1.7rem; font-weight: 800; color: #1f2937; }
.cv-headline { color: #0e7490; font-size: 1.05rem; margin-top: 2px; }
.cv-contact { color: #555; font-size: 0.85rem; margin-top: 4px; }
.cv-section { margin-top: 1rem; }
.cv-section h3 {
  color: #0e7490;
  font-size: 1rem;
  border-bottom: 1px solid #cbd5e1;
  padding-bottom: 3px;
  margin: 0 0 0.5rem;
}
.cv-section p { margin: 0.2rem 0; font-size: 0.95rem; }
.cv-section ul { margin: 0.3rem 0 0.3rem 1.1rem; padding: 0; }
.cv-section li { font-size: 0.95rem; margin-bottom: 2px; }
.cv-entry { margin-bottom: 0.7rem; }
.cv-entry-head { font-weight: 700; font-size: 0.98rem; }
.cv-entry-meta { color: #555; font-style: italic; font-size: 0.85rem; margin-bottom: 2px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
  padding: 1.5rem;
  margin-top: 1rem;
}
.footer-links { margin: 0.4rem 0 0; }
.footer-links a { color: var(--accent); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

@media (max-width: 560px) {
  .topbar { padding: 0.8rem 1rem; }
  .tagline { font-size: 1.3rem; }
  .scores { flex-direction: column; }
  .steps { flex-direction: column; }
  .cv-preview { padding: 1.25rem; }
  main { padding: 1.1rem; }
}
