/* Light polish on top of DaisyUI. */

/* ============================================================
 * Palette override for the dim theme.
 *
 * DaisyUI dim's stock --b1/--b2/--b3 only span ~5% lightness, so
 * `bg-base-200` cards on a `bg-base-300` page barely separate. We
 * widen the gap so the existing tier vocabulary (base-100/200/300)
 * actually reads as elevation across the whole app.
 *
 * Final order (lightest → darkest):
 *   --b1  raised: navbar, page header band, trays, raised cards
 *   --b2  body band (the main content area)
 *   --b3  page background + inset / recessed blocks
 * ============================================================ */
[data-theme="dim"] {
  --b1: 220 14% 22%;
  --b2: 220 16% 14%;
  --b3: 220 18% 9%;
}


/* ============================================================
 * Surface tiers
 * DaisyUI dim:  --b1 is brightest, --b3 is darkest.
 * Dark-theme elevation: brighter = higher.
 *   --b3  page background (lowest)
 *   --b2  body band / content area (mid)
 *   --b1  raised surfaces: navbar, page header, raised cards (top)
 * ============================================================ */

.page-header {
  background-color: hsl(var(--b1));
  border-bottom: 1px solid hsl(var(--bc) / 0.14);
  box-shadow: 0 1px 0 hsl(var(--bc) / 0.04), 0 4px 14px hsl(var(--b3) / 0.4);
  position: relative;
  z-index: 1;
}
.page-header__breadcrumb {
  font-size: 0.75rem;
  color: hsl(var(--bc) / 0.6);
}
.page-header__breadcrumb a:hover { text-decoration: underline; }
.page-header__title {
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.page-header__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.625rem;
  font-size: 0.75rem;
  color: hsl(var(--bc) / 0.6);
}
.page-header__meta .sep {
  display: inline-block;
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background-color: hsl(var(--bc) / 0.35);
}

/* Page-level tab strip: shares the raised surface with the header. */
.page-tabs {
  background-color: hsl(var(--b1));
  border-bottom: 1px solid hsl(var(--bc) / 0.14);
}
.page-tab-panel { display: none; }
.page-tab-panel.is-active { display: block; }

/* Body band: the actual content area, one tier below raised surfaces. */
.page-body {
  background-color: hsl(var(--b2));
  min-height: 60vh;
}

/* Panel: a contained tray. Default container for form sections, info
   sections, and diagnostic groupings inside the body band. */
.panel {
  background-color: hsl(var(--b1));
  border: 1px solid hsl(var(--bc) / 0.08);
  border-radius: var(--rounded-box, 1rem);
  padding: 1.25rem 1.25rem 1.5rem;
  box-shadow: 0 1px 2px hsl(var(--b3) / 0.4);
}
.panel + .panel { margin-top: 1.25rem; }
.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.625rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid hsl(var(--bc) / 0.06);
}
.panel__title {
  font-size: 1rem;
  font-weight: 600;
}
.panel__subtitle {
  font-size: 0.75rem;
  color: hsl(var(--bc) / 0.6);
}

/* Inset: subordinate block, recessed against its container (typically a tray).
   For criteria lists, JSON dumps, summary blurbs inside cards. */
.inset {
  background-color: hsl(var(--b2));
  border-radius: 0.375rem;
  padding: 0.875rem 1rem;
}

/* Disclosure panel: <details class="panel"> shows the summary as the panel
   head with a chevron that flips when open. Removes the native triangle. */
details.panel > summary { list-style: none; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel:not([open]) > summary { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
details.panel > summary .toggle-label::after { content: "expand \2193"; }
details.panel[open] > summary .toggle-label::after { content: "collapse \2191"; }

/* Raised card: clickable list items that need to lift off either the body
   band or, more often, the tray they sit inside. A fifth tier above --b1
   so cards-in-trays read as distinct interactive elements. */
.card-raised {
  background-color: hsl(220 14% 28%);
  border: 1px solid hsl(var(--bc) / 0.08);
  box-shadow: 0 1px 2px hsl(var(--b3) / 0.45);
}
.card-raised.is-link {
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}
.card-raised.is-link:hover {
  border-color: hsl(var(--p) / 0.45);
  box-shadow: 0 6px 14px hsl(var(--b3) / 0.6);
  transform: translateY(-1px);
}


/* Browsers default <select multiple> to a white listbox. Force the theme palette. */
select[multiple] {
  background-color: hsl(var(--b1));
  color: hsl(var(--bc));
  border: 1px solid hsl(var(--b3));
  border-radius: var(--rounded-btn, 0.5rem);
  padding: 0.25rem 0.5rem;
  height: auto;
  min-height: 5rem;
}
select[multiple] option {
  background-color: hsl(var(--b1));
  color: hsl(var(--bc));
  padding: 0.25rem 0.5rem;
}
select[multiple] option:checked {
  background: linear-gradient(0deg, hsl(var(--p)) 0%, hsl(var(--p)) 100%);
  color: hsl(var(--pc));
}

/* Pure JS-driven panel switching (DaisyUI's .tab-active styling carries the visuals). */
.filter-tab-panel { display: none; }
.filter-tab-panel.is-active { display: block; }

/* Small count pill on tabs that have values set, complementing DaisyUI's tab-active. */
.filter-tab-button .tab-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.4rem;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: hsl(var(--p));
  color: hsl(var(--pc));
}
.filter-tab-button.tab-active .tab-count-badge {
  background: hsl(var(--pc));
  color: hsl(var(--p));
}

/* Highlight individual filter fields that have a value set */
.filter-field {
  position: relative;
  padding: 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  transition: border-color 120ms ease, background-color 120ms ease;
}
.filter-field.has-value {
  border-color: hsl(var(--p) / 0.55);
  background-color: hsl(var(--p) / 0.07);
}
.filter-field.has-value::before {
  content: "";
  position: absolute;
  top: 0.5rem;
  left: -2px;
  width: 3px;
  height: calc(100% - 1rem);
  background: hsl(var(--p));
  border-radius: 999px;
}

.font-mono-tight { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-feature-settings: "ss01", "ss02"; }

.transcript-turn .speaker { font-weight: 600; }
.transcript-turn .timestamp { color: hsl(var(--bc) / 0.5); margin-left: 0.5rem; font-family: ui-monospace, monospace; font-size: 0.85em; }

#tokens-stream { white-space: pre-wrap; word-wrap: break-word; max-height: 420px; overflow-y: auto; padding: 1rem; background: hsl(var(--b2)); border: 1px solid hsl(var(--b3)); border-radius: var(--rounded-box, 1rem); }
#transcript-stream { max-height: 560px; overflow-y: auto; padding-right: 0.25rem; }
.private-trace-stream { max-height: 560px; overflow-y: auto; padding-right: 0.25rem; }
.private-trace-card { background: hsl(var(--b2)); border-radius: var(--rounded-box, 1rem); }

.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-flex; }
.htmx-request.htmx-indicator { display: inline-flex; }

.segment-card.is-loading { opacity: 0.6; pointer-events: none; }

/* Example cards sit behind the primary work cards without disappearing. */
.example-card {
  background-color: hsl(var(--b3) / 0.45);
  border: 1px solid hsl(var(--bc) / 0.1);
  color: hsl(var(--bc) / 0.75);
}
.example-card:hover {
  background-color: hsl(var(--b3) / 0.7);
}
.example-card-title {
  color: hsl(var(--bc) / 0.85);
}
.example-card-meta {
  color: hsl(var(--bc) / 0.55);
}
.example-card-body {
  color: hsl(var(--bc) / 0.65);
}
.example-card-source {
  color: hsl(var(--bc) / 0.45);
}
