/* Shared components: segmented control, buttons, chips. Built on the tokens in style.css (:root).
   The segmented control is the header tab switcher's look; use it for any one-of-N choice. */

/* ── Segmented control ──────────────────────────────────────── */
.seg {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  background: var(--surface-low);
  border-radius: 8px;
}
.seg-btn {
  padding: 6px 20px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25rem;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.seg-btn:hover { color: var(--ink); background: var(--hover-tint); }
.seg-btn.active {
  background: var(--surface-lowest);
  color: var(--primary);
  font-weight: 700;
  box-shadow: var(--shadow-raised);
}
.seg-btn:disabled { opacity: 0.4; cursor: not-allowed; background: transparent; }

.seg--sm { gap: 2px; padding: 3px; border-radius: 7px; }
.seg--sm .seg-btn { padding: 3px 10px; border-radius: 5px; font-size: 0.78rem; line-height: 1.1rem; }
.seg--block { display: flex; }
.seg--block .seg-btn { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25rem;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn .material-symbols-outlined { font-size: 18px; }

.btn-primary { background: var(--primary); color: var(--on-primary); font-weight: 700; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dim); }

.btn-secondary { background: var(--surface-low); color: var(--ink); }
.btn-secondary:hover:not(:disabled) { background: var(--primary-soft); color: var(--primary-dim); }

.btn-ghost { background: transparent; color: var(--ink-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--hover-tint); color: var(--ink); }

.btn-danger { background: color-mix(in srgb, var(--error) 6%, transparent); color: var(--error); }
.btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--error) 12%, transparent); }

.btn-lg { padding: 12px 22px; font-size: 0.95rem; }
.btn-sm { gap: 4px; padding: 4px 10px; border-radius: var(--radius-sm); font-size: 0.78rem; line-height: 1.1rem; }
.btn-sm .material-symbols-outlined { font-size: 16px; }
.btn-pill { border-radius: 9999px; }
.btn-icon { padding: 8px; border-radius: 9999px; }
.btn-icon .material-symbols-outlined { font-size: 20px; }
.btn-block { display: flex; width: 100%; }

/* ── Chips (removable filter pills) ─────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 220px;
  padding: 3px 6px 3px 8px;
  background: color-mix(in srgb, var(--primary) 9%, transparent);
  border: none;
  border-radius: 20px;
  color: var(--primary-dim);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip--query { background: var(--surface-low); border-color: var(--surface-high); color: var(--ink); }
.chip-remove {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding: 1px;
  border: none;
  background: transparent;
  color: var(--primary);
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.12s;
}
.chip-remove:hover { opacity: 1; }
.chip-remove .material-symbols-outlined { font-size: 13px; }

/* ── Dialog: a rounded box whose body scrolls, scrollbar on the box's right edge, footer pinned ── */
.dialog {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
  background: var(--surface-lowest);
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  direction: rtl;
}
.dialog-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 28px 32px 8px;
}
.dialog > .dialog-body { direction: ltr; }
.dialog-body > * { direction: rtl; }
.dialog-body::-webkit-scrollbar-track { background: transparent; margin-top: 18px; }
.dialog-footer { flex-shrink: 0; padding: 12px 32px 24px; }
