/* components/elo.css — Elo-related UI: diff badges, match card Elo row,
   calculator widget, form, simulator, config section */

/* Global diff classes (used in standings, match cards, Elo widgets) */
.diff-pos { color: var(--success); font-weight: 700; }
.diff-neg { color: var(--danger);  font-weight: 700; }

/* Stat badge/chip — rounded pill with background color */
.stat-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.55rem;
  border-radius: 10px;
  font-size: inherit;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  white-space: nowrap;
  vertical-align: middle;
}
.stat-badge--value { background: #1a2744; color: #fff; }
.stat-badge--pos   { background: var(--success); color: #fff; }
.stat-badge--neg   { background: var(--danger);  color: #fff; }
.stat-badge--zero  { background: var(--bg-2);    color: var(--ink-3); }

/* ── Match card Elo row ── */
.match-card__elo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.35rem 0;
  font-size: 0.8rem;
  color: var(--ink-2);
  border-top: 1px solid var(--line);
}
.match-card__elo-rating { font-weight: 700; font-variant-numeric: tabular-nums; }
.match-card__elo-delta  { font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.match-card__elo-label  { color: var(--ink-3); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0.35rem; }

/* ── Retro edit confirmation banner ── */
.retro-edit-confirm.flash {
  white-space: normal;
  border-radius: var(--r-md);
  max-width: 600px;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  animation: none;
  opacity: 1;
}
.retro-edit-confirm__body p { margin: 0.25rem 0 0; font-size: 0.9rem; }
.retro-edit-confirm__actions { display: flex; gap: 0.5rem; align-items: center; }

/* ── Elo form ── */
.elo-form .ruleset-section { margin-bottom: 1.5rem; }

/* Inputs inside the Elo form get the same treatment as .form-input and
   the ruleset-modal inputs — visible border, focus ring, consistent size. */
.elo-form input[type="text"],
.elo-form input[type="number"],
.elo-form select,
.elo-form textarea {
  border: 1px solid var(--ink-4);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  background: white;
  color: var(--ink);
}
.elo-form input[type="text"]:hover,
.elo-form input[type="number"]:hover,
.elo-form select:hover,
.elo-form textarea:hover { border-color: var(--ink-3); }

.elo-form input[type="text"]:focus,
.elo-form input[type="number"]:focus,
.elo-form select:focus,
.elo-form textarea:focus {
  outline: none;
  border-color: var(--ink-3);
}

/* field-group / field-group-label — shared with ranking_rulesets/form.
   Defined here because the ranking form renders inside .ruleset-modal--wide
   which provides its own input styling, but the Elo form is standalone. */
.elo-form .field-group {
  margin-bottom: 1.25rem;
}
.elo-form .field-group:last-child { margin-bottom: 0; }

.elo-form .field-group-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  margin: 0 0 0.25rem;
}

/* Checkbox toggle — mirrors .form-checkbox-label / .form-checkbox-text
   but scoped so the label span gets the right weight. */
.elo-form .toggle-field {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}
.elo-form .toggle-field span {
  font-weight: 600;
  color: var(--ink);
}

/* Pill spans inside the Elo form need the same centering as
   .ruleset-pill__label — the form uses bare <span> instead. */
.elo-form .ruleset-pill > span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0.4rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--ink-3);
  user-select: none;
  border-right: 1px solid var(--ink-4);
  white-space: nowrap;
}
.elo-form .ruleset-pill:last-child > span { border-right: 0; }
.elo-form .ruleset-pill input[type="radio"]:checked + span {
  background: var(--gold);
  color: #1f1500;
  font-weight: 600;
}

/* Slider row — range input + value readout */
.elo-form__slider-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.elo-form__slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--gold);
}
.elo-form__slider-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 2rem;
  text-align: center;
  color: var(--ink);
}

/* Pill group + adjacent button on the same line */
.elo-form__pill-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Disabled pill (locked "Per Match") */
.elo-form .ruleset-pill--disabled {
  opacity: 0.55;
}
.elo-form .ruleset-pill--disabled > span {
  cursor: default;
}

/* ── Calculator widget (inside Elo form) ── */
.elo-calc-widget {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.elo-calc-widget__title { font-size: 0.95rem; font-weight: 700; margin: 0 0 0.25rem; }
.elo-calc-widget__inputs {
  display: flex;
  gap: 1rem;
  margin: 0.75rem 0;
}
.elo-calc-widget__inputs label {
  display: flex;
  flex-direction: column;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-2);
}
.elo-calc-widget__inputs input[type="number"] {
  width: 7rem;
  margin-top: 0.25rem;
}
.elo-calc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.elo-calc-table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--line-2);
}
.elo-calc-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--line-2);
}
.elo-calc-table tr:last-child td { border-bottom: 0; }

