/* =============================================================
   CFDI a PDF — styles.css
   1. Tokens  2. Reset  3. Utils  4. Layout  5. Tool card
   6. Representación  7. Contenido/SEO  8. Historial  9. Ads
   10. Footer  11. Responsive  12. Reduced-motion / dark
   ============================================================= */

/* 1. Tokens ------------------------------------------------- */
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f0f3f7;
  --ink: #1c2430;
  --ink-soft: #5a6675;
  --line: #dde3ea;
  --accent: #1b6ef3;
  --accent-ink: #ffffff;
  --ok: #17864a;
  --bad: #c0392b;
  --warn-bg: #fff5e6;
  --warn-ink: #8a5a00;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20,30,45,.06), 0 10px 30px rgba(20,30,45,.07);
  --sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --maxw: 940px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* 2. Reset ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; line-height: 1.15; letter-spacing: -0.02em; }
code { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* 3. Utils ------------------------------------------------- */
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 999;
  padding: .6rem 1rem; background: var(--surface); color: var(--ink);
  border-radius: 8px; font-weight: 600; box-shadow: var(--shadow);
}
.skip-link:focus { top: 1rem; }
.muted { color: var(--ink-soft); }
.tiny { font-size: .82rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sub { display: block; font-size: .78rem; color: var(--ink-soft); }

/* 4. Layout ---------------------------------------------- */
.site-head {
  max-width: var(--maxw); margin: 0 auto; padding: 1rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { display: inline-flex; align-items: center; gap: .5rem; color: var(--ink); font-weight: 700; font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.site-head nav a { color: var(--ink-soft); font-weight: 600; font-size: .95rem; }

main { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem 3rem; }

.hero { padding-top: .5rem; }
.hero h1 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(1.7rem, 4.5vw, 2.5rem); margin-bottom: .5rem;
}
.lede { font-size: 1.05rem; color: var(--ink-soft); max-width: 46ch; margin-bottom: 1.4rem; }

/* 5. Tool card ------------------------------------------- */
.tool-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.1rem;
}
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .45rem; text-align: center;
  min-height: 180px; padding: 1.5rem;
  border: 2px dashed var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink-soft);
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--accent); background: #eef4ff; color: var(--ink); }
.dropzone svg { color: var(--accent); }
.dz-title { font-weight: 700; font-size: 1.05rem; color: var(--ink); }
.dz-sub { font-size: .9rem; }

.flash {
  margin-top: .8rem; padding: .6rem .8rem; border-radius: var(--radius-sm);
  background: var(--warn-bg); color: var(--warn-ink); font-size: .9rem; font-weight: 500;
}

.tool-bar { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .9rem; }
.tool-bar:empty { margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1rem; border-radius: var(--radius-sm); font-weight: 600; font-size: .95rem;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: transform .12s var(--ease), background .15s var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn[disabled] { opacity: .6; cursor: progress; }

/* file list */
.file-list { list-style: none; margin-top: 1rem; display: grid; gap: .5rem; }
.fi {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  padding: .6rem .75rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer;
}
.fi.is-sel { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(27,110,243,.15); }
.fi-main { min-width: 0; }
.fi-name { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fi-meta { display: block; font-size: .82rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fi-bad .fi-name { color: var(--bad); }
.fi-act { display: flex; gap: .4rem; flex-shrink: 0; }
.btn-mini {
  padding: .35rem .6rem; font-size: .82rem; font-weight: 600;
  border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2);
}
.btn-mini.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-mini[disabled] { opacity: .6; cursor: progress; }

/* 6. Representación en pantalla -------------------------- */
.cfdi-detail { margin-top: 1rem; }
.notice { padding: .7rem .9rem; border-radius: var(--radius-sm); font-size: .9rem; margin-bottom: .8rem; }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); }

.rep { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.rep-h {
  display: flex; flex-wrap: wrap; gap: .8rem; justify-content: space-between; align-items: flex-start;
  padding: .9rem 1rem; background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.tag {
  display: inline-block; padding: .15rem .5rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: .75rem; font-weight: 600; color: var(--ink-soft);
}
.rep-uuid { text-align: right; }
.rep-uuid span { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
.rep-uuid strong { font-size: .9rem; word-break: break-all; }

.rep-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); }
.rep-box { background: var(--surface); padding: .9rem 1rem; }
.rep-box h3 { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); margin-bottom: .5rem; }
.rep-box dl, .rep-meta { margin: 0; }
.dl { display: grid; grid-template-columns: 40% 60%; gap: .3rem; padding: .22rem 0; font-size: .9rem; }
.dl dt { color: var(--ink-soft); }
.dl dd { font-weight: 500; word-break: break-word; }

.rep-meta { padding: .9rem 1rem; border-top: 1px solid var(--line); background: var(--surface); }

.table-scroll { overflow-x: auto; border-top: 1px solid var(--line); }
.rep-table { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 560px; }
.rep-table th, .rep-table td { padding: .5rem .6rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.rep-table thead th { background: var(--surface-2); font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-soft); }
.rep-table td.num, .rep-table th.num { text-align: right; }

