/* ============================================================
   admin.css · Mesa de control · torneo.emprendimiento.vip
   Solo lo específico del panel. Tokens y componentes en base.css.
   ============================================================ */

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  padding: calc(10px + env(safe-area-inset-top)) 0 10px;
  background: rgba(8, 11, 10, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar__actions .btn { white-space: nowrap; }
.topbar__ctx {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-top: 9px;
  flex-wrap: wrap;
}
.ctx-name {
  font-family: var(--font-display);
  font-size: 26px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1;
}
.ctx-sub {
  font-size: 12px;
  color: var(--muted);
}

.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand__ball { width: 30px; height: 30px; color: var(--lime); flex: 0 0 auto; }
.brand__word {
  font-family: var(--font-display);
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1;
}

.save-ind {
  font-size: 12px;
  font-weight: 600;
  color: var(--lime);
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 200ms var(--ease), transform 200ms var(--ease);
  white-space: nowrap;
}
.save-ind.show { opacity: 1; transform: none; }

.select--compact {
  width: auto;
  min-width: 150px;
  max-width: 240px;
  min-height: 38px;
  padding: 5px 32px 5px 12px;
  font-size: 13px;
}

.btn .spinner { width: 15px; height: 15px; flex: 0 0 auto; }

@media (max-width: 640px) {
  .topbar__row { flex-wrap: wrap; row-gap: 6px; }
  .brand__word { font-size: 18px; white-space: nowrap; }
  .topbar__actions { margin-left: auto; }
  .topbar__actions .btn--sm { padding: 0; width: 40px; }
  .topbar__actions .btn-label { display: none; }
  .topbar__actions > .pill { display: none; }
  .save-ind { display: none; }
}

/* ---------- Login ---------- */
.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px calc(20px + env(safe-area-inset-left)) calc(20px + env(safe-area-inset-bottom));
}
.login-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 22px; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.login-ball { width: 58px; height: 58px; color: var(--lime); }
.login-word {
  font-family: var(--font-display);
  font-size: 36px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 0.95;
}
.login-ver {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  font-size: 13px;
  color: var(--muted);
  align-self: center;
}
.login-ver:hover { color: var(--text); }
.login-ver svg { width: 16px; height: 16px; }

/* ---------- Layout principal ---------- */
.admin-main { padding: 20px 0 56px; display: flex; flex-direction: column; gap: 16px; }
.admin-grid { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
.admin-col-side, .admin-col-main { min-width: 0; }
@media (min-width: 1024px) {
  .admin-grid { grid-template-columns: 320px minmax(0, 1fr); }
}

.panel-title {
  font-family: var(--font-display);
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1;
}

/* ---------- Resumen ---------- */
.summary { display: flex; flex-direction: column; gap: 14px; }
.summary-progress {
  font-family: var(--font-display);
  font-size: 26px;
  text-transform: uppercase;
}
.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress__fill {
  height: 100%;
  background: var(--lime);
  border-radius: 999px;
  transition: width 400ms var(--ease);
}
.champ {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 15px;
  border-radius: 999px;
  background: var(--lime-soft);
  border: 1px solid rgba(203, 255, 63, 0.35);
}
.champ svg { width: 20px; height: 20px; color: var(--lime); flex: 0 0 auto; }
.champ-name { font-weight: 700; color: var(--lime); }

/* ---------- Aviso PIN de fábrica ---------- */
.pin-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 106, 61, 0.35);
  background: rgba(255, 106, 61, 0.07);
  font-size: 13px;
}
.pin-banner svg { width: 18px; height: 18px; color: var(--orange); flex: 0 0 auto; }
.pin-banner button { margin-left: auto; flex: 0 0 auto; }

/* ---------- Por jugar ---------- */
.pq-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
}
.pq-players { display: flex; align-items: center; gap: 8px; }
.pq-p { flex: 1 1 50%; font-size: 15px; font-weight: 600; min-width: 0; }
.pq-p:first-child { text-align: right; }
.pq-vs { color: var(--faint); font-size: 11px; font-weight: 700; text-transform: uppercase; flex: 0 0 auto; }

