/* ============================================================
   RuniverseHub · RUNIVERSEHUB-FINAL-VISUAL-HARMONIZATION-1.0
   Capa visual final no destructiva para entradas principales.

   Alcance:
   - Armoniza jerarquía visual, densidad, cards, CTAs,
     tablas, menús y lectura mobile en Public / Account /
     Organizer / Athlete / Team / Admin.
   - Incluye el renderer público unificado de clasificaciones
     y pantallas admin históricas ya certificadas.
   - No modifica lógica, formularios, pagos, inscripciones,
     QR, permisos, datos ni JavaScript.
   ============================================================ */

:root {
  --rhfv-bg: #020617;
  --rhfv-surface: rgba(15, 23, 42, .78);
  --rhfv-surface-strong: rgba(15, 23, 42, .92);
  --rhfv-surface-soft: rgba(15, 23, 42, .54);
  --rhfv-border: rgba(148, 163, 184, .18);
  --rhfv-border-strong: rgba(148, 163, 184, .28);
  --rhfv-text: #f8fafc;
  --rhfv-soft: #cbd5e1;
  --rhfv-muted: #94a3b8;
  --rhfv-radius-card: 24px;
  --rhfv-radius-inner: 18px;
  --rhfv-gap: clamp(14px, 2vw, 22px);
  --rhfv-section-gap: clamp(24px, 4vw, 44px);
  --rhfv-card-pad: clamp(16px, 2.4vw, 24px);
  --rhfv-title-h1: clamp(32px, 5vw, 58px);
  --rhfv-title-h2: clamp(22px, 3vw, 34px);
  --rhfv-title-h3: clamp(17px, 2vw, 22px);
  --rhfv-shadow: 0 22px 70px rgba(0, 0, 0, .30), inset 0 1px 0 rgba(255,255,255,.05);
  --rhfv-accent: #2dd4bf;
  --rhfv-accent-2: #22d3ee;
  --rhfv-accent-soft: rgba(45, 212, 191, .11);
  --rhfv-accent-border: rgba(45, 212, 191, .24);
}

/* Acentos por rol/contexto. Mantienen identidad distinta sin romper el sistema. */
body.rh-home-body,
body.rh-public-events-body,
body.ped-body,
.classification-page,
body.rh-cux-team-body {
  --rhfv-accent: #34d399;
  --rhfv-accent-2: #22d3ee;
  --rhfv-accent-soft: rgba(52, 211, 153, .11);
  --rhfv-accent-border: rgba(52, 211, 153, .24);
}

body.account-hub-body,
body.athlete-hub-body,
body.has-athlete-sidebar {
  --rhfv-accent: #67e8f9;
  --rhfv-accent-2: #5eead4;
  --rhfv-accent-soft: rgba(103, 232, 249, .10);
  --rhfv-accent-border: rgba(103, 232, 249, .22);
}

body.rh-org-dashboard-body,
body.rh-ec-body,
body.has-organizer-sidebar {
  --rhfv-accent: #34d399;
  --rhfv-accent-2: #22d3ee;
  --rhfv-accent-soft: rgba(52, 211, 153, .12);
  --rhfv-accent-border: rgba(52, 211, 153, .25);
}

body.rh-team-hub-body,
body.has-team-sidebar,
body.rh-cux-team-body {
  --rhfv-accent: #55f2b1;
  --rhfv-accent-2: #38bdf8;
  --rhfv-accent-soft: rgba(85, 242, 177, .11);
  --rhfv-accent-border: rgba(85, 242, 177, .24);
}

.rh-dashboard-shell,
.rh-admin-tool-main,
.rh-hrr-wrap {
  --rhfv-accent: #818cf8;
  --rhfv-accent-2: #22d3ee;
  --rhfv-accent-soft: rgba(129, 140, 248, .11);
  --rhfv-accent-border: rgba(129, 140, 248, .24);
}

/* Jerarquía de títulos: misma escala, sin forzar estructuras internas. */
body.rh-home-body h1,
body.rh-public-events-body h1,
body.ped-body h1,
body.account-hub-body h1,
body.rh-org-dashboard-body h1,
body.rh-team-hub-body h1,
body.rh-cux-team-body h1,
.classification-page h1,
.rh-dashboard-shell h1,
.rh-admin-tool-main h1,
.rh-hrr-hero h1 {
  font-size: var(--rhfv-title-h1);
  line-height: 1.04;
  letter-spacing: -.045em;
  text-wrap: balance;
}

body.rh-home-body h2,
body.rh-public-events-body h2,
body.ped-body h2,
body.account-hub-body h2,
body.rh-org-dashboard-body h2,
body.rh-team-hub-body h2,
body.rh-cux-team-body h2,
.classification-page h2,
.rh-dashboard-shell h2,
.rh-admin-tool-main h2,
.rh-hrr-panel h2 {
  font-size: var(--rhfv-title-h2);
  line-height: 1.12;
  letter-spacing: -.025em;
  text-wrap: balance;
}

