:root {
  /* Paleta */
  --navy: #1C2A5C;
  --blue: #007BC5;
  --blue-2: #1B81C4;
  --celeste: #64C4DC;
  --green: #7CB845;
  --yellow: #F8C339;
  --red: #E15B4F;

  --bg: #f4fafc;
  --surface: #ffffff;
  --surface-2: #edf5f9;
  --text: #1C2A5C;
  --muted: #5a6b90;
  --border: rgba(28, 42, 92, 0.10);
  --accent: #007BC5;
  --accent-dark: #0062a8;
  --accent-soft: rgba(0, 123, 197, 0.12);
  --shadow: 0 8px 24px rgba(28, 42, 92, 0.08);
  --radius: 14px;
}
[data-theme="dark"] {
  --bg: #0e1636;
  --surface: #182148;
  --surface-2: #1f2a52;
  --text: #eef4fb;
  --muted: #a3b3d6;
  --border: rgba(255, 255, 255, 0.10);
  --accent: #4db5e8;
  --accent-dark: #64C4DC;
  --accent-soft: rgba(100, 196, 220, 0.15);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.ico {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.hint { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ─── Navegación ─── */
nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  transition: background 0.3s;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--blue), var(--celeste));
}
.brand-mark svg { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.logo { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; }
.logo span { color: var(--accent); }
.nav-links { display: flex; gap: 28px; font-size: 14px; color: var(--muted); }
.nav-links a:hover { color: var(--text); }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  background: transparent; border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Botones ─── */
.btn-primary, .btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; font: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: background 0.2s, border-color 0.2s, transform 0.1s;
}
.btn-primary { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
[data-theme="dark"] .btn-primary { color: var(--navy); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); font-weight: 600; }
.btn-ghost:hover { border-color: var(--accent); }
.btn-primary:active, .btn-ghost:active { transform: scale(0.97); }
.btn-ghost.small { padding: 6px 12px; font-size: 13px; }
.btn-ghost.small .ico { width: 15px; height: 15px; }

