@import url("https://fonts.googleapis.com/css2?family=Oswald:wght@500;600;700&family=Inter:wght@400;500;600&family=Roboto+Mono:wght@500;600&display=swap");

:root {
  --ink: #17181b;
  --ink-soft: #4a4d54;
  --paper: #faf9f7;
  --paper-raised: #ffffff;
  --line: #e4e1da;

  --racing-red: #b91c34;
  --racing-red-dark: #7f0f22;
  --pitch-green: #1f6f4f;
  --pitch-green-bg: #e9f4ee;
  --amber: #b0741f;
  --amber-bg: #faf1e2;
  --loss-bg: #fbe9ea;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(23, 24, 27, 0.06), 0 4px 14px rgba(23, 24, 27, 0.05);
  --shadow-lift:
    0 6px 20px rgba(23, 24, 27, 0.1), 0 2px 6px rgba(23, 24, 27, 0.07);

  --font-display: "Oswald", "Arial Narrow", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "Roboto Mono", ui-monospace, monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f1efe9;
    --ink-soft: #b8b6b0;
    --paper: #121214;
    --paper-raised: #1c1c1f;
    --line: #303034;

    --racing-red: #e2465f;
    --racing-red-dark: #ff6b81;
    --pitch-green: #4bbf8e;
    --pitch-green-bg: #123324;
    --amber: #e0a84a;
    --amber-bg: #3a2c11;
    --loss-bg: #3a1418;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.35);
    --shadow-lift:
      0 10px 28px rgba(0, 0, 0, 0.45), 0 3px 10px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--racing-red);
}

:focus-visible {
  outline: 2px solid var(--racing-red);
  outline-offset: 2px;
}

/* ---------- header ---------- */

.site-header {
  background: var(--ink);
  color: var(--paper);
  border-bottom: 3px solid var(--racing-red);
}

.site-header__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.club-id__eyebrow {
  margin: 0 0 0.15rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ff8a9a;
}

.club-id__nombre {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}

/* ---------- layout ---------- */

.shell {
  max-width: 1200px;
  margin: 0 auto;
}

.app {
  width: 100%;
  min-width: 0;
  padding: 1.5rem 1.25rem 3rem;
}

/* ---------- navegación de actividades ---------- */

.app-nav {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  position: fixed;
  z-index: 40;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--paper-raised);
  border-top: 1px solid var(--line);
  box-shadow: 0 -2px 10px rgba(23, 24, 27, 0.06);
  padding-bottom: env(safe-area-inset-bottom);
}

.app-nav::-webkit-scrollbar {
  display: none;
}

.app-nav__link {
  flex: 1 0 auto;
  min-width: 4.5rem;
  text-align: center;
  text-decoration: none;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.68rem;
  letter-spacing: 0.01em;
  padding: 0.65rem 0.5rem;
  border-top: 2px solid transparent;
}

.app-nav__link--activo {
  color: var(--racing-red);
  border-top-color: var(--racing-red);
}

.app {
  padding-bottom: calc(4.75rem + env(safe-area-inset-bottom));
}

@media (min-width: 860px) {
  .shell {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
    padding: 0 1.25rem;
  }

  .app-nav {
    position: sticky;
    top: 1.5rem;
    bottom: auto;
    left: auto;
    right: auto;
    flex-direction: column;
    overflow: visible;
    width: 180px;
    flex-shrink: 0;
    margin-top: 1.5rem;
    background: transparent;
    border-top: none;
    border-right: 1px solid var(--line);
    box-shadow: none;
    padding-bottom: 0;
  }

  .app-nav__link {
    text-align: left;
    font-size: 0.85rem;
    padding: 0.55rem 0.9rem;
    border-top: none;
    border-left: 2px solid transparent;
    border-radius: 0 8px 8px 0;
  }

  .app-nav__link--activo {
    border-left-color: var(--racing-red);
    background: var(--paper);
  }

  .app {
    padding: 1.5rem 0 3rem;
    max-width: 1000px;
  }
}

.panel__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  margin: 0 0 1rem;
}

.panel__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.2rem;
}

