body.youtube-trends-page {
  font-family: "Manrope", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 0, 55, 0.18), transparent 32rem),
    radial-gradient(circle at 86% 8%, rgba(99, 178, 255, 0.16), transparent 30rem),
    var(--bg);
  color: var(--text);
}

.youtube-trends-page *,
.youtube-trends-page *::before,
.youtube-trends-page *::after {
  box-sizing: border-box;
}

.youtube-trends-page .page-shell {
  width: min(var(--container), calc(100% - 28px));
  margin: 0 auto;
  padding-bottom: 56px;
}

.yt-breadcrumb,
.yt-hero,
.yt-panel,
.yt-state-panel,
.yt-results {
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.yt-breadcrumb {
  margin: 2px 0 12px;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
}

.yt-breadcrumb a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 800;
}

.yt-hero {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.48fr);
  gap: 18px;
  padding: clamp(22px, 4vw, 34px);
  background:
    linear-gradient(135deg, rgba(255, 0, 55, 0.24), rgba(15, 23, 42, 0.82) 48%, rgba(30, 64, 175, 0.64)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.055) 0 2px, transparent 2px 12px);
}

.yt-chip,
.yt-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  font-size: 0.78rem;
  font-weight: 900;
  padding: 7px 12px;
}

.yt-hero h1 {
  margin: 12px 0 8px;
  color: #fff;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.05;
}

.yt-hero p,
.yt-section-head p,
#resultMeta {
  color: var(--muted);
  line-height: 1.7;
  margin: 0;
}

.yt-note {
  align-self: stretch;
  display: flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 18px;
  padding: 18px;
  color: #e2e8f0;
  background: rgba(2, 6, 23, 0.42);
  line-height: 1.65;
  font-weight: 700;
}

.yt-panel,
.yt-state-panel,
.yt-results {
  margin-top: 16px;
  padding: 20px;
  background: color-mix(in srgb, var(--panel) 91%, transparent);
}

.yt-section-head h2,
.yt-results-head h2 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: clamp(1.35rem, 3vw, 1.8rem);
}

.yt-default-report {
  margin-top: 8px !important;
  color: #d1fae5 !important;
  font-weight: 850;
}

.yt-form {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(220px, 1.25fr) minmax(160px, 0.72fr) minmax(130px, 0.5fr) minmax(180px, 0.82fr) auto;
  gap: 12px;
  align-items: end;
}

.yt-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.yt-form select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0 13px;
  background: color-mix(in srgb, var(--panel-2) 88%, #020617 12%);
  color: var(--text);
  font: inherit;
  font-weight: 750;
}

.yt-primary-btn,
.yt-secondary-btn {
  border: 1px solid transparent;
  border-radius: 14px;
  min-height: 44px;
  padding: 0 16px;
  color: #f8fafc;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, border-color 0.18s ease;
}

.yt-primary-btn {
  min-height: 48px;
  background: linear-gradient(135deg, #ef233c, #2563eb);
}

.yt-secondary-btn {
  background: rgba(148, 163, 184, 0.1);
  border-color: var(--border);
}

.yt-primary-btn:hover,
.yt-secondary-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(126, 240, 204, 0.34);
}

.yt-primary-btn:disabled,
.yt-secondary-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.yt-state-panel {
  color: var(--muted);
  line-height: 1.7;
}

.yt-fallback-note {
  margin-top: 16px;
  border: 1px solid rgba(126, 240, 204, 0.32);
  border-radius: 15px;
  padding: 12px 14px;
  background: rgba(34, 197, 94, 0.1);
  color: #d1fae5;
  font-weight: 800;
  line-height: 1.55;
}

.yt-fallback-note.is-fallback {
  border-color: rgba(251, 191, 36, 0.48);
  background: rgba(251, 191, 36, 0.13);
  color: #fde68a;
}

.yt-state-panel strong {
  display: block;
  color: var(--text);
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.yt-state-panel span {
  display: block;
}

.yt-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.yt-quick-btn {
  border: 1px solid rgba(126, 240, 204, 0.34);
  border-radius: 999px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(239, 35, 60, 0.18), rgba(37, 99, 235, 0.22));
  color: #f8fafc;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.yt-quick-btn:hover {
  border-color: rgba(126, 240, 204, 0.62);
}

.yt-results-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.yt-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.yt-summary-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.yt-summary-card {
  min-height: 112px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.015)),
    rgba(15, 23, 42, 0.54);
  overflow: hidden;
}

.yt-summary-card small {
  display: block;
  color: var(--muted);
  font-weight: 850;
  margin-bottom: 8px;
}

.yt-summary-card strong {
  display: block;
  color: #fff;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.yt-col-selector {
  display: flex;
  align-items: center;
  gap: 4px;
}

.yt-col-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--muted);
  margin-right: 4px;
  white-space: nowrap;
}

.yt-col-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(148, 163, 184, 0.08);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
  padding: 0;
}

.yt-col-btn:hover {
  border-color: rgba(126, 240, 204, 0.42);
  color: var(--text);
}

.yt-col-btn.active {
  border-color: rgba(126, 240, 204, 0.65);
  background: linear-gradient(135deg, rgba(239, 35, 60, 0.18), rgba(37, 99, 235, 0.22));
  color: #e2f0ff;
}


