/* Tile Catalog Panel
 * Hierarchical Site -> Dataset -> Timestep -> Product UI that replaces
 * the flat raster/vector checkbox lists. Owned by widgets/tile-catalog/.
 *
 * Color palette inherits from the existing dark sidebar styling
 * (see sidebar.css). Borders + spacing match .layer-group.
 */

.tile-catalog-panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ----- Tier 1: site picker pill row -------------------------------- */
.tc-tier1-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.4rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tc-site-pill {
  background: rgba(255, 255, 255, 0.04);
  color: #d8e0e8;
  border: 1px solid rgba(255, 255, 255, 0.10);
  padding: 0.20rem 0.55rem;
  font-size: 0.78em;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
  transition: all 120ms ease-in-out;
}

.tc-site-pill:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(139, 92, 246, 0.5);
}

.tc-site-pill.active {
  background: rgba(139, 92, 246, 0.25);
  border-color: #8b5cf6;
  color: #fff;
}

.tc-site-pill .badge {
  font-size: 0.62em;
  padding: 0.2em 0.45em;
}

/* ----- Tier 2: site cards stack ------------------------------------ */
.tc-tier2-stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tc-site-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 0.5rem 0.6rem;
  background: rgba(255, 255, 255, 0.03);
}

.tc-site-card.collapsed .tc-site-body {
  display: none;
}

.tc-site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
}

.tc-site-title {
  font-size: 0.92em;
  font-weight: 500;
  color: #e8edf3;
}

.tc-site-actions .btn {
  color: #b8c2cc;
}

.tc-site-actions .btn:hover {
  color: #8b5cf6;
}

/* ----- Datasets within a site -------------------------------------- */
.tc-dataset {
  border-left: 2px solid rgba(139, 92, 246, 0.4);
  padding-left: 0.5rem;
  margin: 0.4rem 0;
}

.tc-dataset-header {
  font-size: 0.85em;
  margin-bottom: 0.35rem;
  color: #d8e0e8;
}

/* ----- Comparison-mode selector (Phase 4) -------------------------- */
.tc-mode-selector {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.tc-mode-pill {
  background: rgba(255, 255, 255, 0.04);
  color: #d8e0e8;
  border: 1px solid rgba(255, 255, 255, 0.10);
  padding: 0.18rem 0.5rem;
  font-size: 0.72em;
  border-radius: 999px;
  text-transform: capitalize;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  transition: all 120ms ease-in-out;
}

.tc-mode-pill:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(139, 92, 246, 0.5);
}

.tc-mode-pill.active {
  background: rgba(139, 92, 246, 0.25);
  border-color: #8b5cf6;
  color: #fff;
}

.tc-split-control {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.3rem;
}

.tc-split-control .form-range {
  flex: 1 1 auto;
}

/* ----- Time scrubber (Phase 3) ------------------------------------- */
.tc-scrubber {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  padding: 0.5rem 0.4rem;
  margin-bottom: 0.5rem;
}

.tc-scrubber-controls {
  display: flex;
  align-items: stretch;
  gap: 0.25rem;
}

.tc-scrubber-prev,
.tc-scrubber-next {
  color: #b8c2cc;
  width: 1.4em;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.tc-scrubber-prev:hover,
.tc-scrubber-next:hover {
  color: #8b5cf6;
}

.tc-scrubber-track {
  display: flex;
  flex: 1 1 auto;
  position: relative;
  align-items: center;
  justify-content: space-between;
}

.tc-scrubber-track::before {
  /* The horizontal rail behind the ticks. */
  content: '';
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.10);
  transform: translateY(-50%);
  pointer-events: none;
}

.tc-tick {
  position: relative;
  flex: 1 1 0;
  background: transparent;
  border: none;
  padding: 0.2rem 0.05rem 1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #b8c2cc;
  font-size: 0.72em;
  text-align: center;
}

.tc-tick:hover .tc-tick-knob {
  background: #8b5cf6;
}

.tc-tick.active {
  color: #fff;
  font-weight: 500;
}

.tc-tick.active .tc-tick-knob {
  background: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.35);
  width: 12px;
  height: 12px;
}

.tc-tick.compare .tc-tick-knob {
  background: #f59e0b; /* amber: B-pin / compare timestep */
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.35);
  width: 12px;
  height: 12px;
}

.tc-tick.compare {
  color: #fff;
  font-weight: 500;
}

.tc-active-ts-label {
  color: #c4b5fd; /* purple-light: A pin */
}

.tc-compare-ts-label {
  color: #fcd34d; /* amber-light: B pin */
}

.tc-scrubber-track.comparing::after {
  /* Subtle indicator that two pins are in play. */
  content: 'shift+click for B pin';
  position: absolute;
  bottom: -1.3em;
  right: 0;
  font-size: 0.62em;
  color: rgba(255, 255, 255, 0.4);
  pointer-events: none;
}

.tc-tick-knob {
  position: relative;
  z-index: 2;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transition: all 120ms ease-in-out;
}

.tc-tick-rail { display: none; }

.tc-tick-label {
  margin-top: 0.25rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 5em;
}

.tc-tick-dots {
  position: absolute;
  bottom: 0.05rem;
  display: flex;
  gap: 1px;
  justify-content: center;
}

.tc-tick-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  display: inline-block;
  opacity: 0.65;
}

.tc-scrubber-readout {
  margin-top: 0.4rem;
  font-size: 0.84em;
  color: #d8e0e8;
}

/* ----- Kind rows (timeseries Tier-2) ------------------------------- */
.tc-kind-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.tc-kind-row {
  padding: 0.2rem 0.1rem;
  border-radius: 2px;
}

.tc-kind-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.tc-kind-row.tc-kind-unavailable {
  opacity: 0.55;
}

.tc-variants-disclosure {
  margin-top: 0.4rem;
  padding-top: 0.3rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.10);
}

.tc-variants-disclosure summary {
  font-size: 0.82em;
  color: #b8c2cc;
  cursor: pointer;
}

.tc-variants-list {
  margin-top: 0.3rem;
}

.tc-variant-row {
  margin-bottom: 0.1rem;
}

/* ----- Product rows (checkbox + opacity) --------------------------- */
.tc-product-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.tc-product-row {
  padding: 0.15rem 0.1rem;
  border-radius: 2px;
}

.tc-product-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.tc-product-label {
  cursor: pointer;
}

.tc-opacity-slider {
  margin-left: 1.6rem;
  margin-top: 0.15rem;
}

.tc-opacity-slider .form-range {
  width: 100%;
}

/* ----- Orphan layers ----------------------------------------------- */
.tc-orphan-group {
  margin-top: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.10);
}

.tc-orphan-group summary {
  list-style: none;
  color: #b8c2cc;
}

.tc-orphan-group summary::-webkit-details-marker {
  display: none;
}

.tc-orphan-group summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 120ms;
}

.tc-orphan-group[open] summary::before {
  content: "▾ ";
}

.tc-orphan-row {
  margin-bottom: 0.1rem;
}

/* ----- Control bar (Phase 5) --------------------------------------- */
.tc-controls-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.tc-viewport-filter-switch {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
}

.tc-viewport-filter-switch input.form-check-input {
  margin-right: 0.3rem;
}

.tc-control-bar:empty {
  display: none;
}

.tc-status:empty {
  display: none;
}

.tc-status {
  margin-top: 0.4rem;
}
