/* whats_new.css (BUY-024).
 *
 * What's new panel content: window and category controls, activity cards, cohort action.
 * Use the theme variables from style.css :root for any colour that should
 * follow the theme.
 *
 * Agent S owns #whats-new-panel itself (position, size, close button, safe
 * areas); everything here is inside #whats-new-host. Colours come from the
 * theme variables, with the midnight values as fallbacks; the tag tints are
 * the list's chip tints so a "New" or "Reduced" home looks the same in both.
 */

/* The host takes the panel's width; cards flow into columns on a wide screen. */
#whats-new-host.whats-new-host {
  max-width: none;
}

.wn-workbench {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.wn-notice {
  font-size: 13px;
  color: var(--warning-text, #fcd34d);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md, 10px);
  padding: 8px 12px;
  margin-bottom: 12px;
}

/* --- Toolbar ------------------------------------------------------------- */

.wn-toolbar {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.wn-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.wn-row--controls {
  flex-wrap: wrap;
  gap: 8px 12px;
}

.wn-label {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim, #64748b);
}

.wn-pills {
  display: flex;
  gap: 6px;
  min-width: 0;
}

/* A row wider than the screen scrolls sideways rather than wrapping into a
   wall of pills; the scrollbar is hidden, the edge of the next pill shows. */
.wn-scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.wn-scroll::-webkit-scrollbar {
  display: none;
}

.wn-tabs {
  display: flex;
  gap: 6px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
}

.wn-pill {
  flex-shrink: 0;
  min-height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  background: var(--panel-raised, #1e293b);
  color: var(--text-muted, #94a3b8);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.wn-pill:hover {
  color: var(--text-main, #f8fafc);
  background: var(--bg-surface-hover, #1e293b);
}

.wn-pill.is-active {
  background: rgba(var(--info-rgb, 56, 189, 248), 0.18);
  border-color: var(--info, #38bdf8);
  color: var(--text-strong, #ffffff);
}

/* A window the data cannot serve today stays tappable, so its reason can be
   read on a phone; it just looks quieter. */
.wn-pill.is-unavailable {
  border-style: dashed;
  color: var(--text-dim, #64748b);
}

.wn-tabs .wn-pill {
  border-radius: var(--radius-sm, 6px) var(--radius-sm, 6px) 0 0;
  border-bottom-color: transparent;
  background: transparent;
}

.wn-tabs .wn-pill.is-active {
  background: rgba(var(--info-rgb, 56, 189, 248), 0.12);
  border-color: var(--border-color, rgba(255, 255, 255, 0.12));
  border-bottom: 2px solid var(--info, #38bdf8);
}

.wn-count {
  display: inline-block;
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(var(--overlay-rgb, 255, 255, 255), 0.08);
  color: var(--text-soft, #cbd5e1);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.wn-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
}

.wn-select select {
  min-height: 40px;
  padding: 0 10px;
  background: var(--input-bg, #020617);
  color: var(--text-main, #f8fafc);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
  border-radius: var(--radius-sm, 6px);
  font: inherit;
  font-size: 13px;
}

.wn-pill:focus-visible,
.wn-select select:focus-visible,
.wn-action:focus-visible,
.wn-cohort:focus-visible,
.wn-card .btn-fav:focus-visible {
  outline: 2px solid var(--info, #38bdf8);
  outline-offset: 2px;
}

/* --- Summary, groups, notes ---------------------------------------------- */

.wn-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

.wn-intro {
  flex: 1 1 260px;
  font-size: 13px;
  color: var(--text-muted, #94a3b8);
}

.wn-cohort {
  min-height: 40px;
  padding: 0 16px;
  background: var(--accent, #10b981);
  color: var(--on-accent, #052e16);
  border: 1px solid var(--accent, #10b981);
  border-radius: var(--radius-sm, 6px);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.wn-cohort:hover {
  background: var(--accent-hover, #059669);
}

.wn-cohort-wrap {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.wn-cohort-note {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
}

.wn-group {
  display: grid;
  gap: 8px;
}

.wn-group-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted, #94a3b8);
}

.wn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
}

.wn-empty {
  padding: 28px 12px;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted, #94a3b8);
}

.wn-more {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.wn-notes {
  list-style: none;
  display: grid;
  gap: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
  font-size: 12px;
  color: var(--text-dim, #64748b);
}

/* --- Cards --------------------------------------------------------------- */

.wn-card {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  padding: 12px 14px;
  background: var(--bg-card, #111c33);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
  border-radius: var(--radius-md, 10px);
}

.wn-card--static {
  border-style: dashed;
}

.wn-card--gone {
  background: transparent;
  color: var(--text-muted, #94a3b8);
}

.wn-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.wn-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.wn-tag {
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.14);
  color: var(--text-muted, #94a3b8);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.wn-tag--fav { background: rgba(251, 191, 36, 0.16); color: var(--warning-strong, #fbbf24); }
.wn-tag--cut { background: rgba(16, 185, 129, 0.18); color: var(--positive, #34d399); }
.wn-tag--new { background: rgba(59, 130, 246, 0.2); color: var(--info-soft, #93c5fd); }
.wn-tag--back { background: rgba(245, 158, 11, 0.18); color: var(--warning-text, #fcd34d); }
.wn-tag--gone { background: rgba(239, 68, 68, 0.16); color: var(--negative-text, #fca5a5); }
.wn-tag--under { background: rgba(16, 185, 129, 0.18); color: var(--positive, #34d399); }
.wn-tag--seen { background: transparent; border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12)); color: var(--text-dim, #64748b); }

/* The app-wide star (app.js toggles it); the popup's clearance for Leaflet's
   close button does not apply inside a card. */
.wn-card .btn-fav {
  width: 40px;
  height: 40px;
  margin: -4px -6px 0 0;
}

.wn-card-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.wn-price {
  font-size: 18px;
}

.wn-card--gone .wn-price {
  font-size: 15px;
}

.wn-ppm2 {
  margin-left: 6px;
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
}

.wn-where {
  font-size: 14px;
  color: var(--text-main, #f8fafc);
  overflow-wrap: anywhere;
}

.wn-card--gone .wn-where {
  color: var(--text-muted, #94a3b8);
}

.wn-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
}

.wn-line {
  font-size: 13px;
  color: var(--text-soft, #cbd5e1);
}

.wn-line--cut {
  color: var(--positive, #34d399);
  font-weight: 600;
}

.wn-card-foot {
  display: grid;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(var(--overlay-rgb, 255, 255, 255), 0.06);
}

.wn-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.wn-budget {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
}

.wn-budget--ok {
  color: var(--positive, #34d399);
}

.wn-offmap {
  font-size: 12px;
  color: var(--text-dim, #64748b);
}

.wn-actions {
  display: flex;
  gap: 8px;
}

.wn-action {
  flex: 1;
  min-height: 40px;
  padding: 0 14px;
  background: var(--panel-raised, #1e293b);
  color: var(--text-main, #f8fafc);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
  border-radius: var(--radius-sm, 6px);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.wn-action:hover {
  background: var(--panel-pressed, #334155);
}

.wn-action--primary {
  border-color: var(--info, #38bdf8);
}

.wn-more .wn-action {
  flex: 0 1 auto;
  min-width: 160px;
}

/* --- Phone (Pixel 8 Pro, 412 CSS px) -------------------------------------- */

@media (max-width: 600px) {
  .wn-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  /* The scope pills take a row of their own; the two selects share the next. */
  .wn-row--controls .wn-pills {
    flex: 1 1 100%;
  }

  .wn-row--controls .wn-pill {
    flex: 1 1 0;
    justify-content: center;
    padding: 0 8px;
  }

  .wn-select {
    flex: 1 1 0;
    min-width: 0;
  }

  .wn-select select {
    flex: 1;
    min-width: 0;
  }

  .wn-cohort-wrap {
    flex: 1 1 100%;
    justify-items: stretch;
  }

  .wn-cohort {
    width: 100%;
  }
}
