/* ── YouTube Thumbnail Downloader – Styles ─────────────────────────────── */

.yttd-wrap {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  max-width: 760px;
  margin: 2rem auto;
  background: #f3f6fc;
  border: 1px solid #d1d9ee;
  border-radius: 16px;
  padding: clamp(1.25rem, 4vw, 2rem);
  box-shadow: 0 6px 28px rgba(80,100,160,0.13);
  color: #1e293b;
  box-sizing: border-box;
}

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

.yttd__header {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1.6rem;
}

.yttd__logo {
  font-size: 2.2rem;
  line-height: 1;
  flex-shrink: 0;
}

.yttd__title {
  font-size: clamp(1.15rem, 3.5vw, 1.45rem);
  font-weight: 800;
  margin: 0 0 0.2rem;
  color: #1e293b;
}

.yttd__desc {
  font-size: 0.88rem;
  color: #64748b;
  margin: 0;
  line-height: 1.5;
}

/* ── Input area ──────────────────────────────────────────────────────────── */

.yttd__input-group {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.yttd__input {
  flex: 1;
  min-width: 200px;
  padding: 0.7rem 1rem;
  border: 2px solid #c7d2e8;
  border-radius: 10px;
  font-size: 0.97rem;
  color: #0f172a;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.yttd__input:focus {
  outline: none;
  border-color: #ff0000;
  box-shadow: 0 0 0 3px rgba(255,0,0,0.12);
}

.yttd__input::placeholder { color: #94a3b8; }

.yttd__btn-fetch {
  padding: 0.7rem 1.5rem;
  background: #ff0000;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.97rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.yttd__btn-fetch:hover  { filter: brightness(0.88); }
.yttd__btn-fetch:active { transform: scale(0.97); }

.yttd__btn-clear {
  padding: 0.7rem 1rem;
  background: #fff;
  color: #64748b;
  border: 2px solid #c7d2e8;
  border-radius: 10px;
  font-size: 0.97rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s, border-color 0.2s;
}

.yttd__btn-clear:hover { border-color: #94a3b8; filter: brightness(0.95); }

/* ── Hint pills ──────────────────────────────────────────────────────────── */

.yttd__hints {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.4rem;
}

.yttd__hint-pill {
  padding: 0.2rem 0.65rem;
  background: #e2e8f4;
  border-radius: 20px;
  font-size: 0.75rem;
  color: #475569;
  font-weight: 500;
}

/* ── Error ───────────────────────────────────────────────────────────────── */

.yttd__error {
  padding: 0.85rem 1rem;
  background: #fef2f2;
  border: 1.5px solid #fca5a5;
  border-radius: 10px;
  color: #dc2626;
  font-size: 0.93rem;
  font-weight: 600;
  margin-bottom: 1.2rem;
  display: none;
}

.yttd__error.visible { display: block; }

/* ── Video meta bar ──────────────────────────────────────────────────────── */

.yttd__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: #dde5f4;
  border-radius: 10px;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.yttd__meta-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.yttd__meta-id {
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e293b;
  background: #fff;
  border: 1px solid #c7d2e8;
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
}

.yttd__meta-link {
  margin-left: auto;
  font-size: 0.82rem;
  color: #ff0000;
  text-decoration: none;
  font-weight: 600;
}

.yttd__meta-link:hover { text-decoration: underline; }

/* ── Thumbnails grid ─────────────────────────────────────────────────────── */

.yttd__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.yttd__card {
  background: #fff;
  border: 1.5px solid #d1d9ee;
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.15s;
  display: flex;
  flex-direction: column;
}

.yttd__card:hover {
  box-shadow: 0 6px 20px rgba(80,100,160,0.18);
  transform: translateY(-2px);
}

.yttd__card-img-wrap {
  position: relative;
  background: #0f172a;
  overflow: hidden;
  aspect-ratio: 16/9;
}

.yttd__card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.3s;
}

.yttd__card-img.loading { opacity: 0; }
.yttd__card-img.loaded  { opacity: 1; }
.yttd__card-img.broken  { opacity: 0.15; }

.yttd__card-unavailable {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  color: #94a3b8;
  background: #f1f5f9;
  flex-direction: column;
  gap: 0.3rem;
}

.yttd__card-unavailable.show { display: flex; }

.yttd__card-body {
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.yttd__card-quality {
  font-size: 0.82rem;
  font-weight: 800;
  color: #1e293b;
  letter-spacing: 0.01em;
}

.yttd__card-dims {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 500;
}

.yttd__card-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  width: fit-content;
}

.yttd__card-badge--hd   { background: #dcfce7; color: #16a34a; }
.yttd__card-badge--sd   { background: #dbeafe; color: #1d4ed8; }
.yttd__card-badge--low  { background: #f1f5f9; color: #64748b; }

.yttd__card-btn {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem;
  background: #ff0000;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.15s, transform 0.1s;
  width: 100%;
}

.yttd__card-btn:hover  { filter: brightness(0.88); color: #fff; }
.yttd__card-btn:active { transform: scale(0.97); }

.yttd__card-btn.disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  pointer-events: none;
  color: #94a3b8;
}

/* ── All-download bar ────────────────────────────────────────────────────── */

.yttd__dl-all {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  background: #dde5f4;
  border-radius: 10px;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.yttd__dl-all-text {
  font-size: 0.9rem;
  color: #374151;
  font-weight: 600;
}

.yttd__dl-all-btn {
  padding: 0.5rem 1.1rem;
  background: #1e293b;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.yttd__dl-all-btn:hover { filter: brightness(1.2); }

/* ── Results area (hidden by default) ───────────────────────────────────── */

.yttd__results { display: none; }
.yttd__results.visible { display: block; }

/* ── Empty state ─────────────────────────────────────────────────────────── */

.yttd__empty {
  text-align: center;
  padding: 2.5rem 1rem;
  background: #dde5f4;
  border-radius: 12px;
  color: #374151;
  margin-bottom: 0.5rem;
}

.yttd__empty-icon { font-size: 2.8rem; margin-bottom: 0.6rem; }

.yttd__empty-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.3rem;
}

.yttd__empty-sub {
  font-size: 0.9rem;
  color: #475569;
  line-height: 1.6;
}

/* ── Info box ────────────────────────────────────────────────────────────── */

.yttd__info {
  margin-top: 1.75rem;
  padding: 1rem 1.1rem;
  background: #dde5f4;
  border-radius: 10px;
  border-left: 4px solid #ff0000;
  font-size: 0.9rem;
  color: #374151;
  line-height: 1.75;
}

.yttd__info strong { color: #1e293b; }

/* ── Loading spinner ─────────────────────────────────────────────────────── */

.yttd__spinner {
  display: none;
  text-align: center;
  padding: 2rem;
  color: #64748b;
  font-size: 0.9rem;
}

.yttd__spinner.visible { display: block; }

.yttd__spinner-ring {
  width: 36px;
  height: 36px;
  border: 4px solid #e2e8f0;
  border-top-color: #ff0000;
  border-radius: 50%;
  animation: yttd-spin 0.7s linear infinite;
  margin: 0 auto 0.75rem;
}

@keyframes yttd-spin { to { transform: rotate(360deg); } }

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 520px) {
  .yttd__grid { grid-template-columns: 1fr 1fr; }
  .yttd__input-group { flex-direction: column; }
  .yttd__btn-fetch, .yttd__btn-clear { width: 100%; justify-content: center; }
}

@media (max-width: 360px) {
  .yttd__grid { grid-template-columns: 1fr; }
}