/* Predicted outcome row — bold text */
.elo-calc-table .elo-calc-predicted td { font-weight: 700; }
.elo-calc-predicted-tag { font-weight: 400; color: var(--ink-3); font-size: 0.82rem; }

/* Blank separator row between win and loss scenarios */
.elo-calc-table .elo-calc-sep td {
  padding: 0;
  height: 0.5rem;
  border-bottom: 0;
}

/* Inline bar inside the "With Sensitivity" column (3rd col) */
.elo-calc-table td:nth-child(3) {
  position: relative;
}
.elo-bar {
  display: inline-block;
  position: absolute;
  left: 0;
  top: 15%;
  bottom: 15%;
  border-radius: 0 3px 3px 0;
  opacity: 0.18;
}
.elo-bar--pos { background: var(--success); }
.elo-bar--neg { background: var(--danger); }

/* Delta value sits on top of the bar */
.elo-calc-table td:nth-child(3) span:not(.elo-bar) {
  position: relative;
  z-index: 1;
}

/* No Sensitivity column — subdued */
.elo-calc-table td:nth-child(4) {
  color: var(--ink-3);
}

.elo-calc-note {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-3);
}

/* ── Recalculation overlay ── */
.elo-recalc-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(2px);
}
.elo-recalc-overlay__content {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
}
.elo-recalc-overlay__sub {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--ink-3);
  margin-top: 0.25rem;
}
.elo-recalc-overlay__spinner {
  width: 2rem;
  height: 2rem;
  margin: 0 auto 1rem;
  border: 3px solid var(--ink-4);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: elo-spin 0.8s linear infinite;
}
@keyframes elo-spin {
  to { transform: rotate(360deg); }
}

/* ── Activation / edit-mode banner (inside Elo modal) ── */
.elo-activation-banner {
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--gold);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--gold) 8%, white);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink);
}
.elo-activation-banner > strong {
  display: block;
  margin-bottom: 0.15rem;
  font-size: 0.95rem;
}
.elo-activation-banner__options {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.elo-activation-banner__option {
  flex: 1 1 0;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: 2px solid var(--ink-4);
  border-radius: var(--r-md);
  background: white;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.elo-activation-banner__option:hover {
  border-color: var(--ink-3);
}
.elo-activation-banner__option--selected {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 6%, white);
}
.elo-activation-banner__option input[type="radio"] {
  margin-top: 0.2rem;
  accent-color: var(--gold);
}
.elo-activation-banner__option strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.1rem;
}
.elo-activation-banner__option span {
  display: block;
  font-size: 0.82rem;
  color: var(--ink-2);
  line-height: 1.4;
}

/* ── Config page section ── */
.elo-rulesets-section { margin-bottom: 1rem; }
.elo-rulesets-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.elo-rulesets-section__title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
}
.elo-rulesets-section__card {
  padding: 1rem;
}
.elo-rulesets-section__card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.elo-rulesets-section__name { font-weight: 700; }
.elo-rulesets-section__actions { display: flex; gap: 0.35rem; }
.elo-rulesets-section__inactive { margin-top: 0.5rem; }
.elo-rulesets-section__inactive-summary {
  font-size: 0.85rem;
  color: var(--ink-3);
  cursor: pointer;
  user-select: none;
}
.elo-rulesets-section__inactive-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line-2);
  font-size: 0.9rem;
}
.elo-rulesets-section__inactive-item:last-child { border-bottom: 0; }

.elo-rulesets-section .elo-ruleset-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
}
.elo-ruleset-card__info { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; font-size: 0.85rem; }
.elo-ruleset-card__stat { color: var(--ink-2); }
.elo-ruleset-card__stat strong { color: var(--ink); }

/* ── Elo trajectory chart ── */
.elo-traj { width: 100%; height: auto; }

/* ── Platform simulator ── */
.elo-simulator { display: grid; grid-template-columns: 300px 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 768px) { .elo-simulator { grid-template-columns: 1fr; } }
.elo-sim-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.elo-sim-table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--line);
}
.elo-sim-table td { padding: 0.35rem 0.5rem; }
.elo-sim-input { width: 4rem; }
.elo-sim-select { width: 6rem; }
