/* Shared styles for /tools/ pages.
   Layout and spacing come from Tailwind utility classes on the pages themselves;
   this file holds the pieces Tailwind can't express cleanly or that repeat across
   every tool: the diagnostics panel, the file dropzone, and verdict states. */

/* ---------- Shell ---------- */

.tool-hero {
  background:
    radial-gradient(1200px 400px at 50% -120px, rgba(255, 59, 92, 0.16), transparent 70%),
    transparent;
}

.privacy-note {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  border: 1px solid rgba(74, 222, 128, 0.25);
  background: rgba(74, 222, 128, 0.08);
  color: #86efac;
  font-size: 0.8125rem;
  font-weight: 500;
}

/* ---------- URL / file input row ---------- */

.tool-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  color: #fff;
  font-size: 0.9375rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  transition: border-color 0.2s, background 0.2s;
}

.tool-input::placeholder {
  color: #6b7280;
  font-family: Inter, system-ui, sans-serif;
}

.tool-input:focus {
  outline: none;
  border-color: rgba(255, 59, 92, 0.6);
  background: rgba(255, 255, 255, 0.06);
}

.sample-chip {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: #bdc1c6;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.18s;
}

.sample-chip:hover {
  border-color: rgba(255, 59, 92, 0.5);
  color: #fff;
  background: rgba(255, 59, 92, 0.1);
}

/* ---------- Diagnostics panel ---------- */

.diag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
}

.diag-metric {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
}

.diag-metric-label {
  display: block;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #80868b;
  margin-bottom: 0.3rem;
}

.diag-metric-value {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.diag-metric-value.is-warn {
  color: #fbbf24;
}

.diag-metric-value.is-bad {
  color: #f87171;
}

/* Rendition ladder — scrolls independently so the page never scrolls sideways */
.ladder-wrap {
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.75rem;
}

.ladder-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 480px;
}

.ladder-table th {
  text-align: left;
  padding: 0.6rem 0.9rem;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #80868b;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

.ladder-table td {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #dadce0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ladder-table tr:last-child td {
  border-bottom: none;
}

.ladder-table tr.is-active td {
  background: rgba(255, 59, 92, 0.1);
  color: #fff;
  font-weight: 600;
}

.ladder-active-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff3b5c;
  margin-right: 0.5rem;
  vertical-align: middle;
}

/* ---------- Diagnosis / error card ---------- */

.diag-error {
  border-radius: 0.85rem;
  padding: 1.15rem 1.35rem;
  border: 1px solid rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.07);
}

.diag-error-cause {
  font-weight: 700;
  color: #fca5a5;
  margin-bottom: 0.4rem;
  font-size: 1.0625rem;
}

.diag-error-explanation {
  color: #dadce0;
  line-height: 1.6;
  font-size: 0.9375rem;
}

.diag-error-hint {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(248, 113, 113, 0.18);
  color: #9aa0a6;
  font-size: 0.875rem;
  line-height: 1.55;
}

/* ---------- File dropzone ---------- */

.dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.16);
  border-radius: 1rem;
  padding: 3rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: rgba(255, 255, 255, 0.02);
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: rgba(255, 59, 92, 0.65);
  background: rgba(255, 59, 92, 0.06);
}

.dropzone.is-dragover {
  border-style: solid;
}

/* ---------- Verdict cards ---------- */

.verdict-card {
  border-radius: 0.9rem;
  padding: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.verdict-card.is-pass {
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.06);
}

.verdict-card.is-fail {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.06);
}

.verdict-card.is-unknown {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.06);
}

.verdict-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.is-pass .verdict-badge {
  background: rgba(74, 222, 128, 0.18);
  color: #86efac;
}

.is-fail .verdict-badge {
  background: rgba(248, 113, 113, 0.18);
  color: #fca5a5;
}

.is-unknown .verdict-badge {
  background: rgba(251, 191, 36, 0.18);
  color: #fcd34d;
}

