/* =========================================================
   Crowded Squeeze — Seasonality (Simple) page
   ========================================================= */

:root {
  --bg:       #1a1a1a;
  --panel:    #232323;
  --panel-2:  #2b2b2b;
  --panel-3:  #313131;
  --border:   #383838;
  --text:     #ececec;
  --muted:    #9b9b9b;
  --accent:   #1f9be0;
  --accent-d: #1580bd;
  --green:    #35c26a;
  --danger:   #e0576a;
  --radius:   12px;
  --shadow:   0 6px 20px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.6;
  margin: 0;
  padding: 0;
}

h1, h2, h3, h4, h5 { color: var(--text); margin-top: 0; text-align: left; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Page shell ---------- */
.season-page {
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.season-head { text-align: center; margin-bottom: 4px; }
.season-head h3 {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: baseline;
  flex-wrap: wrap;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: .2px;
  text-align: center;
}
.season-head .adv-link {
  font-size: .8rem;
  font-weight: 600;
  padding: 3px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
}
.season-head .adv-link:hover {
  color: var(--text);
  border-color: var(--accent);
  text-decoration: none;
}

/* ---------- Alerts ---------- */
.season-alert {
  max-width: 720px;
  margin: 12px auto 4px;
  text-align: center;
  font-size: .95rem;
}
.season-alert.error { color: var(--danger); font-weight: 700; }
.season-alert.info {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  color: var(--muted);
}
.season-alert.info a { font-weight: 700; white-space: nowrap; }

/* ---------- Layout ---------- */
.season-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-areas: "main aside";
  gap: 24px;
  align-items: start;
  margin-top: 18px;
}
.season-main  { grid-area: main; min-width: 0; }
.season-aside { grid-area: aside; }

/* ---------- Toolbar ---------- */
.toolbar-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 20px;
}

.search-wrap {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}
#search-input {
  width: 100%;
  padding: 11px 14px;
  font-size: .98rem;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#search-input::placeholder { color: #7d7d7d; }
#search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 155, 224, .18);
}

#search-results {
  display: none;
  list-style: none;
  position: absolute;
  left: 0;
  right: 0;
  z-index: 1000;
  margin: 6px 0 0;
  padding: 4px;
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #cfcfcf;
  border-radius: 9px;
  max-height: 320px;
  overflow-y: auto;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .45);
}
#search-results li {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: .9rem;
  cursor: pointer;
}
#search-results li:hover,
#search-results li.highlight { background: var(--accent); color: #fff; }

/* advanced-mode field grid */
.adv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px 12px;
}
.adv-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
}
.adv-field--event  span { color: #e08a7d; }
.adv-field--custom span { color: #7fc8a0; }
.adv-input {
  width: 100%;
  padding: 8px 10px;
  font-size: .9rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
}
.adv-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31,155,224,.18); }

/* range segmented control */
.range-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.range-btn--go {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}
.range-btn--go:hover { filter: brightness(1.08); color: #fff; }
.range-btn--reset { color: var(--muted); }
a.range-btn { text-decoration: none; display: inline-block; }
a.range-btn:hover { text-decoration: none; }

.event-head {
  padding: 12px 14px 0;
  font-weight: 700;
  color: var(--text);
}
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
}
.pager-info { font-size: .82rem; color: var(--muted); margin: 0 6px; }
.event-table th:first-child,
.event-table td:first-child { color: var(--muted); }
.range-btn {
  appearance: none;
  -webkit-appearance: none;
  padding: 7px 15px;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .3px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all .14s ease;
}
.range-btn:hover { color: var(--text); border-color: #4d4d4d; }
.range-btn.is-active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(31, 155, 224, .35);
}

