/* =====================================================
   DATASOURCE REFERENCES DIALOG
   datasource-references.css
   BizMetry Design System — Teal/Navy palette
   ===================================================== */

/* ── Dialog shell ── */
.ds-refs-dialog {
  width: 1020px;
  max-width: 95vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
}

/* ── Toolbar ── */
.ds-refs-toolbar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  min-height: 68px !important;
  flex-shrink: 0 !important;
  box-shadow: 0 2px 12px rgba(102,126,234,0.28);
}

.ds-refs-toolbar .md-toolbar-tools {
  padding: 0 20px !important;
  min-height: 68px;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  text-align: left !important;
  gap: 14px;
}

.ds-refs-toolbar-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ds-refs-toolbar-icon md-icon {
  color: white !important;
  font-size: 22px !important;
  width: 22px !important;
  height: 22px !important;
}

.ds-refs-toolbar-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start !important;
  gap: 2px;
  flex: 1;
  min-width: 0;
  text-align: left !important;
}

.ds-refs-toolbar-text h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: white;
  line-height: 1.2;
  text-align: left !important;
}

.ds-refs-toolbar-text span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left !important;
}

.ds-refs-toolbar .md-icon-button { color: rgba(255,255,255,0.9) !important; margin: 0 !important; }
.ds-refs-toolbar .md-icon-button:hover { background: rgba(255,255,255,0.12) !important; }

/* ── Content ── */
.ds-refs-content {
  flex: 1;
  overflow-y: auto;
  background: #F4F5FA;   /* --bm-navy-50 */
  padding: 0;
}

.ds-refs-content::-webkit-scrollbar { width: 6px; }
.ds-refs-content::-webkit-scrollbar-thumb { background: #BFC5D8; border-radius: 3px; } /* --bm-navy-200 */

/* ── Summary bar ── */
.ds-refs-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 24px 0 24px;
  flex-wrap: wrap;
}

.ds-refs-summary-label {
  font-size: 13px;
  color: #4B5878;        /* --bm-navy-500 */
  font-weight: 500;
}

.ds-refs-count-pill {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  gap: 5px;
  background: #f0fdfa;   /* --bm-teal-50 */
  color: #0d9488;        /* --bm-teal-600 */
  border: 1px solid #99f6e4; /* --bm-teal-200 */
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
}

.ds-refs-count-pill md-icon {
  font-size: 14px !important;
  width: 14px !important;
  height: 14px !important;
  line-height: 14px !important;
  color: #0d9488 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0;
}

/* ── List wrapper ── */
.ds-refs-list-wrapper {
  margin: 16px 24px 24px 24px;
  background: white;
  border-radius: 12px;
  border: 1px solid #DDE2EF;   /* --bm-navy-100 */
  box-shadow: 0 1px 4px rgba(8,12,24,.06);
  overflow: hidden;
}

/* ── List header ── */
.ds-refs-list-header {
  display: flex;
  align-items: center;
  padding: 0 20px 0 24px;
  height: 38px;
  background: #EFF1F8;          /* --bm-surface-3 */
  border-bottom: 2px solid #E2E5EF; /* --bm-border */
  flex-shrink: 0;
}

.ds-refs-list-header > div {
  font-size: 10px;
  font-weight: 700;
  color: #4B5878;        /* --bm-navy-500 */
  text-transform: uppercase;
  letter-spacing: 0.7px;
  padding-right: 12px;
}

/* ── Column widths ── */
.ref-col-profile  { flex: 0 0 150px; min-width: 150px; padding-right: 16px; }
.ref-col-template { flex: 1 1 0;     min-width: 180px; padding-right: 24px; }
.ref-col-version  { flex: 0 0 82px;  min-width: 82px;  padding-right: 16px; }
.ref-col-status   { flex: 0 0 110px; min-width: 110px; padding-right: 16px; }
.ref-col-types    { flex: 0 0 180px; min-width: 140px; }

/* ── Rows ── */
.ds-refs-row {
  display: flex;
  align-items: center;
  position: relative;
  padding: 0 20px 0 24px;
  min-height: 72px;
  border-bottom: 1px solid #EFF1F8;  /* --bm-border-subtle */
  background: white;
  transition: background 0.15s ease;
  animation: refRowFadeIn 0.2s ease both;
}

