/* components.css — reusable UI pieces: forms, buttons, table, tags,
 * lineup cards, pills, login, spinner, diff banner, theme toggle. */

/* ─── forms ───────────────────────────────────────────────────────────── */
label { display: block; color: var(--dim); font-size: 12px; margin: 10px 0 4px; }

input, select {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--txt);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  width: 100%;
  max-width: 340px;
}
input[type="file"] { padding: 7px; }
.input-sm { width: 90px; max-width: 90px; }
.input-md { width: 120px; max-width: 120px; }

/* ─── buttons ─────────────────────────────────────────────────────────── */
.cta {
  background: var(--acc);
  color: var(--acc-txt);
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
  margin-top: var(--sp-4);
}
.cta:disabled { opacity: 0.4; cursor: default; }

.ghost {
  background: none;
  border: 1px solid var(--line);
  color: var(--dim);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
}
.ghost:hover { color: var(--txt); }

.icon-btn {
  background: none;
  border: 1px solid var(--line);
  color: var(--dim);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { color: var(--txt); }

/* ─── flat SVG icons ──────────────────────────────────────────────────── */
.icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn .icon { width: 17px; height: 17px; }
.pill .icon { width: 15px; height: 15px; vertical-align: -0.2em; }

/* ─── drag-and-drop upload zone ───────────────────────────────────────── */
.dropzone {
  position: relative;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover { border-color: var(--dim); }
.dropzone.dragover { border-color: var(--acc); background: var(--tag-ok-bg); }
.dz-icon { width: 26px; height: 26px; color: var(--dim); margin-bottom: 6px; }
.dz-browse { color: var(--acc); text-decoration: underline; }
.dz-input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer;
}
.dz-file {
  position: relative;      /* sits above the invisible full-zone input */
  z-index: 2;
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  color: var(--txt);
  padding: 2px 0;
}
.dz-file .icon { color: var(--acc); }

/* ─── table ───────────────────────────────────────────────────────────── */
.tblwrap {
  max-height: 560px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  padding: 7px 10px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th:first-child, td:first-child,
th:nth-child(2), td:nth-child(2) { text-align: left; }
th {
  color: var(--dim);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  position: sticky;
  top: 0;
  background: var(--panel);
}
tr:hover td { background: var(--row-hover); }
.tal { text-align: left; }

.pos { color: var(--dim); font-size: 11px; }
.lev-pos { color: var(--lev-pos); font-weight: 700; }
.lev-neg { color: var(--lev-neg); }

/* ─── tags ────────────────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  margin: 2px;
}
.tag.warn { background: var(--tag-warn-bg); color: var(--warn); }
.tag.info { background: var(--tag-info-bg); color: var(--blue); }
.tag.ok { background: var(--tag-ok-bg); color: var(--acc); }

/* ─── diff banner (§8.4) ──────────────────────────────────────────────── */
.diffbar {
  background: var(--diff-bg);
  border: 1px solid var(--diff-line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: var(--sp-4);
  font-size: 13px;
  color: var(--warn);
}

/* ─── lineup cards ────────────────────────────────────────────────────── */
.lineup {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: var(--sp-3);
  font-size: 12.5px;
}
.lineup .sal { color: var(--dim); float: right; }
.lineup .p { display: flex; justify-content: space-between; padding: 2px 0; }
.lineup .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }

/* ─── lock / exclude pills ────────────────────────────────────────────── */
.pill { cursor: pointer; opacity: 0.5; padding: 0 4px; }
.pill.on { opacity: 1; }
.pill.lock { color: var(--acc); }
.pill.excl { color: var(--bad); }

/* ─── login ───────────────────────────────────────────────────────────── */
#login .code {
  letter-spacing: 8px;
  font-size: 22px;
  text-align: center;
  font-family: var(--mono);
}

/* ─── results summary stat tiles (§9 Phase 6) ─────────────────────────── */
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin: var(--sp-3) 0;
}
.stat {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  min-width: 110px;
}
.stat b { display: block; font-size: 18px; }
.stat span { color: var(--dim); font-size: 11px; }

/* ─── misc ────────────────────────────────────────────────────────────── */
.muted { color: var(--dim); font-size: 12px; }
.err { color: var(--bad); font-size: 13px; margin-top: var(--sp-2); }
.link-dim { color: var(--dim); }

.btn-row { display: flex; gap: var(--sp-2); align-items: center; }

/* lineup-card team tags: LEAD the row (dim by default, stack green,
   mini-stack blue) — fixed width keeps player names aligned */
.p .tm {
  display: inline-block;
  min-width: 36px;
  color: var(--dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.p .tm.tm-stack { color: var(--lev-pos); font-weight: 800; }
.p .tm.tm-mini { color: var(--blue); font-weight: 700; }
.p .pos-tag { color: var(--dim); font-size: 11px; margin-left: 5px; }
.own-sum { color: var(--lev-pos); font-weight: 700; }
.lu-hdr {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-2);
  padding-bottom: 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.lu-ftr {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-2);
  padding-top: 6px;
  margin-top: 6px;
  border-top: 1px solid var(--line);
}
.lu-ftr .sal { float: none; }

.select {
  max-width: 100%;
  padding: 7px 10px;
  background: var(--panel);
  color: var(--txt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  cursor: pointer;
}

/* season toggles (sport nav) */
.seasons { position: relative; display: inline-flex; align-items: center; }
/* the sliders button lives inside .tabs, whose generic button padding
   (7px 14px) would crush a 30px icon-btn's content box to 0 wide */
.seasons .icon-btn { padding: 0; }
.seasons .icon-btn .icon { flex-shrink: 0; }
.pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 170px;
  padding: var(--sp-2) var(--sp-3);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 40;
}
.pop h3 { margin: 0 0 var(--sp-1); font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; }
.pop label { display: flex; align-items: center; gap: var(--sp-2); padding: 3px 0; cursor: pointer; white-space: nowrap; }
.pop label.off-lab { cursor: default; color: var(--dim); }
.tabs button.szn-off { opacity: 0.4; }

.spin {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--dim);
  border-top-color: var(--acc);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }
