/* ============================================================
   ANÁLISIS PROYECTO REPORTES — ZONAS ÁRIDAS
   Versión 1.0.0 · Auditoría técnica integral
   Tema dark/light unificado con za-theme
   ============================================================ */

:root {
  --h: 217; --s: 91%;
  --bg-page:       hsla(217, 33%, 97%, 1);
  --bg-card:       #ffffff;
  --bg-card-alt:   hsla(217, 33%, 98%, 1);
  --bg-code:       hsla(217, 28%, 95%, 1);
  --text-main:     hsla(220, 40%, 12%, 1);
  --text-muted:    hsla(220, 15%, 45%, 1);
  --text-strong:   hsla(220, 50%, 8%, 1);
  --accent:        hsla(var(--h), var(--s), 50%, 1);
  --accent-soft:   hsla(var(--h), var(--s), 50%, .08);
  --accent-grad:   linear-gradient(135deg, hsla(var(--h), var(--s), 50%, 1), hsla(var(--h), var(--s), 35%, 1));
  --border:        hsla(217, 20%, 88%, 1);
  --border-strong: hsla(217, 20%, 78%, 1);

  --color-ok:      #22c55e;
  --color-warn:    #f59e0b;
  --color-err:     #ef4444;
  --color-info:    #38bdf8;
  --color-violet:  #a855f7;

  --shadow-sm: 0 2px 4px rgba(0,0,0,.04);
  --shadow-md: 0 10px 25px -5px rgba(0,0,0,.08), 0 8px 10px -6px rgba(0,0,0,.04);
  --shadow-lg: 0 20px 40px -12px rgba(0,0,0,.12);
  --radius:    14px;
  --radius-sm: 8px;
  --font:      'Outfit', 'Inter', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

[data-theme='dark'] {
  --bg-page:       #0b1120;
  --bg-card:       #141b2d;
  --bg-card-alt:   #1a2236;
  --bg-code:       #0f1626;
  --text-main:     #f8fafc;
  --text-muted:    #94a3b8;
  --text-strong:   #ffffff;
  --accent:        #3b82f6;
  --accent-soft:   rgba(59, 130, 246, .14);
  --accent-grad:   linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --border:        #1e293b;
  --border-strong: #334155;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
  --shadow-md: 0 15px 30px -10px rgba(0,0,0,.55);
  --shadow-lg: 0 25px 50px -12px rgba(0,0,0,.75);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 100px; }

body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-main);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background .35s ease, color .35s ease;
}

/* ── HEADER STICKY ── */
.site-header {
  position: sticky; top: 1rem; z-index: 100;
  background: hsla(220, 45%, 8%, .9);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  margin: 1rem auto;
  width: min(95%, 1400px);
  box-shadow: 0 10px 40px rgba(0,0,0,.3);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; height: 56px;
}
.header-brand { display: flex; align-items: center; gap: .9rem; color: #fff; }
.header-brand .logo {
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--accent-grad);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.05rem; color: #fff;
}
.header-brand h1 {
  font-size: 1rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1;
}
.header-brand .sub {
  font-size: .72rem; opacity: .65;
}
.header-actions { display: flex; align-items: center; gap: .6rem; }
.version-badge {
  background: rgba(59,130,246,.15); color: #93c5fd;
  border: 1px solid rgba(59,130,246,.3);
  padding: .35rem .7rem; border-radius: 7px;
  font-size: .72rem; font-weight: 700; font-family: var(--font-mono);
}
.theme-btn {
  width: 36px; height: 36px; border-radius: 9px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.05); color: #fff;
  cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all .3s cubic-bezier(.34, 1.56, .64, 1);
}
.theme-btn:hover { transform: rotate(15deg) scale(1.1); background: rgba(255,255,255,.15); }

/* ── LAYOUT ── */
.main {
  width: min(95%, 1400px);
  margin: 0 auto;
  padding: 2rem 0 5rem;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2rem;
}
@media(max-width: 980px) { .main { grid-template-columns: 1fr; } .sidebar { display:none; } }

/* ── SIDEBAR / TOC ── */
.sidebar {
  position: sticky; top: 90px;
  align-self: start;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem .8rem;
  box-shadow: var(--shadow-sm);
}
.sidebar h3 {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-muted); margin: .5rem .5rem .6rem; font-weight: 700;
}
.sidebar a {
  display: block; padding: .45rem .65rem; border-radius: 7px;
  text-decoration: none; color: var(--text-main); font-size: .85rem;
  margin-bottom: 2px; transition: all .15s;
  border-left: 3px solid transparent;
}
.sidebar a:hover { background: var(--accent-soft); color: var(--accent); }
.sidebar a.active { background: var(--accent-soft); color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.sidebar .nav-icon { display: inline-block; width: 18px; opacity: .7; }

/* ── CONTENT ── */
.content { min-width: 0; }
.hero {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
  position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; top: -50%; right: -10%;
  width: 400px; height: 400px;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
  pointer-events: none;
}
.hero .eyebrow {
  display: inline-block; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--accent); margin-bottom: .8rem;
  padding: .3rem .7rem; background: var(--accent-soft); border-radius: 6px;
}
.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800;
  letter-spacing: -.03em; line-height: 1.1;
  margin-bottom: .8rem; color: var(--text-strong);
}
.hero h1 span {
  background: var(--accent-grad); -webkit-background-clip: text;
  -webkit-text-fill-color: transparent; background-clip: text;
}
.hero p { color: var(--text-muted); font-size: 1.05rem; max-width: 75ch; }