.hint {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.aviso {
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  margin: 0 0 1rem;
}

.aviso--ok {
  color: var(--pitch-green);
  background: var(--pitch-green-bg);
}

.aviso--conflicto {
  color: var(--amber);
  background: var(--amber-bg);
}

/* ---------- botones ---------- */

.btn,
.btn-cambiar,
button[type="submit"] {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
}

.btn:hover,
.btn-cambiar:hover,
button[type="submit"]:hover {
  border-color: var(--racing-red);
}

.btn--primario,
.login-card button[type="submit"] {
  background: var(--racing-red);
  border-color: var(--racing-red);
  color: #fff;
}

.btn--peligro {
  background: var(--loss-bg);
  border-color: var(--racing-red);
  color: var(--racing-red);
}

.btn--deshabilitado {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  opacity: 0.5;
}

/* ---------- paginación ---------- */

.paginacion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.paginacion__botones {
  display: flex;
  gap: 0.5rem;
}

@media (max-width: 640px) {
  .paginacion {
    flex-direction: column;
    align-items: stretch;
  }

  .paginacion__botones {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .paginacion__botones .btn,
  .paginacion__botones .btn--deshabilitado {
    text-align: center;
    font-size: 16px;
    min-height: 44px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* ---------- login ---------- */

.login-body {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow-lift);
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.login-card__eyebrow {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--racing-red);
}

.login-card__title {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
}

.login-card__error {
  margin: 0;
  font-size: 0.85rem;
  color: var(--racing-red);
  background: var(--loss-bg);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
}

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.login-card input {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
}

.login-card button[type="submit"] {
  margin-top: 0.4rem;
}

/* ---------- dashboard ---------- */

.modulos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.modulo-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem;
}

.modulo-card:hover {
  border-color: var(--racing-red);
  box-shadow: var(--shadow-lift);
}

.modulo-card__enlace {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  text-decoration: none;
  color: var(--ink);
}

.modulo-card__nombre {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
}

.modulo-card__detalle {
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.modulo-card__cifras {
  margin-top: 0.4rem;
  font-family: var(--font-mono);
  font-size: 1.1rem;
}

.modulo-card__externo {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--ink-soft);
  text-decoration: none;
}

.modulo-card__externo:hover {
  color: var(--racing-red);
}

/* ---------- barra de módulo (búsqueda + acciones) ---------- */

.modulo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.modulo-head__volver {
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-decoration: none;
}

.buscador {
  display: flex;
  gap: 0.5rem;
}

.buscador input {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  min-width: 220px;
}

@media (max-width: 640px) {
  .modulo-head {
    flex-direction: column;
    align-items: stretch;
  }

  .buscador {
    width: 100%;
  }

  .buscador input {
    flex: 1;
    min-width: 0;
  }
}

/* Objetivos táctiles de 44px y font-size de 16px (evita el zoom
   automático de iOS al enfocar) en los controles interactivos, ya que
   el panel se usa sobre todo desde el móvil. */
@media (max-width: 640px) {
  .btn,
  .btn-cambiar,
  button[type="submit"],
  .buscador input,
  .campo input,
  .campo select,
  .campo textarea {
    font-size: 16px;
    min-height: 44px;
  }

  .campo textarea {
    min-height: 5.5rem;
  }
}

/* ---------- tira de estadísticas ---------- */

.stats-strip {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 0.25rem;
  margin-bottom: 1.25rem;
}

.stats-strip::-webkit-scrollbar {
  display: none;
}

.stat-tile {
  flex: 0 0 auto;
  min-width: 6.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.6rem 0.9rem;
}

.stat-tile__valor {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.3rem;
  color: var(--racing-red);
}

.stat-tile__etiqueta {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* ---------- tabla de datos ---------- */

.tabla-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
  box-shadow: var(--shadow);
}

table.datos {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  table-layout: auto;
}

table.datos th,
table.datos td {
  padding: 0.6rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: normal;
  word-break: break-word;
}

table.datos thead th {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 500;
}

table.datos tbody tr:last-child td {
  border-bottom: none;
}
table.datos tbody tr:hover {
  background: var(--paper);
}

table.datos td a {
  text-decoration: none;
  font-weight: 600;
}

/* En móvil la tabla se convierte en una lista de tarjetas: cada <tr> pasa
   a ser una tarjeta y cada <td> una línea "etiqueta: valor" (la etiqueta
   sale de data-label en el propio <td>). Evita tener que mantener dos
   plantillas (tabla y tarjeta) para los mismos datos. */
@media (max-width: 720px) {
  .tabla-scroll {
    overflow-x: visible;
    border: none;
    background: none;
    box-shadow: none;
  }

  table.datos {
    display: block;
  }

  table.datos thead {
    display: none;
  }

  table.datos tbody {
    display: block;
  }

  table.datos tr {
    display: block;
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.85rem 1rem;
    margin-bottom: 0.75rem;
  }

  table.datos td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    white-space: normal;
    text-align: right;
    padding: 0.35rem 0;
    border-bottom: none;
  }

  table.datos td::before {
    content: attr(data-label);
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink-soft);
    text-align: left;
  }

  table.datos td:first-child {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    text-align: left;
  }

  table.datos td:first-child::before {
    content: none;
  }

  table.datos td:last-child {
    margin-top: 0.5rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--line);
  }

  table.datos td:last-child::before {
    content: none;
  }

  table.datos td:last-child a {
    display: block;
    width: 100%;
    text-align: center;
    min-height: 44px;
    line-height: 44px;
  }
}

/* ---------- badges de estado ---------- */

.badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  white-space: nowrap;
}

.badge--ok {
  color: var(--pitch-green);
  background: var(--pitch-green-bg);
}
.badge--pendiente {
  color: var(--amber);
  background: var(--amber-bg);
}
.badge--baja {
  color: var(--racing-red);
  background: var(--loss-bg);
}
.badge--neutro {
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
}

/* ---------- ficha de detalle ---------- */

.ficha {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.ficha__bloque {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
}

.ficha__bloque h3 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
}

.campos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.campo {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.campo span {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.campo input,
.campo select,
.campo textarea {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
}

.campo textarea {
  resize: vertical;
  min-height: 4rem;
}

.ficha__acciones {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.jugador-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 0.85rem;
}

.jugador-item:last-child {
  margin-bottom: 0;
}

.estado-vacio {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 1.75rem 1.25rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
}
