/* ─────────────────────────────────────────────────────────────
   trace-drawer.css
   Read-only slide-in drawer for outfit item policy traces.
   Scoped to .td-* / #td-* to avoid collisions.
   Mirrors the visual language of policy-drawer.css.
───────────────────────────────────────────────────────────── */

/* ── Overlay ─────────────────────────────────────────────── */

.td-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.32);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.td-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* ── Drawer shell ─────────────────────────────────────────── */

.td-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 100vw;
  height: 100%;
  background: var(--card, #fff);
  border-left: 1px solid var(--border, #e5e7eb);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.09);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
}
.td-drawer.open {
  transform: translateX(0);
}

/* ── Header ──────────────────────────────────────────────── */

.td-header {
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  flex-shrink: 0;
}
.td-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.td-close {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--muted, #9ca3af);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.12s, background 0.12s;
}
.td-close:hover {
  color: var(--heading, #111);
  background: var(--paper, #f3f4f6);
}

.td-score-pill {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  padding: 4px 11px;
  border-radius: 20px;
  font-family: 'DM Mono', 'Fira Code', monospace;
  letter-spacing: 0.3px;
  min-width: 36px;
  text-align: center;
}

.td-item-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--heading, #111);
  margin-bottom: 3px;
  line-height: 1.3;
}
.td-item-cat {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted, #9ca3af);
  font-family: 'DM Mono', 'Fira Code', monospace;
}

/* ── Blocked banner ──────────────────────────────────────── */

.td-blocked-banner {
  margin-top: 12px;
  padding: 9px 12px;
  background: #fee2e2;
  color: #b91c1c;
  border-radius: 6px;
  font-size: 13px;
  font-family: 'DM Mono', 'Fira Code', monospace;
  line-height: 1.5;
}

/* ── Scrollable body ─────────────────────────────────────── */

.td-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.td-body::-webkit-scrollbar { width: 3px; }
.td-body::-webkit-scrollbar-track { background: transparent; }
.td-body::-webkit-scrollbar-thumb {
  background: var(--border, #e5e7eb);
  border-radius: 2px;
}

/* ── Sections ─────────────────────────────────────────────── */

.td-section {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.td-section:last-child { border-bottom: none; }
.td-section--muted { opacity: 0.75; }

.td-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted, #9ca3af);
  margin-bottom: 12px;
  font-family: 'DM Mono', 'Fira Code', monospace;
}

/* ── Gate rows ───────────────────────────────────────────── */

.td-gate-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.td-gate-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.td-gate-icon {
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  margin-top: 1px;
  font-family: 'DM Mono', 'Fira Code', monospace;
}
.td-gate-pass { color: #22c55e; }
.td-gate-fail { color: #ef4444; }

.td-gate-info { flex: 1; }
.td-gate-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--heading, #111);
  margin-bottom: 2px;
}
.td-gate-reason {
  font-size: 12px;
  color: var(--muted, #6b7280);
  line-height: 1.5;
}

/* ── Score rows ──────────────────────────────────────────── */

.td-score-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.td-score-row { display: flex; flex-direction: column; gap: 5px; }

.td-score-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.td-score-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--heading, #111);
}
.td-score-delta {
  font-size: 12px;
  font-family: 'DM Mono', 'Fira Code', monospace;
  color: var(--muted, #6b7280);
  flex-shrink: 0;
}

.td-bar-track {
  height: 5px;
  background: var(--paper, #f3f4f6);
  border-radius: 3px;
  overflow: hidden;
}
.td-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.td-score-reason {
  font-size: 12px;
  color: var(--muted, #6b7280);
  line-height: 1.5;
}

/* ── Skipped rows ────────────────────────────────────────── */

.td-skipped-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.td-skipped-row {
  display: flex;
  gap: 8px;
  font-size: 12px;
  line-height: 1.5;
}
.td-skipped-name {
  font-weight: 500;
  color: var(--body, #374151);
  white-space: nowrap;
  flex-shrink: 0;
}
.td-skipped-reason {
  color: var(--muted, #9ca3af);
}

/* ── Score badge click affordance ────────────────────────── */

.outfit-score--trace {
  cursor: pointer;
  transition: opacity 0.12s, transform 0.12s;
  user-select: none;
}
.outfit-score--trace:hover {
  opacity: 0.75;
  transform: scale(1.08);
}

/* ── Mobile ──────────────────────────────────────────────── */

@media (max-width: 480px) {
  .td-drawer {
    width: 100vw;
    border-left: none;
  }
}