/* ─── Hero ─── */
.hero {
  display: grid; grid-template-columns: 1fr 1.05fr; align-items: center; gap: 48px;
  max-width: 1200px; margin: 0 auto; padding: 56px 32px 32px;
}
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-soft); color: var(--accent-dark);
  padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; margin-bottom: 18px;
}
.tag .ico { width: 14px; height: 14px; }
[data-theme="dark"] .tag { color: var(--accent); }
.hero h1 { font-size: 46px; font-weight: 800; line-height: 1.08; letter-spacing: -1px; margin-bottom: 18px; }
.hero h1 span { color: var(--accent); }
.hero-text > p { font-size: 16px; color: var(--muted); line-height: 1.65; max-width: 480px; margin-bottom: 24px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
}
.chip::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--c); }
.pdf { --c: var(--red); }
.doc { --c: var(--blue); }
.xls { --c: var(--green); }
.ppt { --c: #F39A2B; }
.csv { --c: var(--celeste); }
.md  { --c: var(--navy); }
[data-theme="dark"] .md { --c: var(--accent); }

/* ─── Tarjeta de conversión ─── */
.converter { padding: 20px 22px 22px; }
.art-wrap { max-width: 440px; margin: -8px auto 4px; aspect-ratio: 750 / 380; overflow: hidden; }
.art-wrap svg { width: 100%; height: auto; display: block; margin-top: -9%; }

.drop {
  border: 2px dashed var(--border); border-radius: 12px; background: var(--surface-2);
  padding: 22px 16px; text-align: center; cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.drop:hover, .drop:focus-visible, .drop.over { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.drop.over { transform: scale(1.01); }
.drop-icon {
  width: 44px; height: 44px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(0, 123, 197, 0.35);
}
[data-theme="dark"] .drop-icon { color: var(--navy); }
.drop.over .drop-icon { animation: bob 0.8s ease-in-out infinite alternate; }
.drop-title { font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.link { color: var(--accent); font-weight: 600; }

/* Progreso */
.progress { padding: 4px 4px 0; }
.progress-file { display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 700; font-size: 14px; margin-bottom: 14px; }
.progress-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.steps { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.steps li { display: flex; align-items: center; gap: 8px; opacity: 0.45; transition: opacity 0.3s; }
.steps li strong { display: block; font-size: 13px; }
.steps li small { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.dot {
  width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center;
  border: 2px solid var(--border); color: transparent; position: relative;
}
.dot .ico { width: 14px; height: 14px; stroke-width: 3; }
.steps li.active, .steps li.done { opacity: 1; }
.steps li.active .dot { border-color: var(--accent-soft); }
.steps li.active .dot::after {
  content: ""; position: absolute; inset: -2px; border-radius: 50%;
  border: 2px solid var(--accent); border-right-color: transparent; animation: spin 0.8s linear infinite;
}
.steps li.done .dot { background: var(--green); border-color: var(--green); color: #fff; animation: pop 0.35s ease-out; }

.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; position: relative; }
.bar span {
  position: absolute; inset: 0 auto 0 0; width: 0%; border-radius: 99px;
  background: linear-gradient(90deg, var(--blue), var(--celeste)); transition: width 0.25s ease;
}
.bar.indeterminate span { width: 35%; animation: slide 1.2s ease-in-out infinite; }
.bar.complete span { width: 100%; background: var(--green); }
#progressMsg { margin-top: 10px; min-height: 1.3em; }

.status { font-size: 14px; text-align: center; }
.status:not(:empty) { margin-top: 12px; padding: 10px 12px; border-radius: 10px; }
.status.error { color: var(--red); background: rgba(225, 91, 79, 0.1); }

/* ─── Animación de la ilustración ─── */
.conv-art .art-gear, .conv-art .art-paper, .conv-art .art-stack,
.conv-art .art-folder-out, .conv-art .art-sparkles { transform-box: fill-box; transform-origin: center; }
[data-theme="dark"] .art-bg { opacity: 0.35; }
.is-idle .art-paper { animation: bob 3.2s ease-in-out infinite alternate; }
.is-idle .p2 { animation-delay: -1s; }
.is-idle .p3 { animation-delay: -2s; }
.is-idle .art-sparkles { animation: twinkle 3s ease-in-out infinite; }

.is-working .art-gear { animation: spin 3s linear infinite; }
.is-working .gear2 { animation-direction: reverse; animation-duration: 2.2s; }
.is-working .gear3 { animation-duration: 4s; }
.is-working .art-paper { animation: fly 2.4s ease-in-out infinite; }
.is-working .p2 { animation-delay: 0.8s; }
.is-working .p3 { animation-delay: 1.6s; }
.is-working .art-arcs { animation: pulse 1.6s ease-in-out infinite; }
.is-working .art-sparkles { animation: twinkle 1s ease-in-out infinite; }
.is-working .art-stack { animation: bob 0.6s ease-in-out infinite alternate; }

.is-done .art-folder-out { animation: bounce 0.6s ease-out 2; }
.is-done .art-sparkles { animation: pop 0.5s ease-out; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-6px); } }
@keyframes twinkle { 50% { opacity: 0.35; } }
@keyframes pulse { 50% { opacity: 0.4; } }
@keyframes pop { 0% { transform: scale(0.6); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes bounce { 30% { transform: translateY(-14px); } 60% { transform: translateY(0); } 80% { transform: translateY(-5px); } }
@keyframes slide { 0% { left: -35%; } 100% { left: 100%; } }
@keyframes fly {
  0%   { transform: translate(-70px, 50px) scale(0.5) rotate(-20deg); opacity: 0; }
  20%  { opacity: 1; }
  50%  { transform: translate(0, -12px) scale(1) rotate(0deg); }
  80%  { opacity: 1; }
  100% { transform: translate(70px, 50px) scale(0.5) rotate(20deg); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

/* ─── Secciones ─── */
section { max-width: 1200px; margin: 0 auto; padding: 32px 32px; }
.section-title { font-size: 22px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.bar-accent { width: 4px; height: 22px; background: var(--accent); border-radius: 2px; }
.section-sub { font-size: 14px; color: var(--muted); margin: -6px 0 20px; max-width: 720px; line-height: 1.6; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Resultado */
#result { animation: rise 0.4s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.result-card { overflow: hidden; }
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.file-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.file-info strong { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 340px; }
.actions { display: flex; gap: 8px; }
.tabs { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.tab {
  border: 0; background: transparent; color: var(--muted); padding: 7px 14px; border-radius: 8px;
  cursor: pointer; font: inherit; font-size: 13px; font-weight: 600;
}
.tab.active { background: var(--surface); color: var(--accent); box-shadow: 0 1px 4px rgba(28, 42, 92, 0.12); }

/* Hoja de documento (simula una página carta: 8.5in ≈ 816px) */
.paper-wrap {
  background: #e9eef4; padding: 32px 24px; max-height: 78vh; overflow: auto;
  background-image: radial-gradient(rgba(28, 42, 92, 0.07) 1px, transparent 1px); background-size: 18px 18px;
}
[data-theme="dark"] .paper-wrap { background-color: #0a1029; background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px); }
.paper {
  display: block; width: 100%; max-width: 816px; margin: 0 auto; border: 0; border-radius: 4px;
  background: #fff; color: #1f2937; padding: 72px 80px; min-height: 600px;
  box-shadow: 0 1px 3px rgba(28, 42, 92, 0.12), 0 12px 32px rgba(28, 42, 92, 0.14);
}
[data-theme="dark"] .paper { box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55); }

.pages { display: flex; flex-direction: column; align-items: center; }
.pages .paper + .page-label, .pages .paper { flex: none; }
.page-label { font-size: 12px; color: #7b8aa8; margin: 10px 0 26px; letter-spacing: 0.3px; }
.pages > .paper:last-child { margin-bottom: 0; }
@media (min-width: 900px) { .pages .paper { min-height: 1056px; } } /* alto de una hoja carta */

/* Tipografía del documento: siempre en "papel" claro, también en modo oscuro */
.preview { font-family: Georgia, "Times New Roman", serif; font-size: 16px; line-height: 1.7; overflow-wrap: anywhere; }
.preview > :first-child { margin-top: 0; }
.preview h1, .preview h2, .preview h3, .preview h4 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1C2A5C; line-height: 1.25; margin: 1.6em 0 0.6em;
}
.preview h1 { font-size: 30px; padding-bottom: 10px; border-bottom: 2px solid #e5eaf2; }
.preview h2 { font-size: 23px; padding-bottom: 6px; border-bottom: 1px solid #eef1f6; }
.preview h3 { font-size: 19px; }
.preview h4 { font-size: 16px; }
.preview p { margin: 0 0 1em; }
.preview ul, .preview ol { margin: 0 0 1em; padding-left: 1.6em; }
.preview li { margin: 0.3em 0; }
.preview li::marker { color: #007BC5; }
.preview a { color: #007BC5; text-decoration: underline; }
.preview strong { color: #111827; }
.preview hr { border: 0; border-top: 1px solid #e5eaf2; margin: 2em 0; }
.preview img { max-width: 100%; }
.preview table {
  border-collapse: collapse; margin: 1.2em 0 1.6em; display: block; overflow-x: auto; max-width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 13.5px; line-height: 1.45;
}
.preview th { background: #f1f5fa; color: #1C2A5C; font-weight: 700; }
.preview th, .preview td { border: 1px solid #dfe5ee; padding: 7px 12px; text-align: left; vertical-align: top; overflow-wrap: normal; word-break: normal; min-width: 72px; }
.preview tr:nth-child(even) td { background: #fafbfd; }
.preview code { background: #f1f5fa; color: #1C2A5C; padding: 1px 5px; border-radius: 4px; font-size: 0.88em; }
.preview pre { background: #f1f5fa; padding: 14px; border-radius: 6px; overflow: auto; }
.preview pre code { background: none; padding: 0; }
.preview blockquote { border-left: 3px solid #007BC5; padding: 2px 0 2px 14px; color: #5a6b90; margin: 0 0 1em; }

/* Vista Markdown: misma hoja, en estilo de editor */
.raw {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.7;
  padding: 40px 48px; min-height: 600px; height: 70vh; resize: vertical; outline: none; white-space: pre-wrap;
}
[data-theme="dark"] .raw { background: #121a3a; color: #dbe6f5; }

/* Badges de archivo */
.file-badge {
  width: 44px; height: 52px; flex: none; position: relative; display: grid; place-items: end center;
  padding-bottom: 8px; border-radius: 6px 14px 6px 6px; background: var(--c);
  color: #fff; font-size: 10px; font-weight: 800; letter-spacing: 0.3px;
  box-shadow: 0 6px 14px rgba(28, 42, 92, 0.15);
}
.file-badge::before {
  content: ""; position: absolute; top: 0; right: 0; width: 14px; height: 14px;
  background: rgba(255, 255, 255, 0.35); border-radius: 0 14px 0 6px;
}

/* Formatos */
.formats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.format-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); transition: transform 0.2s, border-color 0.2s;
}
.format-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.format-card h3 { font-size: 16px; margin: 14px 0 4px; }
.format-card p { font-size: 13px; color: var(--muted); line-height: 1.5; }

/* Beneficios */
.benefits-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 32px; align-items: center; padding: 28px 32px; }
.benefits-art { width: 100%; height: auto; }
.benefits { display: grid; gap: 18px; }
.benefit { display: flex; gap: 14px; align-items: flex-start; }
.benefit h3 { font-size: 15px; font-weight: 700; }
.benefit p { font-size: 13.5px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.benefit-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.benefit-icon.green { background: rgba(124, 184, 69, 0.15); color: var(--green); }
.benefit-icon.blue { background: var(--accent-soft); color: var(--accent); }
.benefit-icon.yellow { background: rgba(248, 195, 57, 0.18); color: #d99a00; }

/* Historial */
.history { list-style: none; display: grid; gap: 10px; }
.history li {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
  animation: rise 0.3s ease-out;
}
.history .file-badge { width: 34px; height: 40px; font-size: 8px; padding-bottom: 5px; border-radius: 5px 10px 5px 5px; }
.history .file-badge::before { width: 10px; height: 10px; border-radius: 0 10px 0 5px; }
.history .info { flex: 1; min-width: 0; }
.history .info strong { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history .info small { color: var(--muted); font-size: 12px; }
.empty { text-align: center; padding: 20px 20px 28px; }
.empty img { width: min(420px, 100%); height: auto; margin: -30px auto -8px; display: block; }
.empty p { margin-top: 4px; }

.credit { text-align: center; font-size: 12px; color: var(--muted); padding: 24px 0 32px; }
.credit a { text-decoration: underline; }

/* ─── Responsive ─── */
.hero > * { min-width: 0; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 28px; padding-top: 36px; }
  .benefits-wrap { grid-template-columns: 1fr; }
  .benefits-art { max-width: 240px; margin: 0 auto; }
}
@media (max-width: 640px) {
  nav { padding: 12px 16px; }
  .nav-links { display: none; }
  .hero, section { padding-left: 16px; padding-right: 16px; }
  .hero h1 { font-size: 34px; }
  .steps li small { display: none; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .actions { justify-content: stretch; }
  .actions > * { flex: 1; justify-content: center; }
  .actions > .icon-btn { flex: none; }
  .paper-wrap { padding: 12px 8px; }
  .paper { padding: 28px 22px; min-height: 0; }
  .preview h1 { font-size: 24px; }
  .preview h2 { font-size: 20px; }
}