.ds-refs-row:last-child  { border-bottom: none; }
.ds-refs-row:hover       { background: #f0fdfa; } /* --bm-teal-50 */

.ds-refs-row:nth-child(1) { animation-delay: 0.03s; }
.ds-refs-row:nth-child(2) { animation-delay: 0.06s; }
.ds-refs-row:nth-child(3) { animation-delay: 0.09s; }
.ds-refs-row:nth-child(4) { animation-delay: 0.12s; }
.ds-refs-row:nth-child(5) { animation-delay: 0.15s; }

/* Left stripe per status */
.ds-refs-row__stripe {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: #BFC5D8;  /* --bm-navy-200 */
  transition: background 0.2s ease;
}

/* Status stripes — using BizMetry semantic tokens */
.ds-refs-row--published  .ds-refs-row__stripe { background: linear-gradient(180deg, #059669, #34d399); }
.ds-refs-row--reviewed   .ds-refs-row__stripe { background: linear-gradient(180deg, #2563EB, #60a5fa); }
.ds-refs-row--draft      .ds-refs-row__stripe { background: #BFC5D8; }
.ds-refs-row--pending    .ds-refs-row__stripe { background: linear-gradient(180deg, #D97706, #fbbf24); }
.ds-refs-row--deprecated .ds-refs-row__stripe { background: linear-gradient(180deg, #DC2626, #f87171); }

/* ── Cell content ── */

/* Profile badge — teal tint (BizMetry brand) */
.ref-profile-badge {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  gap: 5px;
  background: #f0fdfa;   /* --bm-teal-50 */
  color: #0d9488;        /* --bm-teal-600 */
  border: 1px solid #99f6e4; /* --bm-teal-200 */
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ref-profile-badge md-icon {
  font-size: 13px !important;
  width: 13px !important;
  height: 13px !important;
  line-height: 13px !important;
  color: #14b8a6 !important;  /* --bm-teal-500 */
  flex-shrink: 0;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.ref-template-name {
  font-size: 13px;
  font-weight: 600;
  color: #1E2A3A;   /* --bm-navy-800 */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 12px;
}

/* Version badge — navy tint */
.ref-version-badge {
  display: inline-flex;
  align-items: center;
  background: #F4F5FA;   /* --bm-navy-50 */
  color: #2D3A52;        /* --bm-navy-700 */
  border: 1px solid #BFC5D8; /* --bm-navy-200 */
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  white-space: nowrap;
}

/* Status chips — BizMetry semantic tokens */
.ref-status-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.ref-status-chip--published  { background: #ECFDF5; color: #065F46; border: 1px solid #6EE7B7; }
.ref-status-chip--reviewed   { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }
.ref-status-chip--draft      { background: #EFF1F8; color: #4B5878; border: 1px solid #BFC5D8; }
.ref-status-chip--pending    { background: #FFFBEB; color: #92400E; border: 1px solid #FCD34D; }
.ref-status-chip--deprecated { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }

/* Resource type tags — navy tint (replaces purple) */
.ref-type-tag {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  gap: 3px;
  background: #F4F5FA;   /* --bm-navy-50 */
  color: #2D3A52;        /* --bm-navy-700 */
  border: 1px solid #BFC5D8; /* --bm-navy-200 */
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.ref-type-tag md-icon {
  font-size: 11px !important;
  width: 11px !important;
  height: 11px !important;
  line-height: 11px !important;
  color: #4B5878 !important;  /* --bm-navy-500 */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.ref-types-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

/* ── Empty state ── */
.ds-refs-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
}

.ds-refs-empty md-icon {
  font-size: 56px !important;
  width: 56px !important;
  height: 56px !important;
  color: #BFC5D8 !important;  /* --bm-navy-200 */
  margin-bottom: 16px !important;
}

.ds-refs-empty p {
  color: #8E97B4;  /* --bm-navy-300 */
  font-size: 14px;
  margin: 0;
}

/* ── Footer actions ── */
.ds-refs-actions {
  padding: 14px 20px !important;
  border-top: 1px solid #DDE2EF !important;  /* --bm-navy-100 */
  background: white !important;
  min-height: 58px !important;
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
}

.btn-refs-close {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px;
  height: 38px !important;
  border-radius: 20px !important;
  padding: 0 20px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  text-transform: none !important;
  margin: 0 !important;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: white !important;
  border: none !important;
  box-shadow: 0 2px 8px rgba(102,126,234,0.28) !important;
  transition: all 0.2s ease !important;
}

.btn-refs-close:hover {
  box-shadow: 0 4px 14px rgba(102,126,234,0.40) !important;
  transform: translateY(-1px);
}

.btn-refs-close md-icon {
  font-size: 17px !important;
  width: 17px !important;
  height: 17px !important;
  color: white !important;
}

/* ── Animation ── */
@keyframes refRowFadeIn {
  from { opacity: 0; transform: translateX(-5px); }
  to   { opacity: 1; transform: translateX(0); }
}