/* ---------- Cuadro (eliminatoria) ---------- */
.bracket { padding-bottom: 10px; }
.bracket-inner { position: relative; }
.bracket-col { position: absolute; top: 0; }
.bracket-head {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 44px;
  display: flex;
  align-items: flex-end;
  padding-bottom: 6px;
  font-family: var(--font-display);
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.bracket-lines { position: absolute; inset: 0; pointer-events: none; }

.match-card {
  position: absolute;
  left: 0;
  width: 168px;
  height: 92px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
  padding: 8px 10px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.match-card--action { justify-content: flex-start; padding-bottom: 34px; }
.match-card.is-ready { border-color: rgba(203, 255, 63, 0.4); }
.mc-p {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 13px;
  line-height: 1.25;
}
.mc-p .name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-p .name.is-tbd { color: var(--faint); font-weight: 500; }
.mc-p .score { font-variant-numeric: tabular-nums; font-weight: 700; flex: 0 0 auto; }
.mc-p.is-win .name { color: var(--lime); font-weight: 700; }
.mc-p.is-loss .name { color: var(--faint); }
.mc-bye { font-size: 12px; color: var(--faint); }
.mc-action {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  min-height: 30px;
  padding: 0 8px;
  font-size: 12px;
}

/* ---------- Liga ---------- */
.jornadas > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.jornadas > summary::-webkit-details-marker { display: none; }
.jornadas > summary::after {
  content: "+";
  margin-left: auto;
  font-size: 20px;
  line-height: 1;
  color: var(--lime);
}
.jornadas[open] > summary::after { content: "–"; }
.jornadas > summary .panel-title { margin: 0; }
.jornadas[open] > summary { margin-bottom: 14px; }

.jornada-title {
  font-family: var(--font-display);
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.lg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
}
.lg-names { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; }
.lg-p { font-size: 14px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-p.is-win { color: var(--lime); }
.lg-score { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; flex: 0 0 auto; }

/* ---------- Draft / creación ---------- */
.draft-main { padding-top: 20px; padding-bottom: 48px; }
.draft { max-width: 620px; }
.format-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.format-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  text-align: left;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  transition: border-color 150ms var(--ease), background 150ms var(--ease);
}
.format-card:hover { border-color: var(--line-strong); }
.format-card[aria-pressed="true"] { border-color: var(--lime); background: var(--lime-soft); }
.fc-title { font-family: var(--font-display); font-size: 22px; text-transform: uppercase; line-height: 1; }
.fc-desc { font-size: 12.5px; color: var(--muted); }

.player-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding: 4px 4px 4px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 14px;
}
.chip-name { max-width: 190px; }
.chip-x {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  flex: 0 0 auto;
}
.chip-x:hover { color: var(--danger); background: var(--danger-soft); }
.chip-x svg { width: 16px; height: 16px; }

/* ---------- Modal de resultado ---------- */
.result-info { align-items: center; }
.result-body { gap: 14px; }
.score-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; }
.score-name { font-size: 19px; font-weight: 700; flex: 1 1 auto; min-width: 0; }
.stepper { display: flex; align-items: center; gap: 6px; }
.step {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--bg-elev);
  color: var(--text);
  transition: background 140ms var(--ease), border-color 140ms var(--ease);
}
.step:active { background: var(--surface-3); }
.step:hover { border-color: var(--lime); }
.step svg { width: 20px; height: 20px; }
.score-input {
  width: 68px;
  height: 44px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elev);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  appearance: textfield;
}
.score-input::-webkit-outer-spin-button,
.score-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.score-input:focus { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(203, 255, 63, 0.14); outline: none; }
.result-msg { min-height: 18px; font-size: 13px; color: var(--danger); }
.downstream {
  padding: 12px 14px;
  border: 1px solid rgba(255, 106, 61, 0.4);
  border-radius: var(--radius-sm);
  background: rgba(255, 106, 61, 0.08);
  font-size: 13px;
}
.downstream.hidden { display: none; }
.confirm-body { font-size: 14px; color: var(--muted); }

/* ---------- Varios ---------- */
.toast.leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 200ms var(--ease), transform 200ms var(--ease);
}

@media (max-width: 640px) {
  .ctx-name { font-size: 22px; }
  .admin-main { padding-top: 14px; }
  .score-name { font-size: 17px; }
}

/* La clasificación no parte nombres: si no cabe, la tabla hace scroll */
.admin-main .table th,
.admin-main .table td { white-space: nowrap; }


/* Resultado suelto */
.quick-row { display: flex; align-items: center; gap: 10px; }
.quick-row .select { flex: 1 1 auto; min-width: 0; }
.quick-row .quick-score {
  flex: 0 0 78px;
  width: 78px;
  min-height: 52px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}


/* Acciones de la lista de resultados */
.lg-actions { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.lg-actions .btn--sm { --btn-h: 32px; padding: 0 9px; font-size: 11.5px; }


@media (max-width: 640px) {
  .admin-main .table th, .admin-main .table td { padding: 9px 6px; font-size: 12px; }
  .admin-main .table th:nth-child(1), .admin-main .table td:nth-child(1) { width: 28px; }
}


@media (max-width: 640px) {
  .lg-row { flex-wrap: wrap; row-gap: 6px; }
  .lg-names { flex-basis: 100%; }
  .lg-actions { width: 100%; justify-content: flex-end; }
}