/* Section card */
.section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.8rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.section h2 {
  font-size: 1.4rem; font-weight: 700; letter-spacing: -.02em;
  margin-bottom: .6rem; color: var(--text-strong);
  display: flex; align-items: center; gap: .6rem;
}
.section h2 .num {
  font-size: .78rem; font-weight: 800; color: var(--accent);
  background: var(--accent-soft); padding: .25rem .55rem;
  border-radius: 6px; font-family: var(--font-mono);
}
.section h3 {
  font-size: 1.1rem; font-weight: 700; color: var(--text-strong);
  margin: 1.4rem 0 .6rem;
}
.section h4 {
  font-size: .95rem; font-weight: 700; color: var(--text-strong);
  margin: 1rem 0 .4rem;
  text-transform: uppercase; letter-spacing: .04em; font-size: .8rem;
}
.section p { margin-bottom: .8rem; color: var(--text-main); }
.section ul, .section ol { margin: .5rem 0 1rem 1.2rem; }
.section li { margin-bottom: .3rem; color: var(--text-main); }
.section strong { color: var(--text-strong); }
.section a { color: var(--accent); text-decoration: none; border-bottom: 1px dotted var(--accent); }
.section a:hover { border-bottom-style: solid; }

/* ── CODE ── */
code {
  font-family: var(--font-mono); font-size: .85em;
  background: var(--bg-code); color: var(--accent);
  padding: .1em .4em; border-radius: 5px;
}
pre {
  background: var(--bg-code); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 1rem 1.2rem;
  overflow-x: auto; margin: .8rem 0 1.2rem;
  font-family: var(--font-mono); font-size: .82rem; line-height: 1.55;
}
pre code { background: transparent; color: var(--text-main); padding: 0; }
.sql-keyword { color: var(--accent); font-weight: 600; }
.sql-string { color: var(--color-ok); }
.sql-comment { color: var(--text-muted); font-style: italic; }
.sql-number { color: var(--color-warn); }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; margin: 1rem 0 1.4rem; border-radius: var(--radius-sm); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: .65rem .9rem; text-align: left; border-bottom: 1px solid var(--border); }
th {
  background: var(--bg-card-alt); color: var(--text-strong);
  font-weight: 700; font-size: .76rem;
  text-transform: uppercase; letter-spacing: .04em;
  position: sticky; top: 0;
}
tbody tr:hover { background: var(--accent-soft); }
td.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
td.center { text-align: center; }
td.mono { font-family: var(--font-mono); font-size: .8rem; }

/* ── BADGES ── */
.badge {
  display: inline-block; padding: .2rem .55rem; border-radius: 5px;
  font-size: .72rem; font-weight: 700; line-height: 1.3;
  font-family: var(--font-mono);
}
.badge-ok    { background: rgba(34,197,94,.15);   color: var(--color-ok);    border: 1px solid rgba(34,197,94,.3); }
.badge-warn  { background: rgba(245,158,11,.15);  color: var(--color-warn);  border: 1px solid rgba(245,158,11,.3); }
.badge-err   { background: rgba(239,68,68,.15);   color: var(--color-err);   border: 1px solid rgba(239,68,68,.3); }
.badge-info  { background: rgba(56,189,248,.15);  color: var(--color-info);  border: 1px solid rgba(56,189,248,.3); }
.badge-violet{ background: rgba(168,85,247,.15);  color: var(--color-violet);border: 1px solid rgba(168,85,247,.3); }
.badge-neutral{background: var(--accent-soft); color: var(--accent); border: 1px solid var(--border-strong); }

/* ── CALLOUTS ── */
.callout {
  padding: 1rem 1.2rem; border-radius: var(--radius-sm);
  border-left: 4px solid; margin: 1rem 0;
  background: var(--bg-card-alt);
}
.callout-title { font-weight: 700; margin-bottom: .35rem; display: flex; align-items: center; gap: .4rem; }
.callout-info  { border-color: var(--color-info);   background: rgba(56,189,248,.05); }
.callout-info  .callout-title  { color: var(--color-info); }
.callout-warn  { border-color: var(--color-warn);   background: rgba(245,158,11,.05); }
.callout-warn  .callout-title  { color: var(--color-warn); }
.callout-err   { border-color: var(--color-err);    background: rgba(239,68,68,.05); }
.callout-err   .callout-title  { color: var(--color-err); }
.callout-ok    { border-color: var(--color-ok);     background: rgba(34,197,94,.05); }
.callout-ok    .callout-title  { color: var(--color-ok); }