body.rh-home-body h3,
body.rh-public-events-body h3,
body.ped-body h3,
body.account-hub-body h3,
body.rh-org-dashboard-body h3,
body.rh-team-hub-body h3,
body.rh-cux-team-body h3,
.classification-page h3,
.rh-dashboard-shell h3,
.rh-admin-tool-main h3,
.rh-hrr-card-head h3 {
  font-size: var(--rhfv-title-h3);
  line-height: 1.18;
}

/* Cards/paneles principales: armonización suave de borde, radio y sombra. */
body.rh-home-body .rh-card,
body.rh-public-events-body .rh-card,
body.ped-body .ped-panel,
body.ped-body .ped-stat-card,
body.ped-body .ped-distance-card,
body.ped-body .ped-conversion-card,
body.account-hub-body .athlete-panel,
body.rh-org-dashboard-body .rh-org-card,
body.rh-team-hub-body .rh-team-card,
body.rh-cux-team-body .rh-cux-team-card,
.classification-page .classification-stats-panel,
.classification-page .sidebar-card,
.classification-page .classification-table-panel,
.rh-dashboard-shell .rh-dashboard-panel,
.rh-dashboard-shell .rh-dashboard-card,
.rh-admin-tool-main .rh-admin-card,
.rh-admin-tool-main .rh-admin-panel,
.rh-hrr-card,
.rh-hrr-panel,
.rh-hrr-event-card,
.rh-hrr-table-card {
  border-color: var(--rhfv-border);
  border-radius: var(--rhfv-radius-card);
  box-shadow: var(--rhfv-shadow);
}

body.rh-home-body .rh-card:hover,
body.rh-public-events-body .rh-card:hover,
body.ped-body .ped-distance-card:hover,
body.account-hub-body .compact-list a:hover,
body.rh-org-dashboard-body .rh-org-quick-list a:hover,
body.rh-team-hub-body .rh-team-stat-grid article:hover,
.classification-page .nav-table-link:hover,
.classification-page .nav-table-link.is-active,
.rh-dashboard-shell .rh-dashboard-action:hover,
.rh-hrr-mini-link:hover {
  border-color: var(--rhfv-accent-border);
  box-shadow: 0 24px 78px rgba(0,0,0,.35), 0 0 0 1px var(--rhfv-accent-border), inset 0 1px 0 rgba(255,255,255,.06);
}

/* Bloques de intención creados en fases previas. */
[data-onboarding-role-flow="1"],
[data-account-hub-simplification="1"],
[data-organizer-flow-simplification="1"],
[data-team-onboarding-simplification="1"],
[data-admin-information-architecture="1"] {
  position: relative;
  overflow: hidden;
  border-color: var(--rhfv-accent-border) !important;
  background:
    radial-gradient(circle at top left, var(--rhfv-accent-soft), transparent 34%),
    linear-gradient(180deg, rgba(15, 23, 42, .86), rgba(8, 13, 24, .80));
}

[data-onboarding-role-flow="1"]::before,
[data-account-hub-simplification="1"]::before,
[data-organizer-flow-simplification="1"]::before,
[data-team-onboarding-simplification="1"]::before,
[data-admin-information-architecture="1"]::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--rhfv-accent), var(--rhfv-accent-2));
  opacity: .9;
}

[data-onboarding-role-flow="1"] > *,
[data-account-hub-simplification="1"] > *,
[data-organizer-flow-simplification="1"] > *,
[data-team-onboarding-simplification="1"] > *,
[data-admin-information-architecture="1"] > * {
  position: relative;
  z-index: 1;
}

/* Accesos por intención: misma densidad y lectura en roles distintos. */
body.account-hub-body .compact-list a,
body.rh-org-dashboard-body .rh-org-quick-list a,
body.rh-team-hub-body .rh-team-stat-grid article,
.classification-page .nav-distance__button,
.classification-page .nav-group__button,
.classification-page .nav-table-link,
.rh-dashboard-shell .rh-dashboard-action,
.rh-hrr-mini-link {
  min-height: 44px;
  border-radius: var(--rhfv-radius-inner);
  border-color: var(--rhfv-border);
  background: rgba(15, 23, 42, .54);
}

body.account-hub-body .compact-list a,
body.rh-org-dashboard-body .rh-org-quick-list a,
body.rh-team-hub-body .rh-team-stat-grid article,
.rh-dashboard-shell .rh-dashboard-action {
  min-height: 74px;
}

body.account-hub-body .compact-list a strong,
body.rh-team-hub-body .rh-team-stat-grid article strong,
.rh-dashboard-shell .rh-dashboard-action strong,
.classification-page .nav-distance__button span,
.classification-page .nav-table-link span {
  letter-spacing: -.01em;
}

