/* Media Manager - 05-diagnostics.css */

/* ---------- Diagnostics Tray (Home v1) ---------- */

/* Trigger button: bottom center, aligned to tray width */
.diagFab {
  position: fixed;
  bottom: 10px;
  z-index: 50;

  /* Default: align to mobile tray padding */
  left: 16px;
  right: 16px;

  /* Center within the bounded region */
  margin-inline: auto;
  width: fit-content;

  display: inline-flex;
  align-items: center;
  gap: 10px;

  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);

  background: var(--panel);
  color: var(--text);
  cursor: pointer;

  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.diagFab__dots {
  color: var(--muted);
  letter-spacing: 2px;
}

/* Desktop: match tray horizontal bounds exactly */
@media (min-width: 900px) {
  .diagFab {
    left: 12%;
    right: 12%;
  }
}

.diagTrayOverlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.45);
  /* Overlay only. The tray is positioned separately (it is not a child). */
}

.diagTray {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 70;

  width: min(980px, calc(100% - 36px));
  max-height: min(78vh, 760px);
  overflow: auto;

  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 18px;

  /* Closed state */
  opacity: 0;
  transform: translate(-50%, -50%) translateY(10px) scale(0.99);
  pointer-events: none;

  transition: transform 180ms ease, opacity 180ms ease;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.45);
}

.diagTray.is-open {
  opacity: 1;
  transform: translate(-50%, -50%) translateY(0) scale(1);
  pointer-events: auto;
}

.diagTray__handle {
  width: 48px;
  height: 5px;
  background: var(--line);
  border-radius: 999px;
  margin: 10px auto 6px;
}

.diagTray__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 6px;
}

.diagTray__title {
  margin: 0;
  font-size: 1.05rem;
}

.diagTray__content {
  padding: 10px 14px 16px;
}

.diagSummary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.diagChip {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 14px;
  padding: 10px 12px;
}

.diagChip__k {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.diagChip__v {
  font-size: 1.05rem;
}

.diagTray__hint {
  margin: 12px 2px 0;
}

.diagTray__actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* On larger screens, keep tray from feeling too wide */
@media (min-width: 900px) {
  .diagTray {
    left: 12%;
    right: 12%;
  }
}


/* Sidebar count pill */
.sideItem__count {
  flex: 0 0 auto;
  font-size: 11px;
  line-height: 1;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--muted);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, .20);
}

/* =========================================================
   Diagnostics Tray -> Centered Modal (override)
   - Keeps existing JS (toggles .is-open + overlay.hidden)
   - Prevents off-screen bottom-sheet behavior
   ========================================================= */
.diagTray {
  top: 50% !important;
  left: 50% !important;
  right: auto !important;
  bottom: auto !important;

  width: min(760px, calc(100vw - 32px)) !important;
  max-height: calc(100vh - 32px);
  overflow: auto;

  border: 1px solid var(--line);
  border-radius: 18px;

  /* Closed state */
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -46%) scale(.98);
  transition: transform 180ms var(--ease), opacity 180ms var(--ease);
}

.diagTray.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

/* Hide the "bottom sheet" handle in centered mode */
.diagTray__handle { display: none; }

/* Make summary chips fill modal width nicely */
.diagSummary {
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 720px) {
  .diagSummary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