.yt-card-grid {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.yt-card-grid.yt-cols-1 { grid-template-columns: minmax(0, 1fr); }
.yt-card-grid.yt-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.yt-card-grid.yt-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.yt-card-grid.yt-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.yt-video-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel-2) 90%, transparent);
}

.yt-thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: rgba(2, 6, 23, 0.72);
}

.yt-thumb-wrap img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.yt-rank {
  position: absolute;
  left: 12px;
  top: 12px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.78);
  color: #fff;
  font-weight: 950;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.yt-video-body {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.yt-video-title {
  margin: 0;
  color: #f8fafc;
  font-size: 1.02rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.yt-video-meta,
.yt-metric-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.yt-metric {
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 5px 8px;
  background: rgba(148, 163, 184, 0.08);
  color: #dbeafe;
  font-weight: 800;
}

.yt-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.yt-open-link {
  color: #fff;
  text-decoration: none;
  font-weight: 900;
  border-radius: 12px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #ef233c, #2563eb);
}

@media (max-width: 1080px) {
  .yt-hero,
  .yt-form,
  .yt-results-head {
    grid-template-columns: 1fr;
  }

  .yt-results-head {
    display: grid;
  }

  .yt-actions {
    justify-content: flex-start;
  }

  .yt-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .yt-card-grid.yt-cols-3,
  .yt-card-grid.yt-cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .yt-summary-grid {
    grid-template-columns: 1fr;
  }

  .yt-card-grid.yt-cols-2,
  .yt-card-grid.yt-cols-3,
  .yt-card-grid.yt-cols-4 {
    grid-template-columns: minmax(0, 1fr);
  }

  .yt-actions,
  .yt-card-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .yt-col-selector {
    align-self: flex-start;
  }

  .yt-primary-btn,
  .yt-secondary-btn,
  .yt-open-link {
    width: 100%;
    text-align: center;
  }
}

/* ===== LIGHT MODE ===== */
body.light-theme.youtube-trends-page {
  background:
    radial-gradient(circle at top left, rgba(239, 35, 60, 0.06), transparent 32rem),
    radial-gradient(circle at 86% 8%, rgba(37, 99, 235, 0.05), transparent 30rem),
    var(--bg);
}

body.light-theme .yt-note {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(2, 6, 23, 0.26);
  color: #f1f5f9;
}

body.light-theme .yt-default-report {
  color: #166534 !important;
}

body.light-theme .yt-form select {
  background: #ffffff;
  border-color: rgba(143, 167, 201, 0.7);
  color: #102033;
}

body.light-theme .yt-summary-card {
  background: #ffffff;
  border-color: rgba(143, 167, 201, 0.5);
  box-shadow: 0 2px 10px rgba(15, 35, 65, 0.09);
}

body.light-theme .yt-summary-card small {
  color: #53677f;
}

body.light-theme .yt-summary-card strong {
  color: #102033;
}

body.light-theme .yt-video-card {
  background: #ffffff;
  border-color: rgba(143, 167, 201, 0.5);
}

body.light-theme .yt-video-title {
  color: #102033;
}

body.light-theme .yt-video-meta,
body.light-theme .yt-metric-row {
  color: #53677f;
}

body.light-theme .yt-metric {
  background: rgba(37, 99, 235, 0.07);
  border-color: rgba(143, 167, 201, 0.55);
  color: #1e3a5f;
}

body.light-theme .yt-thumb-wrap {
  background: #e8f0fb;
}

body.light-theme .yt-fallback-note {
  border-color: rgba(22, 163, 74, 0.45);
  background: rgba(220, 252, 231, 0.92);
  color: #14532d;
}

body.light-theme .yt-fallback-note.is-fallback {
  border-color: rgba(217, 119, 6, 0.45);
  background: rgba(254, 243, 199, 0.96);
  color: #78350f;
}

body.light-theme .yt-secondary-btn {
  background: rgba(15, 35, 65, 0.06);
  border-color: rgba(143, 167, 201, 0.6);
  color: #102033;
}

body.light-theme .yt-quick-btn {
  background: linear-gradient(135deg, rgba(239, 35, 60, 0.07), rgba(37, 99, 235, 0.09));
  border-color: rgba(37, 99, 235, 0.32);
  color: #102033;
}

body.light-theme .yt-state-panel {
  color: #334155;
}

body.light-theme .yt-state-panel strong {
  color: #102033;
}

body.light-theme .yt-col-btn {
  background: rgba(15, 35, 65, 0.05);
  border-color: rgba(143, 167, 201, 0.55);
  color: #53677f;
}

body.light-theme .yt-col-btn:hover {
  border-color: rgba(37, 99, 235, 0.45);
  color: #1e3a5f;
}

body.light-theme .yt-col-btn.active {
  border-color: rgba(37, 99, 235, 0.6);
  background: linear-gradient(135deg, rgba(239, 35, 60, 0.08), rgba(37, 99, 235, 0.12));
  color: #1e3a5f;
}

body.light-theme .yt-shorts-hint {
  color: #53677f;
}
