/* ============================================================
   diff-table.css — Шаг 3: таблица превью diff, фильтры, бейджи
   ============================================================ */

/* ---- Заголовок шага 3 ---- */
.step3-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}
.step3-header h2 { margin-bottom: 0; }
.step3-meta {
  font-size: 12px;
  color: var(--fuel-text-muted);
  line-height: 1.6;
  text-align: right;
}

/* ---- Полоса сводки (бейджи + кнопки) ---- */
.summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.summary-badges {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.summary-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 120ms, box-shadow 120ms;
  user-select: none;
  min-width: 80px;
}
.summary-badge:hover { border-color: var(--fuel-gray-2); }
.summary-badge.active { border-color: var(--fuel-primary) !important; box-shadow: 0 0 0 1px var(--fuel-primary); }

.badge-unchanged { background: var(--status-unchanged-bg); border-color: var(--fuel-border); }
.badge-modified  { background: var(--status-modified-bg); }
.badge-added     { background: var(--status-added-bg); }
.badge-removed   { background: var(--status-removed-bg); }
.badge-invalid   { background: var(--status-invalid-bg); }

.badge-count {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}
.badge-unchanged .badge-count { color: var(--status-unchanged-fg); }
.badge-modified  .badge-count { color: var(--status-modified-fg); }
.badge-added     .badge-count { color: var(--status-added-fg); }
.badge-removed   .badge-count { color: var(--status-removed-fg); }
.badge-invalid   .badge-count { color: var(--status-invalid-fg); }

.badge-label {
  font-size: 11px;
  font-weight: 500;
  margin-top: 2px;
  color: var(--fuel-text-muted);
}

.summary-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
}

/* ---- Фильтр-бар ---- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-4);
  background: var(--fuel-surface);
  border: 1px solid var(--fuel-border);
  border-radius: var(--radius);
}

.filter-search {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--fuel-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  color: var(--fuel-text);
  outline: none;
  min-width: 220px;
  transition: border-color 120ms;
}
.filter-search:focus { border-color: var(--fuel-primary); }

.filter-sep {
  width: 1px;
  height: 24px;
  background: var(--fuel-border);
  flex-shrink: 0;
}

.filter-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.filter-toggle input[type="checkbox"] {
  accent-color: var(--fuel-primary);
  width: 14px;
  height: 14px;
}

.filter-sort {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--fuel-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  color: var(--fuel-text);
  background: var(--fuel-surface);
  outline: none;
  cursor: pointer;
}
.filter-sort:focus { border-color: var(--fuel-primary); }

/* ---- Таблица diff ---- */
.diff-table-wrap {
  background: var(--fuel-surface);
  border: 1px solid var(--fuel-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.diff-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

.diff-table thead th {
  position: sticky;
  top: 36px; /* высота баннера */
  background: var(--fuel-bg);
  border-bottom: 2px solid var(--fuel-border);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--fuel-text-muted);
  white-space: nowrap;
  z-index: 10;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.diff-table tbody tr { border-bottom: 1px solid var(--fuel-border); }
.diff-table tbody tr:last-child { border-bottom: none; }

.diff-table tbody td {
  padding: 10px 12px;
  vertical-align: top;
  line-height: 1.45;
}

/* Строки по статусу */
tr.row-modified  td { background: var(--status-modified-bg); }
tr.row-added     td { background: var(--status-added-bg); }
tr.row-removed   td { background: var(--status-removed-bg); }
tr.row-removed   td { text-decoration: line-through; color: var(--status-removed-fg); }
tr.row-invalid   td { background: var(--status-invalid-bg); }

/* Колонка № */
.col-num { width: 48px; font-size: 12px; color: var(--fuel-text-muted); }
/* Колонка Статус */
.col-status { width: 110px; }
/* Колонка Ключ */
.col-key { width: 280px; }
/* Кнопка раскрытия */
.col-expand { width: 36px; padding: 10px 4px !important; }

/* Бейдж статуса в таблице */
.status-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 99px;
  white-space: nowrap;
}
.pill-unchanged { background: var(--fuel-gray-1);          color: var(--status-unchanged-fg); }
.pill-modified  { background: var(--status-modified-bg);   color: var(--status-modified-fg); border: 1px solid #E6C500; }
.pill-added     { background: var(--status-added-bg);      color: var(--status-added-fg);    border: 1px solid #8ACC83; }
.pill-removed   { background: var(--status-removed-bg);    color: var(--status-removed-fg);  border: 1px solid #F4A097; }
.pill-invalid   { background: var(--status-invalid-bg);    color: var(--status-invalid-fg);  border: 1px solid #E06B5F; }

/* Ключ с tooltipped truncate */
.key-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
  font-size: 12px;
  color: var(--fuel-text-muted);
}

/* Значение ячейки (modified) */
.cell-new { font-weight: 500; }
.cell-old { font-size: 11px; color: var(--fuel-text-muted); display: block; margin-top: 2px; }
.delta-pos { color: var(--fuel-danger); }
.delta-neg { color: var(--fuel-success); }
.delta-big { font-weight: 700; }
.delta-huge { font-weight: 700; outline: 1px solid currentColor; border-radius: 2px; padding: 0 2px; }

/* Кнопка раскрытия деталей */
.expand-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fuel-text-muted);
  font-size: 12px;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: background 100ms, color 100ms;
  display: flex;
  align-items: center;
  justify-content: center;
}
.expand-btn:hover { background: var(--fuel-gray-1); color: var(--fuel-text); }
.expand-btn.open { color: var(--fuel-primary); }

/* Details-строка */
tr.details-row td {
  padding: 0 !important;
  background: var(--fuel-bg) !important;
  text-decoration: none !important;
}
.details-inner {
  overflow: hidden;
  max-height: 0;
  transition: max-height 200ms ease;
}
.details-inner.open { max-height: 400px; }
.details-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 8px 12px;
  width: calc(100% - 24px);
}
.details-table th {
  text-align: left;
  font-weight: 600;
  color: var(--fuel-text-muted);
  padding: 4px 8px;
  border-bottom: 1px solid var(--fuel-border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.details-table td {
  padding: 5px 8px !important;
  background: transparent !important;
  vertical-align: middle !important;
  text-decoration: none !important;
  color: var(--fuel-text) !important;
  font-size: 12px;
}
.details-table tr { border-bottom: 1px solid var(--fuel-border); }
.details-table tr:last-child { border-bottom: none; }

/* Invalid: иконка предупреждения */
.invalid-icon {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--status-invalid-fg);
}

/* ---- Пагинация ---- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-4);
  border-top: 1px solid var(--fuel-border);
}

.page-btn {
  min-width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--fuel-border);
  background: var(--fuel-surface);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--fuel-text);
  cursor: pointer;
  transition: background 100ms, border-color 100ms;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}
.page-btn:hover:not(:disabled) { background: var(--fuel-bg); border-color: var(--fuel-gray-2); }
.page-btn.active { background: var(--fuel-primary); color: #fff; border-color: var(--fuel-primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
