/* Bayes · Nueva UI — Ventana emergente de torneo (usar junto a core/js/torneo-modal.js). Clases con prefijo nui-. */
/* =========================================================
   Ventana emergente de torneo
   ========================================================= */
body.nui-modal-open { overflow: hidden; }
.nui-cup-modal {
  --m-bg: #ffffff; --m-bg2: #f5f6fb; --m-line: #e6e8f1;
  --m-text: #0f1222; --m-text2: #545a70; --m-muted: #8a90a6;
  --m-brand: #1f1fe0; --m-brand-soft: #ebebff;
  width: min(1040px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 0; border: 0; border-radius: 20px;
  background: var(--m-bg); color: var(--m-text);
  box-shadow: 0 40px 120px rgba(0, 0, 0, .45);
  display: flex; flex-direction: column; overflow: hidden;
}
.nui-cup-modal:not([open]) { display: none; }
.nui-cup-modal::backdrop { background: rgba(6, 7, 30, .62); backdrop-filter: blur(4px); }
.nui-cup-modal[open] { animation: cmIn .18s ease-out; }
@keyframes cmIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }

.nui-cm-loading { padding: 60px; display: flex; gap: 12px; align-items: center; justify-content: center; color: var(--m-text2); }
.nui-spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--m-brand-soft); border-top-color: var(--m-brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.nui-cm-head {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--m-line);
  background: linear-gradient(135deg, #0e0f3d, #1d1f7a); color: #fff;
}
.nui-cm-title { flex: 1; min-width: 0; }
.nui-cm-eyebrow { display: inline-flex; align-items: center; gap: 6px; font: 700 13px "Saira Condensed", sans-serif; letter-spacing: .1em; text-transform: uppercase; color: #ff9a6e; }
.nui-cm-eyebrow svg { width: 14px; height: 14px; }
.nui-cm-head h2 { margin: 4px 0 0; font: 700 28px/1.05 "Saira Condensed", sans-serif; text-transform: uppercase; }
.nui-cm-sub { margin: 4px 0 0; font-size: 13px; color: #b9bce6; }
.nui-cm-x {
  flex: none; width: 38px; height: 38px; border-radius: 10px; border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.06); color: #fff; display: grid; place-items: center; cursor: pointer;
}
.nui-cm-x:hover { background: rgba(255,255,255,.16); }
.nui-cm-x svg { width: 20px; height: 20px; }

.nui-cm-scroll { overflow-y: auto; padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 18px; }

.nui-cm-info { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--m-bg2); border: 1px solid var(--m-line); border-radius: 12px; overflow: hidden; }
.nui-cm-info > div { padding: 10px 14px; box-shadow: inset -1px -1px 0 var(--m-line); }
.nui-cm-info .nui-wide { grid-column: 1 / -1; }
.nui-cm-info dt { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--m-muted); }
.nui-cm-info dd { margin: 2px 0 0; font-weight: 600; font-size: 14px; }

.nui-cm-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.nui-cm-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px;
  border-radius: 99px; border: 1px solid var(--m-line); background: #fff; color: var(--m-text2);
  font: 600 13px Inter, sans-serif; cursor: pointer;
}
.nui-cm-chip svg { width: 16px; height: 16px; }
.nui-cm-chip b { background: var(--m-bg2); border-radius: 99px; padding: 0 7px; font-size: 11.5px; color: var(--m-text2); }
.nui-cm-chip:not(:disabled):hover, .nui-cm-chip.nui-on { border-color: var(--m-brand); color: var(--m-brand); }
.nui-cm-chip.nui-on b { background: var(--m-brand); color: #fff; }
.nui-cm-chip:disabled { opacity: .45; cursor: default; }
.nui-cm-panel { background: var(--m-bg2); border-radius: 12px; padding: 8px; }
.nui-cm-list { list-style: none; margin: 0; padding: 0; }
.nui-cm-list li a, .nui-cm-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-weight: 500; }
.nui-cm-list li a { padding: 0; width: 100%; color: var(--m-brand); }
.nui-cm-list li a:hover { text-decoration: underline; }
.nui-cm-list svg { width: 18px; height: 18px; }
.nui-cm-pos { font-weight: 700; color: var(--m-brand); min-width: 24px; }

