/* =========================================================================
   MatchBetting — sistema de diseño
   Tema claro, tipografía del sistema, superficies blancas y un único acento.
   ========================================================================= */

:root {
  /* superficies y texto */
  --bg: #e9edf4;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --muted: #667085;
  --muted-2: #7b8794;

  /* acento y semánticos */
  --accent: #4f46e5;
  --accent-600: #4338ca;
  --accent-soft: #eef2ff;
  --ok: #067647;
  --ok-soft: #ecfdf3;
  --ko: #b42318;
  --ko-soft: #fef3f2;
  --warn: #b54708;
  --warn-soft: #fffaeb;

  /* formas */
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 1px 3px rgba(16, 24, 40, .1), 0 1px 2px rgba(16, 24, 40, .06);

  /* tipografía */
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-widget: var(--font-ui);

  --header-h: 64px;
  --container: 1280px;
  --container-wide: 1680px;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  background-color: var(--bg);
  /* textura de puntos muy suave + halo del acento arriba */
  background-image:
    radial-gradient(circle at 1px 1px, rgba(16, 24, 40, .055) 1px, transparent 0),
    radial-gradient(1100px 480px at 50% -150px, rgba(79, 70, 229, .16), transparent 70%),
    linear-gradient(180deg, #eef1f7 0%, #e7ebf2 100%);
  background-size: 24px 24px, auto, auto;
  background-attachment: fixed;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent-600);
  text-decoration: none;
}

a:hover {
  color: var(--accent);
  text-decoration: underline;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--text);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 10px 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.skip-link:focus {
  left: 8px;
  top: 8px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

.page-table .container {
  max-width: var(--container-wide);
}

/* -------------------------------------------------------------------------
   Botones y utilidades
   ------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.btn:hover {
  background: var(--accent-600);
  color: #fff;
  text-decoration: none;
}

.btn--ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn--ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn--sm {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.btn--block {
  width: 100%;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge--ok {
  background: var(--ok-soft);
  border-color: #abefc6;
  color: var(--ok);
}

.badge--warn {
  background: var(--warn-soft);
  border-color: #fedf89;
  color: var(--warn);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-2);
}

.muted {
  color: var(--muted);
}

/* -------------------------------------------------------------------------
   Cabecera
   ------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(140%) blur(10px);
  border-top: 3px solid var(--accent);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -.01em;
  flex: 0 0 auto;
}

.brand:hover {
  color: var(--text);
  text-decoration: none;
}

.brand__mark {
  display: inline-flex;
  color: var(--accent);
}

.brand__mark svg {
  width: 30px;
  height: 30px;
  display: block;
}

.brand__name b {
  font-weight: 800;
}

.brand__name span {
  font-weight: 600;
  color: var(--muted);
}

.main-nav {
  margin-left: auto;
}

.nav-list,
.nav-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-list > li {
  position: relative;
}

.nav-list a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.nav-list a:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.nav-list a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent-600);
  font-weight: 600;
}

.caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: .7;
}

.sub-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  min-width: 230px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: none;
}

/* pequeño puente invisible para que el ratón no pierda el hover al bajar */
.sub-menu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -10px;
  height: 10px;
}

.nav-list > li:hover > .sub-menu,
.nav-list > li.is-open > .sub-menu,
.nav-list > li:focus-within > .sub-menu {
  display: block;
}

.sub-menu a {
  padding: 9px 10px;
  color: var(--text);
  font-weight: 500;
}

.sub-menu a:hover {
  background: var(--surface-2);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  margin-left: auto;
  width: 40px;
  height: 40px;
  padding: 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

.nav-toggle-bar {
  display: block;
  height: 2px;
  width: 100%;
  border-radius: 2px;
  background: var(--text);
}

.mobile-menu {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 20px 16px;
}

.mobile-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-menu a {
  display: block;
  padding: 11px 4px;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}

.mobile-menu a[aria-current="page"] {
  color: var(--accent-600);
  font-weight: 600;
}

.mobile-menu .mobile-group {
  display: block;
  padding: 14px 4px 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.mobile-menu > ul > li:last-child a {
  border-bottom: 0;
}

/* -------------------------------------------------------------------------
   Página
   ------------------------------------------------------------------------- */

.site-main {
  min-height: 50vh;
}

.page {
  padding-top: 26px;
  padding-bottom: 48px;
}

.page-head {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding-left: 16px;
}

.page-head::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 4px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), #8b5cf6);
}

.page-title {
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -.02em;
  line-height: 1.2;
}

.page-subtitle {
  margin: 6px 0 0;
  color: #5a6577;
  font-size: 14px;
  max-width: 70ch;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filters-toggle {
  display: none;
}

.page-footnote {
  margin: 14px 0 0;
  color: var(--muted-2);
  font-size: 12px;
}

/* -------------------------------------------------------------------------
   Pie
   ------------------------------------------------------------------------- */

.site-footer {
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(140%) blur(10px);
  border-top: 1px solid var(--border);
  margin-top: 20px;
  color: var(--muted);
  font-size: 13px;
}

.footer-main {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 32px;
  padding: 32px 0 26px;
}

.footer-col h3 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 800;
  font-size: 15px;
  margin-bottom: 10px;
}

.footer-brand:hover {
  color: var(--text);
  text-decoration: none;
}

.footer-brand svg {
  width: 22px;
  height: 22px;
  color: var(--accent);
  display: block;
}

.footer-text {
  margin: 0 0 10px;
  line-height: 1.6;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-links a {
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--text);
}

.rg-block {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.rg-block img {
  display: block;
  width: 150px;
  height: auto;
}

.rg-18 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 2px solid var(--ko);
  border-radius: 50%;
  color: var(--ko);
  font-size: 13px;
  font-weight: 800;
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 16px 0 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted-2);
  font-size: 12px;
}

/* -------------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------------- */

@media (max-width: 1024px) {
  .main-nav {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }
}

@media (max-width: 860px) {
  .footer-main {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .page {
    padding-top: 18px;
  }

  .page-title {
    font-size: 22px;
  }

  .filters-toggle {
    display: inline-flex;
  }

  .footer-main {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .footer-bottom {
    justify-content: flex-start;
  }
}

/* selector de orden de la tabla */
.sort-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sort-control input[type="number"] {
  width: 66px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sort-control--num {
  color: var(--muted);
}

.sort-control select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

@media (max-width: 640px) {
  .sort-control {
    display: none;
  }
}