.rep-tot { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; padding: 1rem; background: var(--surface); }
.rep-impuestos { font-size: .85rem; color: var(--ink-soft); min-width: 200px; }
.tt { display: flex; justify-content: space-between; gap: 1rem; padding: .15rem 0; }
.rep-sum { margin-left: auto; min-width: 240px; }
.rep-sum > div { display: flex; justify-content: space-between; gap: 1.5rem; padding: .2rem 0; font-size: .92rem; }
.rep-sum dt { color: var(--ink-soft); }
.rep-sum dd { font-variant-numeric: tabular-nums; font-weight: 600; }
.rep-sum .grand { border-top: 2px solid var(--ink); margin-top: .3rem; padding-top: .4rem; font-size: 1.1rem; }
.rep-letra { padding: 0 1rem 1rem; font-size: .82rem; color: var(--ink-soft); font-style: italic; }

.rep-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; padding: 1rem; border-top: 1px solid var(--line); background: var(--surface-2); }

/* badges & disclaimers */
.privacy-badge { margin-top: 1rem; font-weight: 600; font-size: .95rem; }
.limits, .disclaimer { margin-top: .5rem; font-size: .88rem; color: var(--ink-soft); }
.disclaimer { padding: .7rem .9rem; background: var(--warn-bg); color: var(--warn-ink); border-radius: var(--radius-sm); }

/* 7. Contenido / SEO ------------------------------------ */
.content { margin-top: 2.5rem; }
.content h2 { font-family: var(--serif); font-weight: 600; font-size: clamp(1.3rem, 3vw, 1.7rem); margin: 2rem 0 .8rem; }
.content p { margin-bottom: .9rem; max-width: 68ch; }

.steps { list-style: none; display: grid; gap: 1rem; grid-template-columns: repeat(3, 1fr); margin: 1rem 0 1.5rem; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1rem; }
.steps svg { width: 26px; height: 26px; color: var(--accent); margin-bottom: .5rem; }
.steps h3 { font-size: 1rem; margin-bottom: .3rem; }
.steps p { font-size: .9rem; color: var(--ink-soft); margin: 0; }

.faqs { display: grid; gap: .5rem; max-width: 68ch; }
.faq { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.faq summary { padding: .8rem 1rem; font-weight: 600; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; float: right; color: var(--ink-soft); }
.faq[open] summary::after { content: "–"; }
.faq-a { padding: 0 1rem 1rem; }
.faq-a p { font-size: .92rem; color: var(--ink-soft); margin: 0; }

/* 8. Historial ------------------------------------------ */
.historial-box { margin-top: 2rem; }
.hist-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; }
.hist-head h3 { font-size: 1rem; }
.link-btn { color: var(--accent); font-weight: 600; font-size: .88rem; text-decoration: underline; }
.hist-table { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 520px; }
.hist-table th, .hist-table td { padding: .45rem .6rem; text-align: left; border-bottom: 1px solid var(--line); }
.hist-table thead th { color: var(--ink-soft); font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; }
.hist-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.hist-table td.uuid { font-family: ui-monospace, Menlo, monospace; font-size: .78rem; color: var(--ink-soft); }

/* tools grid */
.tools-grid { list-style: none; display: grid; gap: 1rem; grid-template-columns: repeat(3, 1fr); margin-top: 1rem; }
.tool-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1rem; position: relative; }
.tool-item h3 { font-size: 1rem; margin-bottom: .3rem; }
.tool-item p { font-size: .88rem; color: var(--ink-soft); margin: 0; }
.soon-tag { display: inline-block; margin-top: .6rem; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); background: var(--surface-2); padding: .15rem .5rem; border-radius: 999px; }

/* 9. Ad slots ------------------------------------------- */
.ad-slot {
  max-width: var(--maxw); margin: 1.6rem auto; min-height: 110px;
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
  color: var(--ink-soft); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em;
  background: repeating-linear-gradient(45deg, transparent, transparent 12px, rgba(0,0,0,.015) 12px, rgba(0,0,0,.015) 24px);
}
.content .ad-slot { margin: 2rem 0; }

/* 10. Footer ------------------------------------------- */
.site-foot { max-width: var(--maxw); margin: 0 auto; padding: 2rem 1.25rem 3rem; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: .88rem; }
.site-foot p { margin-bottom: .4rem; }
.site-foot a { color: var(--ink-soft); text-decoration: underline; }

/* 11. Responsive -------------------------------------- */
@media (max-width: 720px) {
  .steps, .tools-grid { grid-template-columns: 1fr; }
  .rep-grid { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 45% 55%; }
  .rep-sum { min-width: 100%; }
}

/* 12. Reduced-motion / dark -------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a;
    --surface: #171e26;
    --surface-2: #1e2732;
    --ink: #e7ecf2;
    --ink-soft: #9aa7b4;
    --line: #2b3642;
    --accent: #4d9bff;
    --warn-bg: #33280f;
    --warn-ink: #f0c375;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
  }
  .dropzone:hover, .dropzone.is-drag { background: #1b2b44; }
  .ad-slot { background: repeating-linear-gradient(45deg, transparent, transparent 12px, rgba(255,255,255,.02) 12px, rgba(255,255,255,.02) 24px); }
}
