/* Predicciones LUB. Se carga después de brand/css/brand.css: adapta los estilos de la UI de
   basket-analytics (tablas, cancha, gráficos) al sistema de diseño de StreamMate. */

:root {
  --panel-solid: #f6f9fa;
  --head: #eaf0f3;
  --muted: var(--ink-3);
  --accent-soft: rgba(42, 100, 196, .10);
  --accent-soft-2: rgba(42, 100, 196, .18);
  --win: #1b7f45;
  --loss: #c0352b;
  --court: #fbf6ec;
  --courtline: #9a8f78;
  --ring: 0 0 0 3px rgba(66, 133, 244, .35);
}

html { scroll-behavior: smooth; }
body { font-feature-settings: "tnum"; }
b, strong { font-weight: 650; }
code { font: .85em/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--accent-soft); padding: .1em .4em; border-radius: 5px; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--accent-2); }
p { margin: 6px 0 11px; }
p.muted { line-height: 1.55; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Cabecera: nombre de la app y navegación ---------- */

.app-bar { gap: 10px 16px; }
.app-name {
  font-weight: 600;
  font-size: 13px;
  color: rgba(244, 248, 250, .92);
  padding: 3px 10px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
}
.app-name:hover { color: #fff; text-decoration: none; background: rgba(255, 255, 255, .1); }
.app-nav { flex: 1; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.app-nav::-webkit-scrollbar { display: none; }
.app-nav a:hover { text-decoration: none; }
.app-bar-right { margin-left: 0; }

.page { padding-top: 18px; }
#meta { opacity: .8; }

/* ---------- Tarjetas: casi opacas, porque llevan tablas densas ---------- */

.page .card { margin-bottom: 16px; }
.page .card::before { background: rgba(228, 238, 241, .86); }
.card h2 { font-size: 15px; font-weight: 700; color: var(--ink); margin: 0 0 10px; }
.card h2 .muted { font-weight: 500; font-size: 13px; }
.big { font-size: clamp(20px, 2.4vw, 26px); font-weight: 800; margin: 0; letter-spacing: -.02em; line-height: 1.2; color: var(--ink-inv); text-shadow: 0 1px 2px rgba(10, 30, 40, .25); }
.hdr { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.hdr > .muted, .sub, .page > .muted, .page > .row .muted { color: rgba(244, 248, 250, .88); }
.sub { margin: 4px 0 14px; }
.sub a, .hdr a { color: #dbe8ee; }
.back { background: none; border: 0; color: #e6f1f5; cursor: pointer; font: inherit; font-weight: 600; padding: 0; margin-bottom: 10px; }
.back:hover { text-decoration: underline; }
.intro { max-width: 80ch; }

/* ---------- Controles ---------- */

input[type=search], input[type=number], select {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid rgba(23, 32, 38, .2);
  border-radius: 9px; padding: 6px 10px; transition: border-color .15s, box-shadow .15s;
}
.card select, .card input[type=search], .card input[type=number] { font-size: 13px; padding: 6px 10px; border-radius: 9px; background: #fff; }
input:focus, select:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }
select {
  -webkit-appearance: none; appearance: none; padding-right: 28px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%2350626b' stroke-width='1.8' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center;
}
.card select { padding-right: 28px; }
input[type=search] { width: 100%; max-width: 420px; }
input[type=number] { width: 5.5em; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.pg {
  border: 1px solid rgba(23, 32, 38, .18); background: #fff; color: var(--ink-2); font: inherit; font-size: 13px; font-weight: 500;
  padding: 5px 12px; border-radius: 999px; cursor: pointer; transition: background .15s, color .15s;
}
.pg:hover { background: var(--accent-soft); color: var(--ink); }
.pg:disabled { opacity: .4; cursor: default; }
.pg.on { color: #fff; background: linear-gradient(135deg, var(--accent-2), var(--teal-2)); border-color: transparent; font-weight: 600; }

/* Pestañas del partido */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button {
  border: 1px solid rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .55); color: var(--ink-2); font: inherit; font-weight: 600;
  padding: 6px 13px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.tabs button:hover { background: rgba(255, 255, 255, .8); }
.tabs a {
  border: 1px solid rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .55); color: var(--ink-2); font-weight: 600;
  padding: 6px 14px; border-radius: 999px; white-space: nowrap; text-decoration: none;
}
.tabs a:hover { background: rgba(255, 255, 255, .8); text-decoration: none; color: var(--ink); }
.tabs a.on, .tabs a.on:hover { color: #fff; background: linear-gradient(135deg, var(--accent-2), var(--teal-2)); border-color: transparent; }
.hdr + .tabs { margin-top: 12px; }
.tabs button.on { color: #fff; background: linear-gradient(135deg, var(--accent-2), var(--teal-2)); border-color: transparent; }

/* ---------- Tablas: cabecera con el pizarra de la marca, filas con un velo teal ---------- */

:root {
  --th-bg: linear-gradient(180deg, #3a5a65, #2e4a54);
  --th-ink: #e8f3f5;
  --row: rgba(255, 255, 255, .5);
  --row-alt: rgba(124, 156, 166, .2);
  --row-hover: rgba(66, 133, 244, .18);
  --row-solid: #edf3f5;
  --row-solid-alt: #d9e6ea;
}
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; scrollbar-width: thin; scrollbar-color: rgba(31, 100, 120, .35) transparent; }
.scroll::-webkit-scrollbar { height: 8px; }
.scroll::-webkit-scrollbar-thumb { background: rgba(31, 100, 120, .35); border-radius: 8px; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-variant-numeric: tabular-nums; font-size: 13px; }
th, td { padding: 7px 9px; text-align: right; white-space: nowrap; border-bottom: 1px solid rgba(53, 80, 90, .12); }
th {
  background: var(--th-bg); color: var(--th-ink); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 2px solid var(--teal); position: sticky; top: 0; z-index: 1; cursor: pointer; user-select: none;
}
th:hover { color: #fff; }
thead tr:first-child th:first-child { border-top-left-radius: 10px; }
thead tr:first-child th:last-child { border-top-right-radius: 10px; }
th[data-sort=desc]::after { content: " ▼"; color: #7ff0e4; font-size: 9px; }
th[data-sort=asc]::after { content: " ▲"; color: #7ff0e4; font-size: 9px; }
th:first-child, td:first-child { text-align: left; }
td.l, th.l { text-align: left; }
tbody td { background: var(--row); }
tbody tr:nth-child(even) td { background: var(--row-alt); }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--row-hover); }
tr.click:hover td:first-child { box-shadow: inset 3px 0 0 var(--accent-2); }
tr.tot td { font-weight: 700; color: var(--ink); background: rgba(42, 100, 196, .16); border-top: 2px solid rgba(42, 100, 196, .3); }
.grp td { background: linear-gradient(90deg, rgba(31, 178, 166, .3), rgba(31, 178, 166, .1)); font-weight: 700; color: var(--teal-2); text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
td small { font-size: 11px; font-weight: 600; }
td b { color: var(--ink); }
.cmp th { cursor: default; }
.cmp td:nth-child(2) { text-align: center; color: var(--muted); font-size: 12px; }
.cmp td:nth-child(3) { text-align: right; }
.pbp td { white-space: normal; text-align: left; }
.pbp .made { color: var(--win); }
.pbp .miss { color: var(--muted); }

/* Fixture: equipos fijos a la izquierda (fondos opacos para que no se transparente el scroll) */
table.fx th, table.fx td { text-align: center; }
table.fx .c1, table.fx .c2 { position: sticky; background: var(--row-solid); z-index: 2; min-width: 150px; width: 150px; max-width: 150px; white-space: normal; text-align: left; font-weight: 600; }
table.fx .c1 { left: 0; }
table.fx .c2 { left: 150px; box-shadow: 2px 0 0 rgba(31, 178, 166, .35); }
table.fx th.c1, table.fx th.c2 { background: #34525d; z-index: 3; }
table.fx tbody tr:nth-child(even) .c1, table.fx tbody tr:nth-child(even) .c2 { background: var(--row-solid-alt); }
table.fx tr.click:hover .c1, table.fx tr.click:hover .c2 { background: #d2e0f3; }
table.fx td b { color: var(--accent-2); }
.fx-round { margin: 18px 0 8px; font-size: 14px; color: var(--teal-2); }
.fx-round:first-child { margin-top: 4px; }

/* ---------- Semántica ---------- */

.muted { color: var(--muted); }
.win { color: var(--win); font-weight: 650; }
.loss { color: var(--loss); font-weight: 650; }
.mine { color: var(--accent-2); }
td.win, td.loss { font-weight: 600; }
.score { font-weight: 700; }
.hit { padding: 10px 12px; border-bottom: 1px solid var(--rule); cursor: pointer; display: flex; justify-content: space-between; gap: 12px; border-radius: 8px; flex-wrap: wrap; }
.hit:hover { background: var(--row-hover); }
.hit:nth-child(even) { background: rgba(124, 156, 166, .14); }
.card .kv { display: grid; grid-template-columns: auto 1fr; gap: 5px 16px; align-items: baseline; margin: 0; font-size: 13px; }
.card .kv > span:nth-child(odd) { color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; color: var(--muted); font-size: 12px; align-items: center; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; margin-right: 4px; }
.note { font-size: 12px; color: var(--muted); }
.hint-tip { cursor: help; text-decoration: underline dotted; text-underline-offset: 3px; }
.disclaimer {
  margin: 0 0 16px; padding: 9px 14px; border-radius: 10px; font-size: 12.5px;
  color: var(--ink-2); background: rgba(255, 246, 214, .92); border: 1px solid rgba(255, 179, 0, .45);
}

/* Tarjetas de modelo en "Cómo predecimos" */
.models { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; }
.models .card { margin: 0; }
.model-card p { font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.model-card .btn { margin-top: 4px; }

/* ---------- Grillas y cancha ---------- */

.grid2 { display: grid; grid-template-columns: minmax(300px, 520px) 1fr; gap: 16px; align-items: start; }
.grid2 > * { min-width: 0; }
.grid2.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
svg.court { width: 100%; height: auto; background: var(--court); border-radius: 10px; display: block; }
svg.court .ln { fill: none; stroke: var(--courtline); stroke-width: .06; }

@media (max-width: 900px) {
  .grid2, .grid2.even { grid-template-columns: 1fr; }
  .app-nav { order: 3; flex: 1 1 100%; margin: 0 -4px; }
}
@media (max-width: 600px) {
  .app-name { font-size: 12px; }
  .app-bar-right { margin-left: auto; }
  .page .card { padding: 12px; border-radius: 12px; }
  th, td { padding: 5px 6px; }
  table { font-size: 12.5px; }
  .card .kv { grid-template-columns: 1fr; gap: 2px; }
  .card .kv > span:nth-child(odd) { margin-top: 6px; }
  table.fx .c1, table.fx .c2 { min-width: 88px; width: 88px; max-width: 88px; font-size: 11.5px; }
  table.fx .c2 { left: 88px; }
  table.fx td, table.fx th { white-space: normal; padding: 5px 4px; }
}