body.account-hub-body .compact-list a small,
body.rh-team-hub-body .rh-team-stat-grid article p,
body.rh-org-dashboard-body .rh-org-card p,
.rh-dashboard-shell .rh-dashboard-action span,
.classification-page .classification-hero__lead,
.classification-page .panel-lead,
.rh-hrr-panel p,
.rh-hrr-source,
.rh-hrr-muted-note {
  color: var(--rhfv-muted);
  line-height: 1.48;
}

/* CTAs: forma común sin pisar colores funcionales propios. */
body.rh-home-body .rh-btn,
body.rh-public-events-body .rh-btn,
body.ped-body .ped-btn,
body.rh-cux-team-body .rh-cux-team-btn,
body.account-hub-body .compact-list a em,
body.rh-org-dashboard-body .rh-org-inline-link,
body.rh-team-hub-body .rh-team-stat-grid a,
.classification-page button,
.classification-page .nav-table-link,
.rh-dashboard-shell .rh-dashboard-action,
.rh-hrr-mini-link,
.rh-hrr-btn {
  border-radius: 999px;
  text-decoration: none;
}

body.ped-body .ped-btn,
body.rh-cux-team-body .rh-cux-team-btn,
body.rh-home-body .rh-btn,
body.rh-public-events-body .rh-btn,
.classification-page .stats-search button,
.rh-hrr-btn {
  min-height: 42px;
}

/* Tablas/listas: lectura más consistente y scroll claro en mobile. */
body.rh-home-body table,
body.rh-public-events-body table,
body.ped-body table,
.classification-page table,
.rh-dashboard-shell table,
.rh-admin-tool-main table,
.rh-hrr-table {
  font-size: clamp(12px, 1.8vw, 14px);
}

.classification-page .classification-table-wrap,
.rh-hrr-table-scroll {
  border-radius: var(--rhfv-radius-inner);
  border-color: var(--rhfv-border);
}

.classification-page .classification-table thead th,
.rh-hrr-table th {
  letter-spacing: .06em;
}

/* Menús: ajuste visual transversal sin cambiar comportamiento JS. */
.rh-topbar,
.rh-role-sidebar,
.rh-admin-sidebar,
.rh-athlete-sidebar,
.rh-team-sidebar {
  border-color: var(--rhfv-border);
}

.rh-topbar a,
.rh-role-sidebar a,
.rh-admin-sidebar a,
.rh-athlete-sidebar a,
.rh-team-sidebar a {
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.rh-topbar-btn,
.rh-topbar-menu-btn,
.rh-sidebar-link,
.rh-admin-sidebar a,
.rh-athlete-sidebar a,
.rh-team-sidebar a {
  border-radius: 999px;
}

/* Estados informativos: misma legibilidad para chips y badges. */
.rh-hrr-badge,
.rh-hrr-section-tag,
.classification-badge,
.athlete-bib-badge {
  border-color: var(--rhfv-accent-border);
  background: var(--rhfv-accent-soft);
}

@media (max-width: 980px) {
  .classification-page .classification-layout {
    gap: 18px;
  }

  .rh-hrr-explain,
  .rh-hrr-event-card-grid,
  .rh-hrr-table-card-grid {
    gap: 14px;
  }
}

@media (max-width: 760px) {
  :root {
    --rhfv-card-pad: 14px;
    --rhfv-radius-card: 20px;
    --rhfv-radius-inner: 16px;
  }

  body.rh-home-body h1,
  body.rh-public-events-body h1,
  body.ped-body h1,
  body.account-hub-body h1,
  body.rh-org-dashboard-body h1,
  body.rh-team-hub-body h1,
  body.rh-cux-team-body h1,
  .classification-page h1,
  .rh-dashboard-shell h1,
  .rh-admin-tool-main h1,
  .rh-hrr-hero h1 {
    font-size: clamp(28px, 9vw, 38px);
  }

  body.account-hub-body .compact-list,
  body.rh-team-hub-body .rh-team-stat-grid,
  .rh-dashboard-shell .rh-dashboard-action-grid,
  .classification-page .athlete-card-grid,
  .rh-hrr-card-metrics,
  .rh-hrr-guide-grid,
  .rh-hrr-quality-grid {
    gap: 12px;
  }

  body.account-hub-body .compact-list a,
  body.rh-org-dashboard-body .rh-org-quick-list a,
  body.rh-team-hub-body .rh-team-stat-grid article,
  .rh-dashboard-shell .rh-dashboard-action,
  .classification-page .sidebar-card,
  .classification-page .classification-table-panel,
  .rh-hrr-card,
  .rh-hrr-panel {
    min-height: auto;
    padding: 14px;
  }

  .classification-page .classification-hero,
  .rh-hrr-hero {
    border-radius: 20px;
  }

  .classification-page .classification-table-wrap,
  .rh-hrr-table-scroll {
    margin-left: -2px;
    margin-right: -2px;
  }
}
