/* ============================================
   GaiaMonitor Component Styles
   ============================================ */

/* -- Top bar -- */
.topbar-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.topbar-logo img,
.topbar-logo svg {
  height: 24px;
  width: auto;
}

.topbar-breadcrumb {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-tertiary);
}

.topbar-breadcrumb span {
  color: var(--text-secondary);
}

.clock-label {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.clock-value {
  color: var(--text-primary);
  font-size: 12px;
}

.met-value {
  color: var(--accent-cyan);
  font-size: 12px;
}

/* -- Layers panel -- */
.layer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-1) 0;
}

.layer-row + .layer-row {
  border-top: 1px solid var(--border-subtle);
}

.layer-label {
  font-size: 12px;
  color: var(--text-secondary);
}

/* -- Filters panel -- */
.filter-section {
  margin-bottom: var(--sp-3);
}

.filter-section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: var(--sp-1);
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}

.search-input {
  width: 100%;
  background: var(--bg-void);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-chip);
  padding: var(--sp-1) var(--sp-2);
  color: var(--text-primary);
  font-size: 12px;
}
.search-input::placeholder {
  color: var(--text-dim);
}
.search-input:focus {
  border-color: var(--accent-cyan);
}

.magnitude-slider {
  width: 100%;
  -webkit-appearance: none;
  height: 4px;
  background: var(--bg-void);
  border-radius: 2px;
  outline: none;
}
.magnitude-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: var(--accent-cyan);
  border-radius: 2px;
  cursor: pointer;
}

/* -- Legend panel -- */
.legend-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 3px 0;
}

.legend-row + .legend-row {
  border-top: 1px solid var(--border-subtle);
}

.legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 1px;
  flex-shrink: 0;
}

.legend-name {
  flex: 1;
  font-size: 11px;
  color: var(--text-secondary);
}

.legend-count {
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--text-tertiary);
}

/* -- Regions panel -- */
.region-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-1);
}

.region-btn {
  padding: var(--sp-1) var(--sp-2);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  background: var(--bg-void);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-chip);
  text-align: center;
  transition: all var(--duration-fast) var(--ease-out);
}
.region-btn:hover {
  color: var(--text-secondary);
  border-color: var(--border-strong);
}

/* -- Event detail -- */
.event-detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.event-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--sp-2);
}

.event-meta-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 3px 0;
  font-size: 11px;
  color: var(--text-secondary);
}

.event-meta-label {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  width: 72px;
  flex-shrink: 0;
}

.event-weather {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
  padding: var(--sp-2) 0;
}

.weather-stat {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

.weather-stat-label {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wiki-blurb {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-2) 0;
  border-top: 1px solid var(--border-subtle);
}

.wiki-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-chip);
  flex-shrink: 0;
}

.wiki-text {
  font-size: 11px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* -- Stats panel -- */
.stats-chart {
  padding: var(--sp-2) 0;
}

.stats-chart svg {
  width: 100%;
  display: block;
}

.top-regions-list {
  list-style: none;
}

.top-regions-list li {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  font-size: 11px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.top-regions-list li .count {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-tertiary);
}

/* -- Feed panel -- */
.feed-list {
  display: flex;
  flex-direction: column;
}

.feed-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-1);
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--duration-fast) var(--ease-out);
}
.feed-item:hover {
  background: var(--bg-elevated);
}
.feed-item.selected {
  background: var(--bg-elevated);
  border-left: 2px solid var(--accent-cyan);
}

.feed-cat-strip {
  width: 3px;
  min-height: 28px;
  border-radius: 1px;
  flex-shrink: 0;
}

.feed-content {
  flex: 1;
  min-width: 0;
}

.feed-title {
  font-size: 11px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-meta {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  margin-top: 2px;
}

.feed-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-cyan);
  animation: pulse 2s ease-in-out infinite;
  flex-shrink: 0;
  margin-top: 4px;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* -- Timeline strip -- */
.timeline-controls {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}

.timeline-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-chip);
  color: var(--text-secondary);
  transition: all var(--duration-fast) var(--ease-out);
}
.timeline-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.timeline-btn.active {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.speed-select {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-void);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 2px 4px;
  border-radius: var(--radius-chip);
}

.timeline-track {
  flex: 1;
  height: 64px;
  position: relative;
  cursor: pointer;
}

.timeline-canvas {
  width: 100%;
  height: 100%;
}

.timeline-scrubber {
  position: absolute;
  top: 0;
  width: 2px;
  height: 100%;
  background: var(--accent-cyan);
  pointer-events: none;
  z-index: 2;
}

.timeline-scrubber::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  width: 10px;
  height: 10px;
  background: var(--accent-cyan);
  border-radius: 50%;
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  flex-shrink: 0;
  width: 100px;
  text-align: right;
}

/* -- Status bar chips -- */
.source-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.source-chip .dot {
  width: 5px;
  height: 5px;
}

.fps-counter {
  font-variant-numeric: tabular-nums;
}

.fps-green  { color: var(--accent-green); }
.fps-amber  { color: var(--accent-amber); }
.fps-red    { color: var(--accent-red); }

/* -- Toast container -- */
#toast-container {
  position: fixed;
  top: calc(var(--topbar-h) + var(--sp-2));
  right: calc(var(--right-rail-w) + var(--sp-2));
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-panel);
  padding: var(--sp-2) var(--sp-3);
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  animation: toast-in var(--duration-normal) var(--ease-out);
  max-width: 320px;
}

.toast.dismissing {
  animation: toast-out var(--duration-normal) var(--ease-out) forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(16px); }
}

/* -- Command palette -- */
.cmd-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 10, 0.7);
  z-index: 9500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 120px;
}

.cmd-box {
  width: 520px;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-panel);
  overflow: hidden;
}

.cmd-input {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-panel-2);
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
}

.cmd-results {
  max-height: 320px;
  overflow-y: auto;
}

.cmd-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
}
.cmd-item:hover,
.cmd-item.focused {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.cmd-item-shortcut {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
}

/* -- Modal -- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 10, 0.75);
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-box {
  width: 480px;
  max-height: 70vh;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-panel);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
}

.modal-close {
  color: var(--text-tertiary);
  font-size: 16px;
}
.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: var(--sp-4);
  overflow-y: auto;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* -- Tooltip -- */
#tooltip {
  position: fixed;
  z-index: 8000;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-chip);
  padding: var(--sp-1) var(--sp-2);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
  pointer-events: none;
  white-space: nowrap;
  display: none;
}
