/* ==========================================================================
   TRADE ANALYZER
   Two-sided trade builder -> Right Now / In December verdicts -> summary.
   Tokens only, no new colors. .tool-header and .search-* are deliberate
   duplicates of the same rules in start-sit.css/team-hub.css — every tool
   page here is a self-contained CSS file (only tokens.css/base.css are
   actually shared), so that's the existing convention, not an oversight.
   ========================================================================== */

.tool-header {
  padding: var(--space-12) 0 var(--space-8);
  border-bottom: var(--border-hair);
}
.tool-header h1 { font-size: var(--text-3xl); margin-top: var(--space-3); }
.tool-header p { color: var(--text-400); max-width: 60ch; margin-top: var(--space-3); }

/* ---- Search input + dropdown (same pattern as Start/Sit / Team Hub) ---- */
.search-input {
  background: var(--ink-800);
  border: 1px solid var(--ink-600);
  color: var(--text-100);
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--text-base);
  width: 100%;
}
.search-input:focus-visible { border-color: var(--lime-500); }
.search-wrap { position: relative; }
.search-dropdown {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  right: 0;
  z-index: 20;
  margin: 0;
  padding: var(--space-2);
  list-style: none;
  max-height: 280px;
  overflow-y: auto;
  background: var(--ink-800);
  border: 1px solid var(--ink-600);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 40px -16px rgba(0, 0, 0, 0.65);
}
.search-dropdown-item {
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--text-300);
  cursor: pointer;
}
.search-dropdown-item:hover,
.search-dropdown-item:focus {
  background: var(--lime-500-15);
  color: var(--lime-500);
  outline: none;
}
.search-dropdown-empty {
  padding: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-600);
  text-align: center;
}

/* ---- Trade builder (two columns) ---- */
.trade-builder {
  padding: var(--space-8) 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--space-6);
  align-items: start;
}
.trade-column {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.trade-column label {
  font-family: var(--font-data);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-400);
}
.trade-divider {
  align-self: center;
  margin-top: var(--space-8);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--ink-600);
  color: var(--text-600);
}
.trade-divider-icon { font-size: var(--text-lg); }

/* ---- Source toggle (Search / Pick a Team) ----
   Hidden entirely unless a league is synced (see trade-analyzer.js) --
   same button-group visual language as Team Hub's format selector,
   duplicated here per this file's self-contained-CSS convention. */
.trade-source-toggle {
  display: flex;
  gap: var(--space-2);
}
.source-btn {
  flex: 1;
  background: var(--ink-800);
  border: 1px solid var(--ink-600);
  color: var(--text-300);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-family: var(--font-data);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color var(--dur-fast), color var(--dur-fast), background var(--dur-fast);
}
.source-btn:hover { border-color: var(--lime-500); color: var(--lime-500); }
.source-btn-active {
  background: var(--lime-500-15);
  border-color: var(--lime-500);
  color: var(--lime-500);
}

/* ---- Team picker (pick a real team, then a player off its roster) ----
   .league-pick-* duplicated from team-hub.css's League Sync list, same
   self-contained-CSS convention. */
.league-pick-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.league-pick-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--ink-800);
  border: 1px solid var(--ink-600);
  border-radius: var(--radius-sm);
  color: var(--text-100);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.league-pick-item:hover { border-color: var(--lime-500); }
.league-pick-item-active { border-color: var(--lime-500); background: var(--lime-500-15); }
.league-pick-name { font-weight: 600; }
.league-pick-meta { font-family: var(--font-data); font-size: var(--text-xs); color: var(--text-400); white-space: nowrap; }

.trade-team-picker {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.trade-team-roster {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 320px;
  overflow-y: auto;
}

.trade-roster {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-height: 64px;
}
.trade-empty {
  color: var(--text-600);
  font-size: var(--text-sm);
  padding: var(--space-3) 0;
}
.trade-chip {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--ink-800);
  border: 1px solid var(--ink-700);
  border-radius: var(--radius-sm);
}
.trade-chip-name { font-family: var(--font-body); font-weight: 600; font-size: var(--text-sm); }
.trade-chip-meta {
  font-family: var(--font-data);
  font-size: var(--text-xs);
  color: var(--text-400);
  white-space: nowrap;
}
.trade-chip-remove {
  background: none;
  border: none;
  color: var(--text-600);
  font-size: var(--text-lg);
  line-height: 1;
  cursor: pointer;
  padding: 0 var(--space-1);
}
.trade-chip-remove:hover { color: var(--lime-500); }

/* ---- Verdicts ---- */
/* Single verdict card now (the "In December" comparison was removed) --
   centered with a comfortable max-width rather than stretched full width,
   which looked sparse for just one card's worth of content. */
.trade-verdicts {
  padding: var(--space-8) 0;
  display: flex;
  justify-content: center;
  border-top: var(--border-hair);
}
.verdict-card {
  background: var(--ink-900);
  border: var(--border-hair);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  width: 100%;
  max-width: 480px;
}
.verdict-card h3 { font-size: var(--text-lg); text-transform: none; letter-spacing: 0; }
.verdict-subhead {
  font-family: var(--font-data);
  font-size: var(--text-xs);
  color: var(--text-600);
  margin-top: var(--space-1);
  margin-bottom: var(--space-4);
}
.verdict-totals {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: var(--border-hair);
  margin-bottom: var(--space-4);
}
.verdict-side { display: flex; flex-direction: column; gap: var(--space-1); }
.verdict-side:last-child { align-items: flex-end; text-align: right; }
.verdict-side-label {
  font-family: var(--font-data);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-400);
}
.verdict-side-total {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--lime-500);
  line-height: 1;
}
.verdict-callout {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.verdict-gap {
  font-family: var(--font-data);
  font-size: var(--text-sm);
  color: var(--text-400);
}
.verdict-share-btn { margin-top: var(--space-4); width: 100%; }

/* Own copy of the "Start" badge treatment (see .badge-start in
   start-sit.css / team-hub.css) — kept local per this file's
   self-contained convention. */
.badge-start {
  color: var(--ink-950);
  border-color: var(--lime-500);
  background: var(--lime-500);
}

/* ---- Summary ---- */
.trade-summary {
  padding: var(--space-8) 0 var(--space-16);
}
.trade-summary h3 {
  font-family: var(--font-data);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lime-500);
  margin-bottom: var(--space-3);
}
.trade-summary p { color: var(--text-300); font-size: var(--text-base); max-width: 68ch; }

/* ---- Share Result modal ----
   No modal/popup pattern existed anywhere in this file before -- this is
   Start/Sit's modal shell + share-card-content rules, duplicated here
   per this site's self-contained-CSS-per-tool convention (same source
   comments as start-sit.css explain the [hidden]/display cascade fix and
   why the backdrop is a separate element). */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}
.modal-overlay:not([hidden]) {
  display: flex;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--ink-950);
  opacity: 0.85;
}
.modal-box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--ink-900);
  border: var(--border-hair);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: var(--border-hair);
}
.modal-head h2 { font-size: var(--text-xl); }
.modal-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--ink-600);
  border-radius: var(--radius-sm);
  color: var(--text-400);
  font-size: var(--text-lg);
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover { border-color: var(--lime-500); color: var(--lime-500); }

.share-card-preview {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: var(--border-hair);
  margin-bottom: var(--space-4);
}
.share-card-preview img { display: block; width: 100%; height: auto; }
.share-card-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.share-card-status {
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-300);
}

@media (max-width: 720px) {
  .trade-builder { grid-template-columns: 1fr; }
  .trade-divider { margin-top: 0; }
}
