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

:root {
  --navy:    #1a1a2e;
  --navy-80: rgba(26, 26, 46, 0.82);
  --accent:  #6366f1;
  --accent-h:#4f52e0;
  --green:   #16a34a;
  --amber:   #d97706;
  --red:     #dc2626;
  --gray-50: #f8f9fc;
  --gray-100:#f3f4f6;
  --gray-200:#e5e7eb;
  --gray-400:#9ca3af;
  --gray-600:#4b5563;
  --gray-900:#111827;
  --text:    #1f2937;
  --radius:  10px;
  --shadow:  0 2px 12px rgba(0,0,0,.08);
  --shadow-md:0 4px 24px rgba(0,0,0,.12);
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

/* ── Loading & Error ──────────────────────────────────────────────────────── */
.screen-loading {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: #fff; z-index: 999;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.screen-error {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 40px 20px; background: var(--gray-50);
}
.screen-error-inner { text-align: center; max-width: 420px; }
.error-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: #fee2e2; color: var(--red);
  font-size: 22px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.screen-error h1 { font-size: 22px; margin: 0 0 8px; }
.screen-error p  { color: var(--gray-600); margin: 0 0 24px; }
.btn-primary {
  display: inline-block; padding: 10px 24px;
  background: var(--accent); color: #fff;
  border-radius: 8px; text-decoration: none;
  font-weight: 600; font-size: 14px;
}
.mt-lg { margin-top: 24px; }

/* ── Header ───────────────────────────────────────────────────────────────── */
.ev-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 0 24px;
  background: transparent;
  transition: background .25s, box-shadow .25s;
}
.ev-header-scrolled {
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 0 var(--gray-200);
}
.ev-header-inner {
  max-width: 1160px; margin: 0 auto;
  height: 60px;
  display: flex; align-items: center; gap: 16px;
}
.ev-logo img { height: 28px; display: block; }
.ev-header-event {
  flex: 1; font-size: 15px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0;
  transition: opacity .2s;
  color: var(--gray-900);
}
.ev-header-scrolled .ev-header-event { opacity: 1; }
.ev-header-link {
  flex-shrink: 0;
  font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,.8);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  transition: color .15s, background .15s;
}
.ev-header-link:hover { color: #fff; background: rgba(255,255,255,.1); }
.ev-header-scrolled .ev-header-link { color: var(--gray-600); }
.ev-header-scrolled .ev-header-link:hover { color: var(--accent); background: rgba(99,102,241,.06); }
.ev-header-cta {
  flex-shrink: 0;
  padding: 8px 20px; border-radius: 8px;
  background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 600;
  text-decoration: none;
  transition: background .15s;
}
.ev-header-cta:hover { background: var(--accent-h); }

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.ev-hero {
  position: relative;
  min-height: 540px;
  display: flex; align-items: flex-end;
  overflow: hidden;
}
@media (min-width: 768px) { .ev-hero { min-height: 620px; } }

.ev-hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  background-color: var(--navy);
  transform: scale(1.04);
  transition: transform 8s ease-out;
}
.ev-hero-bg-gradient {
  background: linear-gradient(135deg, #1a1a2e 0%, #2d2d54 50%, #1a2a4a 100%);
}
.ev-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(
    to top,
    rgba(10,10,24,.92) 0%,
    rgba(10,10,24,.55) 50%,
    rgba(10,10,24,.25) 100%
  );
}
.ev-hero-content {
  position: relative; z-index: 1;
  width: 100%; max-width: 1160px; margin: 0 auto;
  padding: 80px 24px 52px;
  color: #fff;
}
.ev-hero-event-name {
  margin: 0 0 6px;
  font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: 1.5px;
  color: rgba(255,255,255,.65);
}
.ev-hero-title {
  margin: 0 0 20px;
  font-size: clamp(28px, 5vw, 52px);
  font-weight: 800; line-height: 1.1;
  letter-spacing: -.5px;
}
.ev-hero-meta {
  display: flex; flex-wrap: wrap; gap: 16px;
  margin-bottom: 20px;
}
.ev-hero-meta-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; color: rgba(255,255,255,.8);
}
.ev-hero-status {
  margin-bottom: 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ev-hero-regulation,
.ev-hero-multimedia {
  margin-left: 0;
}
.ev-status-badge {
  display: inline-block;
  padding: 5px 14px; border-radius: 999px;
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
}
.ev-status-open   { background: rgba(22,163,74,.2);  color: #4ade80; border: 1px solid rgba(22,163,74,.35); }
.ev-status-full   { background: rgba(220,38,38,.2);  color: #f87171; border: 1px solid rgba(220,38,38,.35); }
.ev-status-soon   { background: rgba(217,119,6,.2);  color: #fbbf24; border: 1px solid rgba(217,119,6,.35); }
.ev-status-closed { background: rgba(156,163,175,.15); color: rgba(255,255,255,.55); border: 1px solid rgba(255,255,255,.15); }

/* ── Sections ─────────────────────────────────────────────────────────────── */
.ev-container { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.ev-section { padding: 64px 0; }
.ev-section-alt { background: var(--gray-50); }
.ev-section-title {
  font-size: 22px; font-weight: 700;
  margin: 0 0 32px;
  color: var(--gray-900);
}

/* ── Race cards grid ──────────────────────────────────────────────────────── */
.ev-races-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.ev-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 24px;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
  transition: box-shadow .2s, transform .15s;
}
.ev-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.ev-card-badges {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 16px;
}
.ev-card-distance {
  padding: 4px 12px; border-radius: 999px;
  background: var(--navy); color: #fff;
  font-size: 12px; font-weight: 700; letter-spacing: .3px;
}
.ev-card-type {
  padding: 4px 10px; border-radius: 999px;
  background: var(--gray-100); color: var(--gray-600);
  font-size: 12px; font-weight: 500;
}
.ev-chip {
  padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px;
}
.ev-chip-open   { background: #dcfce7; color: var(--green); }
.ev-chip-full   { background: #fee2e2; color: var(--red); }
.ev-chip-soon   { background: #fef3c7; color: var(--amber); }
.ev-chip-closed { background: var(--gray-100); color: var(--gray-400); }

.ev-card-name {
  font-size: 18px; font-weight: 700;
  margin: 0 0 6px; color: var(--gray-900);
  flex: 1;
}
.ev-card-time {
  font-size: 13px; color: var(--gray-600);
  margin: 0;
}
.ev-hero-regulation {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: 12px;
  padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,.12); color: rgba(255,255,255,.85);
  border: 1px solid rgba(255,255,255,.2);
  text-decoration: none;
  transition: background .15s;
}
.ev-hero-regulation:hover { background: rgba(255,255,255,.22); color: #fff; }

.ev-hero-multimedia {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: 12px;
  padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,.12); color: rgba(255,255,255,.85);
  border: 1px solid rgba(255,255,255,.2);
  text-decoration: none;
  transition: background .15s;
}
.ev-hero-multimedia:hover { background: rgba(255,255,255,.22); color: #fff; }

.ev-hero-results {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: 12px;
  padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,.18); color: #fff;
  border: 1px solid rgba(255,255,255,.35);
  text-decoration: none;
  transition: background .15s;
}
.ev-hero-results:hover { background: rgba(255,255,255,.28); color: #fff; }

.ev-hero-results-soon {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: 12px;
  padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,.06); color: rgba(255,255,255,.6);
  border: 1px solid rgba(255,255,255,.15);
}

/* ── Description ──────────────────────────────────────────────────────────── */
.ev-desc-layout { max-width: 760px; }
.ev-description { font-size: 16px; line-height: 1.75; color: #374151; }
.ev-description p  { margin: 0 0 1em; }
.ev-description p:last-child { margin-bottom: 0; }
.ev-description strong { font-weight: 700; }
.ev-description em { font-style: italic; }
.ev-description u  { text-decoration: underline; }
.ev-description ul, .ev-description ol { padding-left: 24px; margin: 0 0 1em; }
.ev-description li { margin-bottom: .3em; }
.ev-description a  { color: var(--accent); text-decoration: underline; }
.ev-description a:hover { color: var(--accent-h); }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.ev-empty { color: var(--gray-400); font-style: italic; }

/* ── Documents ────────────────────────────────────────────────────────────── */
.ev-docs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 680px;
}

.ev-doc-item { display: block; }

.ev-doc-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--gray-900);
  font-weight: 500;
  font-size: 14.5px;
  transition: background 0.15s, border-color 0.15s;
}

.ev-doc-link:hover {
  background: #eef2ff;
  border-color: var(--accent);
  color: var(--accent);
}

.ev-doc-icon { font-size: 18px; flex-shrink: 0; }

.ev-doc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ev-doc-size {
  font-size: 12px;
  color: var(--gray-400);
  font-weight: 400;
  white-space: nowrap;
}

.ev-doc-arrow {
  font-size: 14px;
  color: var(--gray-400);
  flex-shrink: 0;
}

.ev-doc-link:hover .ev-doc-arrow,
.ev-doc-link:hover .ev-doc-size { color: var(--accent); }

/* ── Participants dialog ──────────────────────────────────────────────────── */
.participants-dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  width: min(1100px, 94vw);
  height: 88vh;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0,0,0,.22);
}
.participants-dialog[open] {
  display: flex;
  flex-direction: column;
}
.participants-dialog::backdrop {
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
}
.participants-dialog-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.participants-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 32px 0;
  flex-shrink: 0;
}
.participants-dialog-eyebrow {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; color: var(--accent);
  margin: 0 0 4px;
}
.participants-dialog-title {
  font-size: 22px; font-weight: 700;
  margin: 0 0 3px; color: var(--gray-900);
}
.participants-dialog-count {
  font-size: 13px; color: var(--gray-600);
  margin: 0;
}
.participants-dialog-close {
  background: none; border: none;
  cursor: pointer; font-size: 16px;
  color: var(--gray-400);
  padding: 4px 8px; border-radius: 6px;
  line-height: 1; flex-shrink: 0; margin-top: 2px;
  transition: background .15s, color .15s;
}
.participants-dialog-close:hover { background: var(--gray-100); color: var(--gray-900); }

.participants-search-bar {
  padding: 16px 32px 0;
  flex-shrink: 0;
}
.participants-search-input {
  width: 100%; box-sizing: border-box;
  padding: 10px 14px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 14px; font-family: inherit;
  background: var(--gray-50);
  color: var(--gray-900);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.participants-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
  background: #fff;
}

.participants-dialog-body {
  overflow-y: auto;
  padding: 12px 32px 0;
  flex: 1;
}

.participants-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 32px 18px;
  border-top: 1px solid var(--gray-100);
  flex-shrink: 0;
}
.participants-pagination-info {
  font-size: 13px; color: var(--gray-600);
}
.participants-pagination-btns {
  display: flex; gap: 6px;
}
.participants-pagination-btn {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 13px; font-family: inherit;
  cursor: pointer;
  color: var(--gray-900);
  transition: background .12s, border-color .12s;
}
.participants-pagination-btn:hover:not(:disabled) {
  background: var(--gray-50); border-color: var(--gray-400);
}
.participants-pagination-btn:disabled {
  opacity: .4; cursor: not-allowed;
}

.participants-loading {
  display: flex; justify-content: center; padding: 60px 0;
}
.participants-table {
  width: 100%; border-collapse: collapse;
  font-size: 14px;
}
.participants-table th {
  text-align: left; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .7px;
  color: var(--gray-400); padding: 0 16px 10px 0;
  border-bottom: 2px solid var(--gray-200);
  position: sticky; top: 0; background: #fff;
}
.participants-table td {
  padding: 10px 16px 10px 0;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-900);
  vertical-align: middle;
}
.participants-table tr:last-child td { border-bottom: none; }
.participants-table .td-num {
  color: var(--gray-400); font-size: 12px; width: 48px;
}
.participants-table .td-hidden {
  color: var(--gray-400); font-style: italic;
}
.participants-table .td-club {
  font-size: 13px; color: var(--gray-600);
}
.td-club-unregistered {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fef3c7; color: #b45309;
  font-size: 10px; font-weight: 700; font-style: normal;
  cursor: help; vertical-align: middle; margin-left: 4px;
  flex-shrink: 0;
}
.participants-table .td-cat {
  font-size: 12px; color: var(--gray-400); white-space: nowrap;
}
.participants-empty {
  text-align: center; padding: 60px 20px;
  color: var(--gray-400); font-style: italic; font-size: 15px;
}

