/* ---- Testing Reports View (Peema QA) ---- */
.testing-reports-view {
  flex-direction: column;
  background: #FEF2F2;
  min-height: 100vh;
}
.tr-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  z-index: 250;
  flex-shrink: 0;
  border-bottom: 2px solid #dc2626;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.tr-header .epw-view-header-right {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
  padding: 3px;
}

/* ---- KPI Banner ---- */
.tr-kpi-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 28px;
  background: rgba(220, 38, 38, 0.06);
  border-bottom: 1px solid rgba(220, 38, 38, 0.12);
  font-size: 0.82rem;
  color: #475569;
  flex-shrink: 0;
}
.tr-kpi-label {
  font-weight: 600;
  color: #dc2626;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
}
.tr-kpi-num {
  font-weight: 700;
  color: #dc2626;
  font-size: 1.1rem;
}
.tr-kpi-sep {
  color: #cbd5e1;
  margin: 0 4px;
}
.tr-kpi-stat {
  display: flex;
  align-items: center;
  gap: 4px;
}
.tr-kpi-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.tr-kpi-dot.pass { background: #16A34A; }
.tr-kpi-dot.fail { background: #dc2626; }
.tr-kpi-dot.blocked { background: #D97706; }
.tr-kpi-dot.bug { background: #7C3AED; }

/* ---- Section Navigation ---- */
.tr-section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 28px;
  border-bottom: 1px solid rgba(220, 38, 38, 0.10);
  background: rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
}
.tr-section-pill {
  padding: 5px 14px;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748B;
  background: white;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}
.tr-section-pill:hover {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.3);
  color: #dc2626;
}
.tr-section-pill.active {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.3);
  color: #dc2626;
  font-weight: 600;
}

/* ---- Breadcrumb / Click-path ---- */
.tr-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 28px;
  font-size: 0.78rem;
  color: #64748b;
  background: #f1f5f9;
  border-left: 3px solid #dc2626;
  flex-shrink: 0;
}

/* ---- Scrollable Body ---- */
.tr-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 28px;
}

/* ---- Section Titles ---- */
.tr-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #dc2626;
  padding: 20px 0 8px;
  margin: 0;
  border-bottom: 2px solid rgba(220, 38, 38, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tr-section-title:hover {
  color: #b91c1c;
}
.tr-section-title .section-count {
  font-size: 0.7rem;
  font-weight: 600;
  color: white;
  background: #dc2626;
  padding: 1px 8px;
  border-radius: 10px;
}

/* ---- Test Report Cards ---- */
.tr-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
  padding: 14px 0;
}
.tr-card {
  background: white;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid rgba(220, 38, 38, 0.08);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.tr-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border-color: rgba(220, 38, 38, 0.2);
}
.tr-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.tr-card-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  color: #dc2626;
}
.tr-card-date {
  font-size: 0.7rem;
  color: #94a3b8;
}
.tr-card-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 6px;
}
.tr-card-desc {
  font-size: 0.75rem;
  color: #64748b;
  line-height: 1.5;
  margin-bottom: 10px;
}
.tr-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---- Status Badges ---- */
.tr-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.tr-badge-pass {
  background: #DCFCE7;
  color: #166534;
}
.tr-badge-fail {
  background: #FEE2E2;
  color: #991B1B;
}
.tr-badge-blocked {
  background: #FEF3C7;
  color: #92400E;
}
.tr-badge-skipped {
  background: #F1F5F9;
  color: #64748B;
}
.tr-badge-pending {
  background: #EFF6FF;
  color: #1D4ED8;
}
.tr-badge-critical {
  background: #FEE2E2;
  color: #991B1B;
  animation: tr-pulse 2s infinite;
}
.tr-badge-high {
  background: #FFEDD5;
  color: #C2410C;
}
.tr-badge-medium {
  background: #FEF3C7;
  color: #92400E;
}
.tr-badge-low {
  background: #F1F5F9;
  color: #475569;
}

@keyframes tr-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ---- Severity Legend ---- */
.tr-severity-legend {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  flex-wrap: wrap;
}
.tr-severity-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: #475569;
}

/* ---- Known Issues Table ---- */
.tr-issues-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.78rem;
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  margin: 14px 0;
}
.tr-issues-table thead th {
  position: sticky;
  top: 0;
  background: #FEF2F2;
  padding: 10px 12px;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #dc2626;
  border-bottom: 2px solid rgba(220, 38, 38, 0.15);
}
.tr-issues-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}
.tr-issues-table tbody tr:hover {
  background: rgba(220, 38, 38, 0.03);
}
.tr-bug-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  color: #dc2626;
}
.tr-bug-title {
  font-weight: 500;
  color: #1e293b;
}
.tr-bug-worker {
  font-weight: 600;
  font-size: 0.75rem;
}

