/* ═══════════════════════════════════════════
   RECURSOS / TOOLKIT — Sección de descargas
   Coherente con el design system Navy Progression
   ═══════════════════════════════════════════ */

/* ── Hero: usa .page-header + .photo-banner estándar del sitio ── */

/* ── Filtros por categoría ── */
.recursos-filters {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 36px;
}
.recursos-filter-btn {
  padding: 9px 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid var(--navy-200);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.22,1,0.36,1);
}
.recursos-filter-btn:hover {
  background: var(--navy-50);
  color: var(--navy-700);
  border-color: var(--navy-300);
}
.recursos-filter-btn.active {
  background: var(--navy-800);
  color: #fff;
  border-color: var(--navy-800);
}

/* ── Grid de cards ── */
.recursos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* ── Card de recurso ── */
.recurso-card {
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(220,230,243,0.6);
  padding: 28px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.22,1,0.36,1);
}
.recurso-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
  pointer-events: none;
}
.recurso-card:hover::before {
  animation: shineSlide 0.7s ease-out;
}
.recurso-card:hover {
  box-shadow: 0 14px 40px rgba(30,52,96,0.1), 0 0 0 1px rgba(79,122,189,0.08);
  border-color: var(--navy-200);
  transform: translateY(-4px);
}
.recurso-card.hidden {
  display: none;
}

/* ── Icono del recurso ── */
.recurso-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--navy-50);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  transition: all 0.3s;
}
.recurso-icon svg {
  width: 18px;
  height: 18px;
  stroke: var(--navy-500);
  stroke-width: 1.5;
  fill: none;
}
.recurso-card:hover .recurso-icon {
  background: var(--navy-100);
}

/* ── Badge de categoría ── */
.recurso-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  align-self: flex-start;
}
.recurso-badge-regulacion {
  background: var(--navy-50);
  color: var(--navy-600);
}
.recurso-badge-herramientas {
  background: var(--warm-50);
  color: var(--warm-600);
}
.recurso-badge-empresa {
  background: rgba(43,158,139,0.08);
  color: #2B9E8B;
}

/* ── Badge "Nuevo" ── */
.recurso-new {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--navy-800);
  color: #fff;
}

/* ── Contenido textual ── */
.recurso-card h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 17px;
  color: var(--ink);
  margin-bottom: 8px;
  line-height: 1.35;
}
.recurso-card .recurso-desc {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.7;
  flex: 1;
  margin-bottom: 16px;
}
.recurso-meta {
  font-size: 11.5px;
  color: var(--ink-faint);
  margin-bottom: 16px;
}
.recurso-meta svg {
  width: 13px;
  height: 13px;
  stroke: var(--ink-faint);
  stroke-width: 1.5;
  fill: none;
  vertical-align: -2px;
  margin-right: 3px;
}

/* ── Botón de descarga ── */
.recurso-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 24px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--navy-200);
  background: transparent;
  color: var(--navy-600);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.22,1,0.36,1);
  align-self: flex-start;
}
.recurso-download svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}
.recurso-download:hover {
  background: var(--navy-800);
  color: #fff;
  border-color: var(--navy-800);
  transform: translateY(-1px);
}
.recurso-download:hover svg {
  stroke: #fff;
}

/* ── Teaser en inicio ── */
.recursos-teaser {
  text-align: center;
  padding: 48px 30px;
  background: var(--navy-50);
  border-radius: 16px;
  margin: 0 auto;
  max-width: 840px;
}
.recursos-teaser .eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--navy-500);
  margin-bottom: 10px;
}
.recursos-teaser h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 24px;
  color: var(--ink);
  margin-bottom: 10px;
}
.recursos-teaser p {
  font-size: 14px;
  color: var(--ink-soft);
  max-width: 520px;
  margin: 0 auto 20px;
  line-height: 1.7;
}
.recursos-teaser-items {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.recursos-teaser-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--ink-soft);
  padding: 4px 12px;
  background: #fff;
  border-radius: 6px;
  border: 1px solid rgba(220,230,243,0.6);
}
.recursos-teaser-item svg {
  width: 14px;
  height: 14px;
  stroke: var(--navy-500);
  stroke-width: 1.5;
  fill: none;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .recursos-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}
@media (max-width: 600px) {
  .recursos-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .recursos-filters {
    gap: 6px;
  }
  .recursos-filter-btn {
    padding: 7px 16px;
    font-size: 12px;
  }
  .recursos-teaser {
    padding: 32px 20px;
  }
  .recursos-teaser h3 {
    font-size: 20px;
  }
}

/* ── Dark mode ── */
[data-theme="dark"] .recurso-card {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
}
[data-theme="dark"] .recurso-card:hover {
  box-shadow: 0 14px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
}
[data-theme="dark"] .recurso-card::before {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
}
[data-theme="dark"] .recurso-icon {
  background: rgba(255,255,255,0.06);
}
[data-theme="dark"] .recurso-card:hover .recurso-icon {
  background: rgba(255,255,255,0.1);
}
[data-theme="dark"] .recurso-badge-regulacion {
  background: rgba(107,130,160,0.15);
  color: var(--navy-600);
}
[data-theme="dark"] .recurso-badge-herramientas {
  background: rgba(196,150,66,0.12);
  color: var(--warm-500);
}
[data-theme="dark"] .recurso-badge-empresa {
  background: rgba(43,158,139,0.12);
  color: var(--accent);
}
[data-theme="dark"] .recurso-new {
  background: var(--accent);
}
[data-theme="dark"] .recurso-download {
  border-color: var(--border-subtle);
  color: var(--navy-600);
}
[data-theme="dark"] .recurso-download:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
[data-theme="dark"] .recursos-filter-btn {
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}
[data-theme="dark"] .recursos-filter-btn:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.12);
}
[data-theme="dark"] .recursos-filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
[data-theme="dark"] .recursos-teaser {
  background: var(--bg-surface);
}
[data-theme="dark"] .recursos-teaser-item {
  background: var(--bg-elevated);
  border-color: var(--border-subtle);
}