.verdict-failure {
  padding: 0.7rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.verdict-failure-attr {
  font-weight: 600;
  color: #fff;
  font-size: 0.9rem;
}

.verdict-failure-detail {
  color: #9aa0a6;
  font-size: 0.85rem;
  margin-top: 0.15rem;
  font-variant-numeric: tabular-nums;
}

.verdict-failure-fix {
  color: #bdc1c6;
  font-size: 0.85rem;
  margin-top: 0.35rem;
  line-height: 1.5;
}

.spec-source {
  font-size: 0.7rem;
  color: #5f6368;
  margin-top: 0.9rem;
}

.spec-source a {
  color: #80868b;
  text-decoration: underline;
}

.spec-source a:hover {
  color: #bdc1c6;
}

/* ---------- Attribute readout ---------- */

.attr-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.9rem;
}

.attr-row:last-child {
  border-bottom: none;
}

.attr-label {
  color: #9aa0a6;
}

.attr-value {
  color: #fff;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* ---------- Video ---------- */

.video-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 0.9rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.video-frame video {
  width: 100%;
  height: 100%;
  display: block;
}

.video-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  color: #5f6368;
  font-size: 0.9rem;
  text-align: center;
  padding: 1.5rem;
}

.video-placeholder svg {
  width: 2rem;
  height: 2rem;
  opacity: 0.5;
}

.video-placeholder strong {
  color: #9aa0a6;
  font-weight: 600;
  font-size: 0.95rem;
}


/* ---------- Input group ----------
   The field and its button are one action, so they share a height, a corner
   radius, and a border. Previously a rounded rectangle sat next to a pill at a
   different height and they read as two unrelated controls. */

.tool-input-group {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.tool-input-group .tool-input {
  flex: 1;
  min-width: 0;
}

.tool-input-group .tool-submit {
  flex: 0 0 auto;
  padding: 0 1.5rem;
  border: 0;
  border-radius: 0.75rem;
  background: #ff3b5c;
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s;
  white-space: nowrap;
}

.tool-input-group .tool-submit:hover { background: #f01d47; }
.tool-input-group .tool-submit:active { transform: translateY(1px); }
.tool-input-group .tool-submit:focus-visible {
  outline: 2px solid #ff9fb0;
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .tool-input-group { flex-direction: column; }
  .tool-input-group .tool-submit { padding: 0.75rem 1.5rem; }
}

/* ---------- Status bar ----------
   Answers "is my stream OK?" next to the input, so the verdict arrives without
   scrolling past a 540px video to reach the panel. */

.status-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  padding: 0.7rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.875rem;
  color: #dadce0;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #80868b;
  flex: 0 0 auto;
}

.status-bar.is-loading { border-color: rgba(255, 59, 92, 0.3); }
.status-bar.is-loading .status-dot {
  background: #ff3b5c;
  animation: status-pulse 1s ease-in-out infinite;
}
.status-bar.is-ok { border-color: rgba(74, 222, 128, 0.3); background: rgba(74, 222, 128, 0.06); }
.status-bar.is-ok .status-dot { background: #4ade80; }
.status-bar.is-error { border-color: rgba(248, 113, 113, 0.3); background: rgba(248, 113, 113, 0.06); }
.status-bar.is-error .status-dot { background: #f87171; }

@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.status-label { font-weight: 600; color: #fff; }

.status-facts {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  color: #9aa0a6;
  font-variant-numeric: tabular-nums;
}

.status-facts span::before { content: '·'; margin-right: 0.65rem; color: #5f6368; }

/* ---------- Player layout ----------
   Video and metrics sit side by side from 1024px so both land above the fold.
   The video is capped rather than filling the container: for a diagnostics
   tool the picture is confirmation, not the content. */

@media (min-width: 1024px) {
  .player-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 1.25rem;
    align-items: start;
  }

  .player-layout .video-frame { max-height: 420px; }

  .player-layout .diag-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .player-layout .diag-metric { padding: 0.6rem 0.85rem; }
  .player-layout .diag-metric-value { font-size: 0.95rem; }
}

/* Skeleton shown before the first stream, so the payload is visible as a
   promise rather than appearing from nowhere after playback starts. */
.diag-skeleton {
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  padding: 1rem;
  color: #5f6368;
  font-size: 0.8125rem;
  line-height: 1.6;
}

@media (prefers-reduced-motion: reduce) {
  .sample-chip,
  .tool-input,
  .tool-input-group .tool-submit,
  .dropzone {
    transition: none;
  }

  .status-bar.is-loading .status-dot { animation: none; }
}