/* ---- Empty State ---- */
.tr-empty {
  text-align: center;
  padding: 40px 20px;
  color: #94a3b8;
  font-size: 0.82rem;
}
.tr-empty i {
  display: block;
  font-size: 2rem;
  margin-bottom: 12px;
  opacity: 0.4;
}

/* ---- Pipeline Flow Diagram ---- */
.tr-pipeline {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 16px 0;
  justify-content: center;
  flex-wrap: wrap;
}
.tr-pipeline-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 18px;
  background: white;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  min-width: 100px;
  transition: border-color 0.15s;
  cursor: pointer;
}
.tr-pipeline-stage:hover {
  border-color: #dc2626;
}
.tr-pipeline-stage.active {
  border-color: #dc2626;
  background: rgba(220, 38, 38, 0.04);
}
.tr-pipeline-stage-icon {
  font-size: 1.2rem;
}
.tr-pipeline-stage-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tr-pipeline-stage-count {
  font-size: 0.68rem;
  color: #94a3b8;
}
.tr-pipeline-arrow {
  font-size: 1rem;
  color: #cbd5e1;
  margin: 0 2px;
}

/* ---- Summary Metrics Row ---- */
.tr-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  padding: 14px 0;
}
.tr-metric-card {
  background: white;
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  text-align: center;
}
.tr-metric-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1e293b;
}
.tr-metric-label {
  font-size: 0.68rem;
  font-weight: 500;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* ---- Sources Grid ---- */
.tr-sources-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 0;
}
.tr-source-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: white;
  border-radius: 10px;
  padding: 12px 18px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  min-width: 200px;
}
.tr-source-card i {
  font-size: 1.1rem;
}
.tr-source-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #1e293b;
}
.tr-source-type {
  font-size: 0.65rem;
  font-weight: 500;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-left: auto;
}

/* ---- Flow Diagrams (Mermaid) ---- */
.tr-flow-diagram-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}
.tr-flow-diagram-title {
  font-size: 1rem;
  font-weight: 600;
  color: #dc2626;
  margin: 0 0 8px 0;
}
.tr-flow-diagram-summary {
  font-size: 0.82rem;
  color: #64748b;
  margin: 0 0 14px 0;
}
.tr-mermaid-container {
  overflow-x: auto;
  padding: 10px 0;
}
.tr-mermaid-container .mermaid {
  display: flex;
  justify-content: center;
}

/* ---- QC Gate ---- */

/* KPI row */
.tr-qc-kpi-row { display: flex; gap: 12px; flex-wrap: wrap; padding: 14px 0; }

/* Verdict badges */
.tr-qc-verdict { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 4px; text-transform: uppercase; }
.tr-qc-verdict-pass { background: #d1fae5; color: #059669; }
.tr-qc-verdict-fail { background: #fee2e2; color: #dc2626; }
.tr-qc-verdict-auto { background: #cffafe; color: #0891b2; }
.tr-qc-verdict-override { background: #fef3c7; color: #d97706; }

/* Hold card */
.tr-qc-hold-card {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-left: 3px solid #D97706;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.tr-qc-hold-ref { font-family: 'SF Mono', monospace; font-size: 12px; color: #0D9488; font-weight: 600; }
.tr-qc-hold-title { font-size: 13px; font-weight: 600; color: #1e293b; margin: 4px 0; }
.tr-qc-hold-obs { font-size: 12px; color: #64748b; line-height: 1.4; margin: 6px 0; white-space: pre-wrap; }

.tr-qc-override-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.tr-qc-override-input { flex: 1; padding: 5px 10px; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 12px; }
.tr-qc-override-btn {
  background: #D97706; color: white; border: none; border-radius: 6px;
  padding: 5px 14px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.tr-qc-override-btn:hover { background: #b45309; }

/* Queue card */
.tr-qc-queue-card {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tr-qc-queue-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #bae6fd;
  border-top-color: #0ea5e9;
  border-radius: 50%;
  animation: tr-qc-spin 1s linear infinite;
  flex-shrink: 0;
}
@keyframes tr-qc-spin { to { transform: rotate(360deg); } }

/* Subsection titles */
.tr-qc-subsection {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  padding: 12px 0 6px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .tr-cards-grid { grid-template-columns: 1fr; }
  .tr-metrics { grid-template-columns: repeat(2, 1fr); }
  .tr-pipeline { flex-direction: column; }
  .tr-pipeline-arrow { transform: rotate(90deg); }
  .tr-qc-kpi-row { gap: 8px; }
}
