/* BAI Auditor SEO - dark theme matching the PDF report */
:root {
  --bg: #0A0A0A;
  --bg-soft: #121212;
  --panel: #161616;
  --panel-2: #1d1d1d;
  --divider: #2a2a2a;
  --acento: #FF4500;
  --acento-soft: rgba(255, 69, 0, 0.18);
  --texto: #D1D1D1;
  --texto-suave: #888;
  --ok: #2ECC71;
  --warn: #F1C40F;
  --orange: #E67E22;
  --bad: #E74C3C;
  --crit: #C0392B;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--texto);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--acento); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Topbar ===== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  border-bottom: 1px solid var(--divider);
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.brand-mark {
  font-weight: 900;
  letter-spacing: 1px;
  font-size: 20px;
  color: var(--acento);
}
.brand-sub {
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--texto-suave);
}
.topnav { display: flex; gap: 4px; }
.nav-btn {
  background: transparent;
  border: 0;
  color: var(--texto-suave);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  letter-spacing: 0.5px;
}
.nav-btn:hover { color: var(--texto); background: var(--panel); }
.nav-btn.active { color: var(--acento); background: var(--acento-soft); }

/* ===== Main ===== */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 28px 80px;
}
.view { display: none; }
.view.active { display: block; }

/* ===== Hero ===== */
.hero h1 {
  font-size: 48px;
  margin: 0 0 12px;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--texto);
}
.hero h1 .accent { color: var(--acento); }
.hero .lead {
  font-size: 17px;
  color: var(--texto-suave);
  max-width: 620px;
  margin-bottom: 32px;
}

/* ===== Form ===== */
.audit-form { margin-top: 12px; }
.input-row {
  display: flex;
  align-items: stretch;
  background: var(--panel);
  border: 1px solid var(--divider);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.input-row:focus-within { border-color: var(--acento); }
.input-row + .input-row { margin-top: 10px; }
.input-row.inline-optional { background: var(--bg-soft); }

.input-prefix {
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: var(--texto-suave);
  font-family: monospace;
  font-size: 14px;
  background: var(--bg-soft);
  border-right: 1px solid var(--divider);
}
.input-row input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  padding: 18px 18px;
  color: var(--texto);
  font-size: 16px;
  font-family: inherit;
}
.input-row input::placeholder { color: #666; }

.btn {
  cursor: pointer;
  border: 0;
  font-size: 14px;
  font-weight: 600;
  padding: 0 24px;
  border-radius: 8px;
  font-family: inherit;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: transform 0.05s, background 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--acento);
  color: #0A0A0A;
}
.btn.primary:hover { background: #ff5a1f; text-decoration: none; }
.btn.ghost {
  background: transparent;
  color: var(--texto);
  border: 1px solid var(--divider);
}
.btn.ghost:hover { border-color: var(--acento); color: var(--acento); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

.input-row .btn.primary {
  border-radius: 0;
  padding: 0 28px;
}

.btn-spinner { display: none; }
.btn.loading .btn-label { opacity: 0.5; }
.btn.loading .btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0,0,0,0.3);
  border-top-color: #0A0A0A;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hint { color: var(--texto-suave); font-size: 13px; margin: 14px 4px 0; }

.kpis-marquee {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-top: 50px;
}
.kpi {
  border: 1px solid var(--divider);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--panel);
}
.kpi b {
  font-size: 28px;
  color: var(--acento);
  font-weight: 800;
}
.kpi span {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--texto-suave);
  text-transform: uppercase;
}

/* ===== Progress ===== */
.hidden { display: none !important; }
.progress-panel {
  border: 1px solid var(--divider);
  border-radius: 12px;
  padding: 28px;
  background: var(--panel);
}
.progress-header { margin-bottom: 24px; }
.progress-tag {
  display: inline-block;
  background: var(--acento-soft);
  color: var(--acento);
  letter-spacing: 3px;
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 700;
}
.progress-header h2 {
  margin: 8px 0 0;
  font-size: 22px;
  word-break: break-all;
}
#progress-time { margin: 4px 0 0; color: var(--texto-suave); font-size: 13px; font-variant-numeric: tabular-nums; }

.progress-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  display: grid;
  gap: 8px;
}
.progress-steps li {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--texto-suave);
  font-size: 14px;
  padding-left: 4px;
}
.progress-steps li::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #333;
  flex-shrink: 0;
}
.progress-steps li.done { color: var(--ok); }
.progress-steps li.done::before { background: var(--ok); }
.progress-steps li.active { color: var(--acento); }
.progress-steps li.active::before { background: var(--acento); animation: pulse 1.2s infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--acento-soft); }
  50% { box-shadow: 0 0 0 6px transparent; }
}