/* ── KPI GRID ── */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem; margin: 1.2rem 0;
}
.kpi {
  background: var(--bg-card-alt); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 1rem 1.2rem;
}
.kpi .label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); font-weight: 700; margin-bottom: .3rem;
}
.kpi .value {
  font-size: 1.5rem; font-weight: 800; color: var(--text-strong);
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.kpi .delta { font-size: .8rem; color: var(--text-muted); margin-top: .2rem; }
.kpi.ok    .value { color: var(--color-ok); }
.kpi.warn  .value { color: var(--color-warn); }
.kpi.err   .value { color: var(--color-err); }
.kpi.info  .value { color: var(--color-info); }

/* ── MODULE CARDS GRID ── */
.modules-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.2rem; margin: 1.5rem 0;
}
.module-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.4rem; text-decoration: none; color: inherit;
  display: block; transition: all .25s; box-shadow: var(--shadow-sm);
}
.module-card:hover {
  border-color: var(--accent); transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.module-card .icon { font-size: 2.2rem; margin-bottom: .6rem; }
.module-card h3 { font-size: 1.1rem; color: var(--text-strong); margin-bottom: .25rem; }
.module-card p { color: var(--text-muted); font-size: .85rem; margin-bottom: .6rem; }
.module-card .stats {
  display: flex; gap: 1rem; font-size: .72rem; color: var(--text-muted);
  border-top: 1px solid var(--border); padding-top: .6rem; margin-top: .6rem;
}
.module-card .stats span strong { color: var(--accent); }

/* ── DIAGRAMS (mermaid containers) ── */
.diagram {
  background: var(--bg-card-alt); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 1.5rem; margin: 1.2rem 0;
  overflow-x: auto; text-align: center;
}
.diagram svg { max-width: 100%; height: auto; }

/* ── ASCII FLOW (pre-formatted diagrams) ── */
.ascii-flow {
  background: var(--bg-code); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 1.5rem 1rem;
  font-family: var(--font-mono); font-size: .78rem; line-height: 1.4;
  white-space: pre; overflow-x: auto; color: var(--text-main);
  margin: 1.2rem 0;
}

/* ── BACK TO TOP ── */
.back-top {
  position: fixed; bottom: 2rem; right: 2rem; z-index: 90;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--accent-grad); color: #fff;
  border: none; cursor: pointer; font-size: 1.2rem;
  box-shadow: var(--shadow-md);
  display: none; align-items: center; justify-content: center;
  transition: all .3s;
}
.back-top.show { display: flex; }
.back-top:hover { transform: translateY(-3px) scale(1.05); }

/* ── BREADCRUMBS ── */
.breadcrumbs {
  font-size: .8rem; color: var(--text-muted); margin-bottom: 1.2rem;
  display: flex; gap: .4rem; align-items: center; flex-wrap: wrap;
}
.breadcrumbs a { color: var(--text-muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { opacity: .5; }
.breadcrumbs .current { color: var(--text-strong); font-weight: 600; }

/* ── METRIC ROW ── */
.metric-row {
  display: flex; gap: 1rem; flex-wrap: wrap;
  padding: .8rem 0; border-bottom: 1px dashed var(--border);
}
.metric-row:last-child { border-bottom: none; }
.metric-row .label { color: var(--text-muted); flex: 1; min-width: 200px; }
.metric-row .value { color: var(--text-strong); font-weight: 600; font-family: var(--font-mono); }

/* ── FOOTER ── */
.footer {
  margin-top: 3rem; padding: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center; color: var(--text-muted); font-size: .82rem;
}
.footer a { color: var(--accent); text-decoration: none; }

/* ── TWO COLUMN ── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
@media(max-width: 720px) { .two-col { grid-template-columns: 1fr; } }

/* ── PRIORITY TAGS ── */
.tag-prio {
  font-size: .68rem; font-weight: 800; padding: .2rem .55rem;
  border-radius: 5px; text-transform: uppercase; letter-spacing: .04em;
  font-family: var(--font-mono); display: inline-block;
}
.prio-critical { background: rgba(239,68,68,.15); color: var(--color-err); border: 1px solid rgba(239,68,68,.4); }
.prio-high     { background: rgba(245,158,11,.15); color: var(--color-warn); border: 1px solid rgba(245,158,11,.4); }
.prio-medium   { background: rgba(56,189,248,.15); color: var(--color-info); border: 1px solid rgba(56,189,248,.4); }
.prio-low      { background: rgba(34,197,94,.12); color: var(--color-ok); border: 1px solid rgba(34,197,94,.3); }
