/* ==========================================================================
   Ajudo — Baixar Thumbnail do YouTube
   Campo de link + grade de cards (prévia, dimensão, baixar, copiar).
   Reusa o componente .tt-* (tt-tool/tt-card) e os tokens de marca.
   ========================================================================== */

.yt-tool { max-width: 820px; }

/* --- Entrada --- */
.yt-input-block { margin-bottom: 4px; }
.yt-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}
.yt-input-wrap { display: flex; gap: 10px; align-items: stretch; }
.yt-input-wrap input[type="text"] { flex: 1 1 auto; min-width: 0; }
.yt-paste-btn { flex: 0 0 auto; white-space: nowrap; }
.yt-hint { display: inline-block; margin-top: 10px; min-height: 1.2em; }
.yt-hint.is-error { color: var(--terracotta); font-weight: 600; }

/* --- Estado vazio --- */
.yt-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 34px 18px;
  margin-top: 18px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink-soft);
}
.yt-empty svg { width: 52px; height: 39px; color: var(--line-strong); }
.yt-empty p { margin: 0; max-width: 38ch; }

/* --- Cabeçalho do resultado (oEmbed) --- */
.yt-result { margin-top: 18px; }
.yt-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  margin-bottom: 16px;
  background: var(--paper-deep);
  border-radius: var(--radius);
}
.yt-meta-thumb {
  flex: 0 0 auto;
  width: 84px;
  height: 47px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--line);
}
.yt-meta-info { min-width: 0; }
.yt-meta-title {
  margin: 0;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.yt-meta-author { margin: 2px 0 0; font-size: 0.85rem; color: var(--ink-soft); }

/* --- Barra de ações (formato + baixar todas) --- */
.yt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.yt-format {
  display: inline-flex;
  background: var(--paper-deep);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 3px;
}
.yt-fmt {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.yt-fmt.is-active { background: var(--green); color: var(--paper); }
.yt-fmt-tag { font-size: 0.72rem; opacity: 0.8; font-weight: 500; }
.yt-bulk { display: flex; align-items: center; gap: 16px; }
.yt-open { font-size: 0.9rem; font-weight: 600; color: var(--green); white-space: nowrap; }
.yt-open:hover { color: var(--green-deep); }

/* --- Grade de cards --- */
.yt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.yt-card {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.yt-card.is-ready:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.yt-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}
.yt-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.yt-card.is-loading .yt-thumb {
  background: linear-gradient(100deg, var(--paper-deep) 30%, var(--paper) 50%, var(--paper-deep) 70%);
  background-size: 220% 100%;
  animation: ytShimmer 1.1s ease-in-out infinite;
}
.yt-card.is-loading .yt-thumb img { opacity: 0; }
@keyframes ytShimmer { from { background-position: 180% 0; } to { background-position: -40% 0; } }
.yt-na {
  color: var(--paper);
  opacity: 0.72;
  font-size: 0.82rem;
  text-align: center;
  line-height: 1.4;
  padding: 8px;
}
.yt-card.is-unavailable { opacity: 0.72; }
.yt-card.is-unavailable .yt-thumb { background: var(--ink-soft); }

.yt-card-cap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 13px 6px;
}
.yt-card-name { font-size: 0.92rem; font-weight: 600; color: var(--ink); }
.yt-card-name b {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--ink);
  background: var(--mustard);
  padding: 1px 7px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 2px;
}
.yt-card-dim { font-size: 0.8rem; color: var(--ink-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }
.yt-card-actions { display: flex; gap: 8px; padding: 4px 13px 13px; margin-top: auto; }
.yt-card-actions .btn { flex: 1 1 auto; padding: 8px 10px; font-size: 0.85rem; justify-content: center; }
.yt-card-actions .btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.yt-dl.is-busy { opacity: 0.7; pointer-events: none; }

/* --- Tabela de tamanhos (referência/texto: ajusta a base .sl-table) --- */
.yt-table th, .yt-table td { vertical-align: top; }
/* última coluna é texto ("Melhor para"), não número → esquerda */
.yt-table td:last-child, .yt-table th:last-child { text-align: left; font-variant-numeric: normal; }
/* cabeçalho de linha (nome do tamanho) não é maiúsculo nem tem fundo */
.yt-table th[scope="row"] {
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  line-height: 1.45;
}
.yt-table code {
  font-size: 0.78rem;
  color: var(--ink-soft);
  background: var(--paper-deep);
  padding: 1px 6px;
  border-radius: 6px;
}
.yt-tag {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--mustard);
  padding: 1px 7px;
  border-radius: 999px;
}
.yt-note { font-size: 0.92rem; color: var(--ink-soft); margin-top: 12px; }

/* --- Listas de conteúdo --- */
.yt-tips, .yt-steps { padding-left: 0; list-style: none; }
.yt-tips li, .yt-steps li { position: relative; padding-left: 28px; margin-bottom: 12px; line-height: 1.6; }
.yt-tips li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mustard);
}
.yt-steps { counter-reset: ytstep; }
.yt-steps li { counter-increment: ytstep; padding-left: 38px; }
.yt-steps li::before {
  content: counter(ytstep);
  position: absolute;
  left: 0;
  top: 1px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--paper);
  background: var(--green);
  border-radius: 50%;
}

@media (max-width: 560px) {
  .yt-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .yt-toolbar { justify-content: stretch; }
  .yt-bulk { flex: 1 1 auto; justify-content: space-between; }
}