.progress-bar {
  height: 6px;
  background: #262626;
  border-radius: 3px;
  overflow: hidden;
}
#progress-bar-fill {
  height: 100%;
  width: 0;
  background: var(--acento);
  transition: width 0.3s ease;
}
.progress-msg {
  margin-top: 14px;
  color: var(--texto-suave);
  font-size: 13px;
}

/* ===== Error ===== */
.error-panel {
  border: 1px solid var(--bad);
  border-radius: 12px;
  padding: 28px;
  background: rgba(231, 76, 60, 0.06);
}
.error-panel h2 { margin: 0 0 8px; color: var(--bad); }

/* ===== Result ===== */
.result {
  display: grid;
  gap: 28px;
}
.result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 28px;
  border: 1px solid var(--divider);
  border-radius: 12px;
  padding: 28px;
  background: var(--panel);
}
.tag {
  display: inline-block;
  letter-spacing: 4px;
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 700;
  background: var(--acento-soft);
  color: var(--acento);
}
.tag.cat-excelente { background: rgba(46, 204, 113, 0.15); color: var(--ok); }
.tag.cat-bueno { background: rgba(241, 196, 15, 0.15); color: var(--warn); }
.tag.cat-mejorable { background: rgba(230, 126, 34, 0.15); color: var(--orange); }
.tag.cat-deficiente { background: rgba(231, 76, 60, 0.15); color: var(--bad); }
.tag.cat-critico { background: rgba(192, 57, 43, 0.18); color: var(--crit); }

.result-header h2 { margin: 10px 0 4px; font-size: 26px; word-break: break-word; }
.muted { color: var(--texto-suave); font-size: 13px; }

.score-circle-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}
.score-circle {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}
.score-circle .track {
  fill: none;
  stroke: #262626;
  stroke-width: 10;
}
.score-circle .arc {
  fill: none;
  stroke: var(--acento);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dasharray 0.8s ease, stroke 0.4s;
}
.score-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.score-text span { font-size: 38px; font-weight: 800; color: var(--texto); }
.score-text small { font-size: 13px; color: var(--texto-suave); }

.result-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ===== Modules grid ===== */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.module-card {
  border: 1px solid var(--divider);
  border-radius: 10px;
  padding: 18px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.module-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.module-card-head h4 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 1px;
  color: var(--texto-suave);
  text-transform: uppercase;
}
.module-card-head .score {
  font-size: 20px;
  font-weight: 700;
}
.module-card .mini-bar {
  height: 6px;
  background: #262626;
  border-radius: 3px;
  overflow: hidden;
}
.module-card .mini-bar > div {
  height: 100%;
  border-radius: 3px;
}
.module-card ul {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
  display: grid;
  gap: 4px;
  max-height: 200px;
  overflow: auto;
}
.module-card li {
  font-size: 12px;
  color: var(--texto-suave);
  display: flex;
  gap: 6px;
  line-height: 1.4;
}
.module-card li b { font-weight: 600; }
.module-card li.ok::before { content: "✓"; color: var(--ok); }
.module-card li.fail::before { content: "✗"; color: var(--bad); }

/* ===== Tables ===== */
.section-title {
  font-size: 18px;
  margin: 8px 0 12px;
  letter-spacing: 0.5px;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--panel);
  border: 1px solid var(--divider);
  border-radius: 10px;
  overflow: hidden;
}
.table thead {
  background: var(--acento);
  color: #0A0A0A;
}
.table th, .table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}
.table tbody tr { border-top: 1px solid var(--divider); }
.table tbody tr:nth-child(odd) { background: rgba(255,255,255,0.015); }
.table td.right { text-align: right; }
.table .btn { padding: 4px 10px; font-size: 12px; }

.history-filter { margin: 0 0 18px; }
.history-filter input {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--divider);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--texto);
  font-size: 14px;
  outline: none;
}
.history-filter input:focus { border-color: var(--acento); }

/* ===== Footer ===== */
.footbar {
  border-top: 1px solid var(--divider);
  padding: 18px 28px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--texto-suave);
}

/* ===== Responsive ===== */
@media (max-width: 720px) {
  .hero h1 { font-size: 34px; }
  .input-row { flex-direction: column; }
  .input-prefix { border-right: 0; border-bottom: 1px solid var(--divider); padding: 12px 16px; }
  .input-row .btn.primary { padding: 16px; }
  .kpis-marquee { grid-template-columns: repeat(2, 1fr); }
  .result-header { flex-direction: column; align-items: center; text-align: center; }
}
