/* ============================================================
   trends.css — Team Trends page
   Covers page layout, controls, team search, chips, chart card.
   style.css handles header/nav/base typography.
   charts.css handles shared chart primitives.
   ============================================================ */

/* ── Page wrapper ─────────────────────────────────────────── */
.trends-page {
  max-width: 1140px;
  margin: 2rem auto;
  padding: 0 1.25rem 3rem;
}

/* ── Page header ──────────────────────────────────────────── */
.trends-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.trends-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1E3A8A;
  margin: 0 0 0.25rem;
}

.trends-subtitle {
  font-size: 0.92rem;
  color: #6B7280;
  margin: 0;
}

.trends-season-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* ── Shared label ─────────────────────────────────────────── */
.trends-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.055em;
}

/* ── Season select ────────────────────────────────────────── */
.trends-select {
  font-size: 0.9rem;
  padding: 0.42rem 0.75rem;
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  background: #F9FAFB;
  color: #111827;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

.trends-select:focus {
  border-color: #1E3A8A;
}

/* ── Controls row ─────────────────────────────────────────── */
.trends-controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1.25rem;
  background: #ffffff;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  padding: 1.1rem 1.4rem;
  margin-bottom: 0.85rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.trends-control-block {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* ── Search input + dropdown ──────────────────────────────── */
.trends-search-wrap {
  position: relative;
}

.trends-search-input {
  font-size: 0.9rem;
  padding: 0.44rem 0.8rem;
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  background: #F9FAFB;
  color: #111827;
  min-width: 220px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.trends-search-input:focus {
  border-color: #1E3A8A;
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.08);
}

.trends-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 200;
  background: #ffffff;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  max-height: 230px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0.3rem 0;
}

.trends-suggestions li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.48rem 0.9rem;
  font-size: 0.88rem;
  color: #111827;
  cursor: pointer;
  transition: background 0.1s;
}

.trends-suggestions li:hover {
  background: #F3F4F6;
}

.trends-sugg-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

/* ── Toggle group ─────────────────────────────────────────── */
.trends-toggle-group {
  display: flex;
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  overflow: hidden;
}

.trends-toggle {
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.42rem 1rem;
  background: #F9FAFB;
  color: #374151;
  border: none;
  border-right: 1px solid #D1D5DB;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.trends-toggle:last-child {
  border-right: none;
}

.trends-toggle.active {
  background: #1E3A8A;
  color: #ffffff;
}

.trends-toggle:hover:not(.active) {
  background: #EFF6FF;
  color: #1E3A8A;
}

/* ── Compare row ──────────────────────────────────────────── */
.trends-compare-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
  min-height: 36px;
}

.trends-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

/* ── Chips ────────────────────────────────────────────────── */
.trends-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-left: 3px solid var(--chip-color, #F59E0B);  /* color accent on left edge */
  border-radius: 6px;
  padding: 0.22rem 0.7rem 0.22rem 0.5rem;
}

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chip-color, #F59E0B);
  flex-shrink: 0;
}

.chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: #93C5FD;
  padding: 0;
  margin-left: 0.1rem;
  transition: color 0.15s;
}

.chip-remove:hover {
  color: #1E3A8A;
}

/* ── Add compare button ───────────────────────────────────── */
.trends-add-btn {
  font-size: 0.84rem;
  font-weight: 500;
  color: #1E3A8A;
  background: #EFF6FF;
  border: 1px dashed #93C5FD;
  border-radius: 6px;
  padding: 0.38rem 0.85rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.trends-add-btn:hover {
  background: #DBEAFE;
  border-color: #60A5FA;
}

/* ── Chart card ───────────────────────────────────────────── */
.trends-chart-card {
  position: relative;
  background: #ffffff;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  min-height: 560px;
  overflow: visible;   /* ← change from overflow: hidden */
}

#trendsChart {
  width: 100%;
  height: 560px;
}

/* ── Empty state ──────────────────────────────────────────── */
.trends-chart-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: #F9FAFB;
  color: #9CA3AF;
  font-size: 0.95rem;
  font-style: italic;
  pointer-events: none;
}

/* ── Utility ──────────────────────────────────────────────── */
.hidden {
  display: none !important;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 700px) {
  .trends-page-header {
    flex-direction: column;
  }

  .trends-controls-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .trends-search-input {
    min-width: 100%;
  }

  .trends-toggle {
    padding: 0.4rem 0.65rem;
    font-size: 0.8rem;
  }

  #trendsChart {
    height: 380px;
  }
}
/* Allow Plotly tooltips to overflow the chart bounds */
#trendsChart .nsewdrag,
#trendsChart .hoverlayer {
  overflow: visible !important;
}

#trendsChart svg {
  overflow: visible !important;
}

.chip-logo {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

.chip-name {
  font-size: 0.82rem;
  font-weight: 500;
}