/* ---------- Charts ---------- */
.charts {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.chart-card {
  margin: 0;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.season-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

/* client-side (Plotly) charts */
.plotly-chart { width: 100%; height: 260px; }
.plotly-chart.tall { height: 400px; }

/* stat tiles (COT snapshot etc.) */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 9px;
}
.stat-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
}
.stat-value { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.stat-value.pos { color: var(--green); }
.stat-value.neg { color: var(--danger); }
.stat-sub { font-size: .7rem; color: #6f6f6f; }

.cross-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}
.cross-head h4 { margin: 0; font-size: 1rem; font-weight: 700; }
.cross-note { margin: 8px 0 0; font-size: .78rem; color: var(--muted); }
.hdr-date { font-size: .8rem; font-weight: 400; color: var(--muted); }

/* ---- COT: primer ---- */
.primer {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.primer summary {
  cursor: pointer;
  padding: 12px 16px;
  font-weight: 700;
  font-size: .9rem;
  list-style: none;
  color: var(--text);
}
.primer summary::-webkit-details-marker { display: none; }
.primer[open] summary { border-bottom: 1px solid var(--border); }
.primer-body { padding: 14px 18px; font-size: .88rem; color: var(--muted); }
.primer-body p { margin: 0 0 10px; }
.primer-body ul { margin: 0 0 10px; padding-left: 18px; }
.primer-body li { margin-bottom: 5px; }
.primer-body strong { color: var(--text); }

/* ---- COT: hero ---- */
.tone-hot  { color: #d8a45f; }   /* crowded long  */
.tone-warm { color: #cabb92; }
.tone-flat { color: var(--text); }
.tone-cool { color: #aeb7bf; }
.tone-cold { color: #6fae99; }   /* crowded short */

.hero-headline {
  margin: 14px 0 4px;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.3;
}
@media (max-width: 560px) { .hero-headline { font-size: 1.2rem; } }

.mood-scale { position: relative; margin: 24px 0 6px; padding-top: 52px; }
.mood-scale-title {
  position: absolute;
  top: 0;
  left: 0;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
}
.mood-track {
  height: 12px;
  border-radius: 7px;
  background: linear-gradient(90deg,
    #c17b6f 0%, #c17b6f 14%, #5f5f5f 42%, #5f5f5f 58%, #5b9e8a 86%, #5b9e8a 100%);
}
.mood-now {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  text-align: center;
  font-size: .8rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.05;
  white-space: nowrap;
}
.mood-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: .72rem;
  line-height: 1.35;
  color: var(--muted);
}

.hero-meaning {
  margin: 20px 0 0;
  padding: 14px 16px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.hero-kicker {
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
  margin-bottom: 6px;
}
.hero-meaning p { margin: 0; font-size: .98rem; line-height: 1.6; color: var(--text); }

.hero-takeaway {
  display: flex;
  gap: 10px;
  margin: 16px 0 0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.55;
}
.hero-takeaway span { font-weight: 800; flex-shrink: 0; }

.hero-strip {
  margin: 18px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: .82rem;
  color: var(--muted);
}
.hero-strip b { color: var(--text); font-weight: 700; }

/* ---- COT: chart captions ---- */
.chart-caption {
  margin: 8px 4px 2px;
  font-size: .8rem;
  line-height: 1.5;
  color: var(--muted);
}
.chart-caption em { color: var(--text); font-style: normal; font-weight: 600; }

/* monthly returns table */
.table-card { padding: 0; }
.table-scroll { width: 100%; overflow-x: auto; }
.season-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
  color: var(--text);
}
.season-table th,
.season-table td {
  padding: 9px 10px;
  text-align: center;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.season-table thead th {
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  font-size: .72rem;
  background: var(--panel-2);
}
.season-table tbody th {
  text-align: left;
  color: var(--muted);
  font-weight: 700;
  position: sticky;
  left: 0;
  background: var(--panel);
}
.season-table tbody tr:last-child td,
.season-table tbody tr:last-child th { border-bottom: none; }
.season-table td.pos { color: var(--green); }
.season-table td.neg { color: var(--danger); }

.season-note {
  max-width: 760px;
  margin: 22px auto 0;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  color: var(--muted);
  font-size: .88rem;
}

/* ---------- Watchlist ---------- */
.wl-card {
  position: sticky;
  top: 16px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.wl-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.wl-head h5 { margin: 0; font-size: 1rem; font-weight: 700; }
.wl-hint {
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #6f6f6f;
}

#watchlist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wl-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  background: var(--panel-2);
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background .13s ease, border-color .13s ease;
}
.wl-item:hover { background: var(--panel-3); border-color: var(--accent); }
.wl-tkr { font-weight: 700; font-size: .9rem; letter-spacing: .4px; }
.remove-ticker {
  appearance: none;
  border: none;
  background: transparent;
  color: #6f6f6f;
  font-size: 1.15rem;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
  transition: color .12s;
}
.wl-item:hover .remove-ticker { color: var(--muted); }
.remove-ticker:hover { color: var(--danger) !important; }

.wl-add {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}
.wl-add #new-ticker {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  font-size: .85rem;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
}
.wl-add #new-ticker:focus { border-color: var(--accent); }
.wl-add #add-ticker {
  padding: 8px 14px;
  font-size: .82rem;
  font-weight: 700;
  color: #fff;
  background: var(--green);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: filter .12s;
}
.wl-add #add-ticker:hover { filter: brightness(1.08); }

/* ---------- Login modal ---------- */
#loginModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, .62);
}
#loginModal .modal-content {
  margin: 14vh auto 0;
  max-width: 340px;
  width: calc(100% - 40px);
  padding: 26px 28px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .55);
}
#loginModal h5 { margin-bottom: 8px; font-size: 1.05rem; text-align: center; }
#loginModal p { margin-bottom: 18px; color: var(--muted); font-size: .88rem; }
.btn_modal {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 11px 16px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: 9px;
  text-align: center;
}
.btn_modal:hover { background: var(--accent-d); color: #fff; text-decoration: none; }
#closeModal {
  width: 100%;
  padding: 9px 16px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
}
#closeModal:hover { color: var(--text); }

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
  .season-layout {
    grid-template-columns: 1fr;
    grid-template-areas: "aside" "main";
    gap: 16px;
  }
  .wl-card { position: static; }
  .wl-head { margin-bottom: 8px; }
  #watchlist {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .wl-item { flex: 0 0 auto; }
}

@media (max-width: 560px) {
  .season-page { padding: 16px 12px 44px; }
  .season-head h3 { font-size: 1.25rem; }
  .toolbar-card { padding: 12px; }
  .range-btn { padding: 6px 12px; }
}