/* ── "Ver inscritos" link on race cards ───────────────────────────────────── */
.ev-card-actions {
  display: flex; align-items: center; gap: 16px;
  margin-top: 12px;
}
.ev-card-participants-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; font-weight: 500;
  color: var(--accent);
  background: none; border: none; padding: 0;
  cursor: pointer; text-decoration: none;
  transition: color .15s;
}
.ev-card-participants-link:hover { color: var(--accent-h); text-decoration: underline; }

.ev-card-results-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  transition: color .15s;
}
.ev-card-results-link:hover { color: var(--accent-h); text-decoration: underline; }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.cr-footer {
  background: var(--navy);
  color: rgba(255,255,255,.55);
  padding: 52px 0 0;
  font-size: 14px;
  line-height: 1.6;
}
.cr-footer-inner {
  max-width: 1160px; margin: 0 auto; padding: 0 24px 44px;
  display: grid;
  grid-template-columns: 1.3fr 1fr 0.7fr;
  gap: 48px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.cr-footer-heading {
  font-size: 12px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase;
  color: #fff; margin: 0 0 18px;
}
.cr-footer-heading span { color: #a5b4fc; }
.cr-footer-col p { margin: 0; font-size: 13px; line-height: 1.75; color: rgba(255,255,255,.5); }
.cr-footer-nav { display: flex; flex-direction: column; gap: 9px; }
.cr-footer-nav a { color: rgba(255,255,255,.55); text-decoration: none; font-size: 13px; transition: color .15s; }
.cr-footer-nav a:hover { color: #fff; }
.cr-footer-social { display: flex; gap: 10px; margin-top: 4px; }
.cr-footer-social-link {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 8px;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.7);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.cr-footer-social-link:hover { background: rgba(255,255,255,.16); color: #fff; }
.cr-footer-bottom {
  max-width: 1160px; margin: 0 auto;
  padding: 16px 24px;
  font-size: 12px; color: rgba(255,255,255,.3);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .ev-hero-cta { width: 100%; justify-content: center; }
  .cr-footer-inner { grid-template-columns: 1fr; gap: 32px; }

  .participants-dialog {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }

  .participants-dialog-header,
  .participants-search-bar,
  .participants-dialog-body,
  .participants-pagination {
    padding-left: 16px;
    padding-right: 16px;
  }

  .participants-dialog-body { overflow-x: auto; }

  .participants-pagination {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
