/* Card Header v2 — UI Comprehensive Refactor */

/* ── Container ──────────────────────────────────────────────────────────── */

.card-header-v2 {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}

/* ── Icon container (36×36, surface-hover bg) ───────────────────────────── */

.card-header__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius-base);
  background: var(--surface-hover);
  color: var(--text-secondary);
}

/* ── Text block (column, uses .card-title / .card-description) ──────────── */

.card-header__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

/* .card-title and .card-description come from typography.css */

/* ── Variant: no separator border ───────────────────────────────────────── */

.card-header-v2--no-border {
  border-bottom: none;
}

/* ── Compact variant (density-first dashboard sections) ─────────────────── */
/* Used with `.card-header--compact` modifier on the standard `.card-header`.
   Tighter padding, smaller icon, inline title row. */

.card--compact {
  /* no min-height — let content drive it */
}
.card--compact > .card-header,
.card-header--compact {
  padding: var(--space-3) var(--space-4);
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}

.card-header__title {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  margin-right: auto;
}

/* When the compact card-header has a bare <h3> as direct first child (no
   __title wrapper around the icon+text), pin it to the left so it doesn't
   drift to the right edge under justify-content:space-between. */
.card-header--compact > .section-title:first-child,
.card-header--compact > h2:first-child,
.card-header--compact > h3:first-child,
.card-header--compact > h4:first-child {
  margin-right: auto;
}

/* Same when an icon is the bare first child followed by the title sibling. */
.card-header--compact > svg.icon:first-child + .section-title,
.card-header--compact > svg.icon:first-child + h3 {
  margin-right: auto;
}

/* When the header uses the icon-wrapper + text-wrapper pattern
   (the structure produced by Hunter-config agent), pin the text block left
   and shrink the icon wrapper so the title sits next to the icon, not at the
   opposite edge. */
.card-header--compact > .card-header__text {
  margin-right: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.card-header--compact > .card-header__icon {
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-header--compact > .card-header__icon .icon,
.card-header--compact > .card-header__icon .icon-md {
  width: 18px;
  height: 18px;
}

.card-header--compact .card-header__icon {
  width: 18px;
  height: 18px;
  background: transparent;
  border-radius: 0;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.card-header--compact .section-title {
  font-size: var(--font-md);
  font-weight: var(--weight-semi);  /* 600 — matches .card-title; was weight-medium (500) */
  margin: 0;
}

/* ── btn-link (compact text-only link button) ───────────────────────────── */

.btn-link {
  background: transparent !important;
  border: none !important;
  padding: 4px 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--font-sm);
  transition: color 0.12s ease;
}
.btn-link:hover {
  color: var(--text-primary);
  background: var(--surface-hover) !important;
}

/* Subtitle / secondary line inside a card header text block, and the
   right-aligned actions group. Added for the v2 restyle of the Источники tab
   (channels stats + telegram auth subtitle); additive — used app-wide. */
.card-subtitle {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  font-weight: var(--weight-regular, 400);
  line-height: 1.2;
}
.card-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}