/* ═══════════════════════════════════════════
   PÁGINA DE ESTADÍSTICAS (protegida)
   ═══════════════════════════════════════════ */

/* ── Pantalla de autenticación ── */
.stats-auth {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-page, #f8f9fb);
}
.stats-auth-box {
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(11,18,34,0.08);
}
.stats-auth-icon {
  color: var(--navy-400);
  margin-bottom: 16px;
}
.stats-auth-box h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  color: var(--ink);
  margin-bottom: 6px;
}
.stats-auth-box p {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.6;
  margin-bottom: 20px;
}
.stats-auth-field {
  margin-bottom: 16px;
}
.stats-auth-field input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--navy-100);
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.3s;
}
.stats-auth-field input:focus {
  border-color: var(--navy-400);
  box-shadow: 0 0 0 3px rgba(79,122,189,0.1);
}
.stats-auth-field input.error {
  border-color: #e74c3c;
}
.stats-auth-error {
  font-size: 12px;
  color: #e74c3c;
  margin-top: 6px;
  display: none;
}
.stats-auth-error.visible {
  display: block;
}
.stats-auth-btn {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: var(--navy-800);
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}
.stats-auth-btn:hover {
  background: var(--navy-700);
  transform: translateY(-1px);
}

/* ── Dashboard ── */
.stats-dashboard.hidden { display: none; }

.stats-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 36px;
}
@media (min-width: 900px) {
  .stats-summary { grid-template-columns: repeat(6, 1fr); }
}
.stats-card {
  background: #fff;
  border: 1px solid rgba(220,230,243,0.5);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}
.stats-card-value {
  font-family: 'DM Serif Display', serif;
  font-size: 32px;
  color: var(--navy-700);
  line-height: 1;
}
.stats-card-label {
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}
.stats-card-sub {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 8px;
  line-height: 1.4;
}
.stats-card-sub-inline {
  font-size: 16px;
  color: var(--ink-faint);
  font-weight: 400;
}
.stats-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.stats-bar-wrap span {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}
.stats-bar {
  height: 6px;
  background: var(--navy-400);
  border-radius: 3px;
  min-width: 2px;
  max-width: 100px;
  transition: width 0.3s ease;
}
.stats-total-row td {
  border-top: 2px solid var(--navy-200) !important;
  border-bottom: none !important;
  padding-top: 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink);
}

/* ── Tabla ── */
.stats-section-title {
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 14px;
}
.stats-table-wrap {
  background: #fff;
  border: 1px solid rgba(220,230,243,0.5);
  border-radius: 12px;
  padding: 20px;
  overflow-x: auto;
}
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.stats-table th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 2px solid var(--navy-100);
  color: var(--ink-faint);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.stats-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(220,230,243,0.4);
  color: var(--ink-soft);
}
.stats-table tbody tr:last-child td { border-bottom: none; }
.stats-table .stats-rank { font-weight: 700; color: var(--navy-600); }
.stats-table .stats-empty {
  text-align: center;
  padding: 24px;
  color: var(--ink-faint);
  font-style: italic;
}

.stats-badge {
  display: inline-block;
  background: var(--navy-100);
  color: var(--navy-600);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
}
.stats-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--navy-50);
  color: var(--navy-500);
  white-space: nowrap;
}
#stats-sections .stats-table-wrap { margin-top: 32px; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .stats-summary { grid-template-columns: 1fr; }
  .stats-auth-box { padding: 28px 20px; }
}

/* ── Dark mode ── */
[data-theme="dark"] .stats-auth { background: var(--bg-page); }
[data-theme="dark"] .stats-auth-box {
  background: var(--bg-surface);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
[data-theme="dark"] .stats-auth-field input {
  background: var(--bg-elevated);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}
[data-theme="dark"] .stats-auth-btn { background: var(--accent); }
[data-theme="dark"] .stats-auth-btn:hover { background: #34b8a0; }
[data-theme="dark"] .stats-card {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
}
[data-theme="dark"] .stats-card-value { color: var(--accent); }
[data-theme="dark"] .stats-table-wrap {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
}
[data-theme="dark"] .stats-table th { border-bottom-color: var(--border-subtle); }
[data-theme="dark"] .stats-table td { border-bottom-color: var(--border-subtle); }
[data-theme="dark"] .stats-badge { background: rgba(42,157,143,0.15); color: var(--accent); }
[data-theme="dark"] .stats-tag { background: rgba(255,255,255,0.06); color: var(--text-secondary); }
[data-theme="dark"] .stats-bar { background: var(--accent); }
[data-theme="dark"] .stats-total-row td { border-top-color: var(--border-subtle) !important; }
[data-theme="dark"] .stats-card-sub-inline { color: var(--text-muted); }
