/* ─────────────────────────────────────────────────────────────────
   Explore Page — page wrapper, toolbar, and empty state.
   Covers classes used in pages/explore/__init__.py that had no CSS.
   ───────────────────────────────────────────────────────────────── */

/* ── Page wrapper ─────────────────────────────────────────────── */

.explore-page {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: var(--spacing-lg, 1.5rem);
  min-height: calc(100vh - 96px); /* below navbar + sub-tabs */
}

/* ── Sticky toolbar ───────────────────────────────────────────── */

.explore-toolbar {
  position: sticky;
  top: 96px; /* matches dashboard-sticky-banner */
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md, 1rem);
  flex-wrap: wrap;
  padding: var(--spacing-sm, 0.75rem) var(--spacing-md, 1rem);
  margin: 0 calc(-1 * var(--spacing-lg, 1.5rem));
  padding-inline: var(--spacing-lg, 1.5rem);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--spacing-lg, 1.5rem);
}

.explore-toolbar::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: -8px;
  height: 8px;
  pointer-events: none;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--text-muted) 35%, transparent), transparent);
}

[data-theme="light"] .explore-toolbar::after {
  background: linear-gradient(to bottom, color-mix(in srgb, var(--text-muted) 8%, transparent), transparent);
}

.explore-toolbar-left {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm, 0.5rem);
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.explore-toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm, 0.5rem);
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ── Unified toolbar button spec ──────────────────────────────────
   All action buttons in the toolbar share one height/padding/font.
   Scoped so it doesn't bleed to other pages using the same classes.
   ──────────────────────────────────────────────────────────────── */

.explore-toolbar .ds-change-source-btn,
.explore-toolbar .explore-fields-btn,
.explore-toolbar .save-report-btn,
.explore-toolbar .add-to-dash-btn {
  height: 34px;
  padding: 0 0.875rem;
  font-family: var(--font-body, "Roboto", sans-serif);
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: 6px;
  gap: 0.375rem;
  white-space: nowrap;
}

/* Fields button: neutral in toolbar — only content-highlight, no accent glow */
.explore-toolbar .explore-fields-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.explore-toolbar .explore-fields-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-color);
  color: var(--text-primary);
}

/* Source indicator — compact chip matching button height */
.explore-toolbar .ds-selected-indicator {
  height: 34px;
  padding: 0 0.75rem;
  border-radius: 6px;
  gap: 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  align-items: center;
}

.explore-toolbar .ds-selected-icon {
  font-size: 1rem;
  line-height: 1;
}

.explore-toolbar .ds-selected-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.explore-toolbar .ds-selected-info {
  display: flex;
  align-items: center;
}

.explore-toolbar .ds-selected-desc {
  display: none;
}

/* Thin separator between toolbar groups */
.explore-toolbar-sep {
  width: 1px;
  height: 20px;
  background: var(--border-color);
  flex-shrink: 0;
  margin: 0 0.125rem;
}

/* Field summary — tuck in beside fields button on the left */
.explore-toolbar-left .explore-field-summary {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  padding: 0;
}

/* ── Results area ─────────────────────────────────────────────── */

.explore-results {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ── Empty state ──────────────────────────────────────────────── */

.explore-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm, 0.5rem);
  padding: 6rem var(--spacing-lg, 1.5rem);
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg, 0.75rem);
  background: var(--bg-surface);
  margin: var(--spacing-lg, 1.5rem) 0;
}

.explore-empty-icon {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: var(--spacing-sm, 0.5rem);
  opacity: 0.6;
}

/* Step-2 variant: source chosen, nudge user toward fields */
.explore-empty-state--step2 .explore-empty-icon {
  opacity: 1;
}

.explore-empty-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.explore-empty-desc {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 420px;
  line-height: 1.5;
  text-align: center;
}

.explore-empty-cta-btn {
  margin-top: 1.25rem;
  padding: 0.55rem 1.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.explore-empty-cta-btn:hover {
  background: var(--accent-hover);
}

/* ── Responsive ───────────────────────────────────────────────── */

@media (max-width: 768px) {
  .explore-page {
    padding: var(--spacing-md, 1rem);
  }

  .explore-toolbar {
    flex-direction: column;
    align-items: stretch;
    top: var(--nav-height);
  }

  .explore-toolbar-left,
  .explore-toolbar-right {
    width: 100%;
    justify-content: flex-start;
  }
}