.nui-cm-tabs { display: flex; gap: 4px; padding: 4px; background: var(--m-bg2); border-radius: 12px; width: fit-content; max-width: 100%; overflow-x: auto; }
.nui-cm-tabs button {
  border: 0; background: transparent; padding: 8px 16px; border-radius: 9px; white-space: nowrap;
  font: 600 14px Inter, sans-serif; color: var(--m-text2); cursor: pointer; display: inline-flex; gap: 6px; align-items: center;
}
.nui-cm-tabs button svg { width: 16px; height: 16px; }
.nui-cm-tabs button[aria-selected="true"] { background: #fff; color: var(--m-brand); box-shadow: 0 1px 3px rgba(16,20,50,.12); }
.nui-cm-tabs.nui-small button { padding: 6px 14px; font-size: 13px; }
.nui-cm-phase-title { margin: 0; font-size: 16px; }

.nui-cm-section h4 { margin: 0 0 10px; font-size: 15px; }
.nui-cm-section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.nui-cm-section-head h4 { margin: 0; }
.nui-cm-select { height: 36px; border-radius: 9px; border: 1px solid var(--m-line); padding: 0 10px; font: inherit; font-size: 13px; background: #fff; color: var(--m-text); min-width: 200px; }
.nui-cm-empty { color: var(--m-muted); margin: 0; padding: 16px; background: var(--m-bg2); border-radius: 12px; text-align: center; display: flex; gap: 8px; justify-content: center; align-items: center; }
.nui-cm-empty svg { width: 18px; height: 18px; }

/* Grupos */
.nui-cm-groups { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.nui-cm-group { flex: none; border: 1px solid var(--m-line); border-radius: 12px; overflow: hidden; }
.nui-cm-group table, .nui-cm-matches { border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.nui-cm-group th { background: var(--m-bg2); padding: 8px 10px; font-size: 11px; font-weight: 600; color: var(--m-muted); text-transform: uppercase; letter-spacing: .03em; text-align: center; white-space: nowrap; }
.nui-cm-group th.left { text-align: left; color: var(--m-brand); font-size: 12px; min-width: 140px; }
.nui-cm-group td { padding: 7px 10px; text-align: center; border-top: 1px solid var(--m-line); white-space: nowrap; }
.nui-cm-group td.left { text-align: left; }
.nui-cm-group tbody tr:first-child td { font-weight: 600; }

/* Partidos */
.nui-cm-day { margin: 14px 0 6px; font-size: 13px; font-weight: 700; color: var(--m-text2); }
.nui-cm-table-wrap { overflow-x: auto; border: 1px solid var(--m-line); border-radius: 12px; }
.nui-cm-matches { width: 100%; }
.nui-cm-matches th { padding: 8px 10px; font-size: 11px; font-weight: 600; color: var(--m-muted); text-transform: uppercase; letter-spacing: .03em; background: var(--m-bg2); text-align: center; white-space: nowrap; }
.nui-cm-matches td { padding: 6px 10px; border-top: 1px solid var(--m-line); text-align: center; white-space: nowrap; }
.nui-cm-matches tbody tr { cursor: pointer; }
.nui-cm-matches tbody tr:hover, .nui-cm-matches tbody tr:focus-visible { background: var(--m-brand-soft); outline: none; }
.nui-cm-matches .nui-left, .nui-cm-matches th.left { text-align: left; }
.nui-cm-matches .nui-right, .nui-cm-matches th.right { text-align: right; }
.nui-muted { color: var(--m-muted); }
.nui-sets { font-weight: 700; }
.nui-st { display: inline-grid; place-items: center; }
.nui-st svg { width: 17px; height: 17px; }
.nui-st-done svg { fill: #0ca30c; }
.nui-st-live svg { fill: #eb6834; animation: pulse 1.4s ease-in-out infinite; }
.nui-st-pending svg { fill: var(--m-muted); }
@keyframes pulse { 50% { opacity: .35; } }
.nui-cm-team { border: 0; background: none; padding: 2px 0; font: inherit; color: var(--m-text); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-align: left; }
.nui-cm-team:hover { color: var(--m-brand); text-decoration: underline; }
.nui-cm-team.nui-win { font-weight: 700; }
.nui-win-badge { font-size: 10px; font-weight: 700; background: #0ca30c; color: #fff; border-radius: 4px; padding: 0 4px; line-height: 16px; }

/* Club */
.nui-cm-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.nui-cm-stat { background: var(--m-bg2); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; }
.nui-cm-stat b { font: 700 26px/1 "Saira Condensed", sans-serif; }
.nui-cm-stat span { font-size: 12px; color: var(--m-muted); margin-top: 4px; }
.nui-cm-mlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.nui-cm-mlist button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--m-line); border-radius: 12px; background: #fff; cursor: pointer; font: inherit; color: var(--m-text); text-align: left; }
.nui-cm-mlist button:hover { border-color: var(--m-brand); }
.nui-cm-res { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--m-bg2); color: var(--m-muted); flex: none; }
.nui-cm-res.nui-w { background: #e3f6e3; color: #067a06; }
.nui-cm-res.nui-l { background: #fbe5e5; color: #b02a2a; }
.nui-cm-vs { flex: 1; display: flex; flex-direction: column; }
.nui-cm-vs small { color: var(--m-muted); font-size: 12px; }

/* Partido */
.nui-cm-score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 18px; background: var(--m-bg2); border-radius: 16px; }
.nui-cm-score .nui-cm-side { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; font-weight: 600; font-size: 16px; }
.nui-cm-score .nui-cm-side.nui-win span { color: var(--m-brand); font-weight: 700; }
.nui-cm-score em { font-style: normal; font-size: 11px; font-weight: 700; color: #067a06; text-transform: uppercase; letter-spacing: .05em; }
.nui-cm-score .nui-nums { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.nui-cm-score .nui-nums b { font: 700 48px/1 "Saira Condensed", sans-serif; }
.nui-cm-score .nui-nums i { font-style: normal; font-size: 32px; color: var(--m-muted); }
.nui-cm-score .nui-nums small { width: 100%; text-align: center; font-size: 12px; color: var(--m-muted); }
.nui-cm-sets { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.nui-cm-sets span { display: flex; flex-direction: column; align-items: center; padding: 6px 12px; border: 1px solid var(--m-line); border-radius: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.nui-cm-sets small { font-size: 10.5px; color: var(--m-muted); font-weight: 600; }
.nui-cm-gal-head { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.nui-cm-gal-head h5 { margin: 0; font-size: 14px; }
.nui-cm-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--m-line); background: #fff; font: 600 13px Inter, sans-serif; color: var(--m-brand); cursor: pointer; }
.nui-cm-btn svg { width: 16px; height: 16px; }
.nui-cm-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.nui-cm-gallery img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; display: block; }

.nui-cm-note { margin: 0; font-size: 12px; color: var(--m-muted); text-align: center; }

@media (max-width: 720px) {
  .nui-cup-modal { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; margin: 0; }
  .nui-cm-head { padding: 16px; }
  .nui-cm-head h2 { font-size: 22px; }
  .nui-cm-scroll { padding: 16px; }
  .nui-cm-info { grid-template-columns: 1fr 1fr; }
  .nui-cm-stats { grid-template-columns: 1fr 1fr; }
  .nui-cm-section-head { flex-wrap: wrap; }
  .nui-cm-select { width: 100%; }
  .nui-cm-score .nui-nums b { font-size: 38px; }
}
.nui-cm-scroll > * { flex-shrink: 0; }


.nui-cm-podio + .nui-cm-podio { margin-top: 8px; }
.nui-cm-podio h5 { margin: 4px 10px; font-size: 13px; color: var(--m-text2); }
