/* YouTube Intel module – same dark navy look as Nivix */

/* Hide sidebar on YouTube Intel page */
#yt-app .sidebar,
#yt-app .yt-intel-sidebar,
#yt-app .yt-sidebar-toggle {
  display: none !important;
}
#yt-app .main-container {
  margin-left: 0 !important;
  width: 100% !important;
}

.yt-intel-nav {
  display: flex;
  gap: 4px;
}
.yt-nav-item {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}
.yt-nav-item:hover {
  color: var(--text);
  background: var(--bg-elevated);
}
.yt-nav-item.active {
  color: var(--accent);
  background: var(--accent-glow);
}

.yt-range-pills {
  display: flex;
  gap: 6px;
}
.yt-pill {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
}
.yt-pill:hover {
  color: var(--text);
  border-color: var(--text-dim);
}
.yt-pill.active {
  background: var(--accent-glow);
  color: var(--accent);
  border-color: var(--accent);
}
.yt-sort-pill {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
}
.yt-sort-pill:hover {
  color: var(--text);
  border-color: var(--text-dim);
}
.yt-sort-pill.active {
  background: var(--accent-glow);
  color: var(--accent);
  border-color: var(--accent);
}

.yt-intel-main {
  position: relative;
  padding: 20px 24px 24px;
  padding-bottom: 52px;
  min-height: 100%;
  box-sizing: border-box;
}
.yt-demo-badge {
  position: absolute;
  top: 16px;
  right: 24px;
  font-size: 11px;
  padding: 4px 10px;
  background: var(--warning);
  color: var(--bg-dark);
  border-radius: 999px;
  font-weight: 600;
}
.yt-demo-badge.hidden {
  display: none;
}

/* Only the active tab’s content is visible; others are fully hidden (override #id rules) */
#yt-page-dashboard.yt-page:not(.active),
#yt-page-videos.yt-page:not(.active),
#yt-page-comments.yt-page:not(.active),
#yt-page-competitors.yt-page:not(.active),
#yt-page-ideas.yt-page:not(.active) {
  display: none !important;
}
.yt-page.active {
  display: block !important;
}
#yt-page-videos.yt-page.active {
  display: flex !important;
}
#yt-page-competitors.yt-page.active {
  display: flex !important;
}
.yt-page-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
}
.yt-channel-sub {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  margin: 4px 0 0 0;
}

.yt-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.yt-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.yt-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}
.yt-stat-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}
.yt-stat-delta {
  font-size: 12px;
  color: var(--success);
  margin-top: 2px;
}

.yt-dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.yt-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.yt-card-wide { }
.yt-card-full {
  margin-bottom: 0;
}
.yt-card-full .yt-table-wrap {
  max-height: 320px;
  overflow-y: auto;
}

/* Full-page Videos: use most of the viewport for the table */
#yt-page-videos {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#yt-page-videos .yt-videos-controls { flex-shrink: 0; }
#yt-page-videos .yt-card-full {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#yt-page-videos .yt-card-full .yt-table-wrap {
  max-height: none;
  flex: 1;
  min-height: 360px;
  overflow-y: auto;
}

/* Full-page Competitors: breakout list fills space */
#yt-page-competitors {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#yt-page-competitors .yt-competitors-add,
#yt-page-competitors #yt-competitor-card { flex-shrink: 0; }
#yt-page-competitors .yt-card-full:last-of-type {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#yt-page-competitors .yt-breakout-list {
  flex: 1;
  min-height: 280px;
  overflow-y: auto;
}
.yt-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}
.yt-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.yt-chart-placeholder {
  min-height: 240px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding-top: 20px;
}
.yt-chart-bar {
  flex: 1;
  min-width: 4px;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  opacity: 0.85;
}

.yt-top-videos-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.yt-top-video-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.yt-top-video-rank {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.yt-top-video-thumb {
  width: 80px;
  height: 45px;
  background: var(--bg-elevated);
  border-radius: 4px;
  flex-shrink: 0;
}
.yt-top-video-info {
  min-width: 0;
}
.yt-top-video-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.yt-top-video-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.yt-table-wrap {
  overflow-x: auto;
}
.yt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.yt-table th {
  text-align: left;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.yt-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.yt-table tr:hover td {
  background: var(--bg-elevated);
}
.yt-table .yt-cell-video {
  display: flex;
  align-items: center;
  gap: 12px;
}
.yt-table .yt-cell-thumb {
  width: 120px;
  height: 68px;
  background: var(--bg-elevated);
  border-radius: 4px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}
.yt-table .yt-cell-title {
  font-weight: 500;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.yt-perf-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.yt-perf-badge.positive { background: rgba(34, 197, 94, 0.2); color: var(--success); }
.yt-perf-badge.negative { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.yt-perf-badge.avg { background: rgba(245, 158, 11, 0.2); color: var(--warning); }

.yt-videos-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}
.yt-search-input {
  flex: 1;
  max-width: 320px;
  padding: 10px 14px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
}
.yt-select {
  padding: 10px 14px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
}

.yt-comments-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

/* Give each comment card its own accent so the section really pops */
#yt-page-comments .yt-comments-cards .yt-card:nth-child(1) {
  background:
    radial-gradient(circle at top left, rgba(248, 113, 113, 0.22), transparent 55%),
    var(--bg-card);
  border-color: rgba(248, 113, 113, 0.7);
}
#yt-page-comments .yt-comments-cards .yt-card:nth-child(1) h3 {
  color: rgb(252, 165, 165);
}

#yt-page-comments .yt-comments-cards .yt-card:nth-child(2) {
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.22), transparent 55%),
    var(--bg-card);
  border-color: rgba(59, 130, 246, 0.7);
}
#yt-page-comments .yt-comments-cards .yt-card:nth-child(2) h3 {
  color: rgb(147, 197, 253);
}

#yt-page-comments .yt-comments-cards .yt-card:nth-child(3) {
  background:
    radial-gradient(circle at top left, rgba(245, 158, 11, 0.22), transparent 55%),
    var(--bg-card);
  border-color: rgba(245, 158, 11, 0.7);
}
#yt-page-comments .yt-comments-cards .yt-card:nth-child(3) h3 {
  color: rgb(253, 230, 138);
}

.yt-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.yt-tag {
  padding: 6px 12px;
  font-size: 12px;
  background: rgba(248, 113, 113, 0.15);
  color: rgb(254, 202, 202);
  border: 1px solid rgba(248, 113, 113, 0.6);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}
.yt-tag:hover, .yt-tag.selected {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border-color: var(--danger);
}
.yt-list {
  list-style: none;
}
.yt-list li {
  padding: 8px 0;
  font-size: 13px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.yt-list li:last-child { border-bottom: none; }
.yt-list li::before {
  content: '?';
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--text-dim);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.yt-card:nth-child(3) .yt-list li::before { content: '!'; }

.yt-comments-list {
  max-height: 320px;
  overflow-y: auto;
}
.yt-comment-row {
  padding: 14px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  font-size: 13px;
}
.yt-comment-row:last-child { margin-bottom: 0; }
.yt-comment-user {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.yt-comment-snippet {
  color: var(--text-muted);
}

.yt-competitors-add {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.yt-input {
  flex: 1;
  max-width: 400px;
  padding: 10px 14px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
}

.yt-breakout-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.yt-breakout-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  border-radius: var(--radius-sm);
}
.yt-breakout-row:hover {
  background: var(--bg-elevated);
}
.yt-breakout-row:last-child { border-bottom: none; }
.yt-breakout-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.yt-breakout-thumb {
  width: 160px;
  height: 90px;
  background: var(--bg-elevated);
  border-radius: 6px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}
.yt-breakout-title { font-weight: 500; font-size: 14px; }
.yt-breakout-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.yt-breakout-mult {
  padding: 6px 12px;
  background: rgba(34, 197, 94, 0.25);
  color: var(--success);
  border-radius: var(--radius-sm);
  font-weight: 700;
  flex-shrink: 0;
  font-size: 14px;
}
.yt-competitor-list { list-style: none; padding: 0; margin: 0; }
.yt-competitor-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.yt-competitor-list li a { color: var(--accent); text-decoration: none; }
.yt-competitor-list li a:hover { text-decoration: underline; }
.yt-competitor-actions { display: flex; gap: 8px; flex-shrink: 0; margin-left: 12px; }

.yt-ideas-phase2-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.yt-trends-card .yt-card-sub,
.yt-demand-card .yt-card-sub { margin-bottom: 12px; }
.yt-trends-content,
.yt-demand-content { font-size: 13px; color: var(--text); }
.yt-trends-list > div { margin-bottom: 14px; }
.yt-trends-list > div:last-child { margin-bottom: 0; }
.yt-trends-list strong,
.yt-demand-content strong { display: block; margin-bottom: 6px; font-size: 12px; color: var(--text-muted); }
.yt-ideas-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.yt-ideas-tabs {
  display: flex;
  gap: 4px;
}
.yt-ideas-tab {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
}
.yt-ideas-tab:hover { color: var(--text); border-color: var(--text-dim); }
.yt-ideas-tab.active {
  background: var(--accent-glow);
  color: var(--accent);
  border-color: var(--accent);
}
.yt-ideas-filter { margin-left: auto; max-width: 180px; }
.yt-ideas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.yt-idea-card {
  position: relative;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.yt-idea-card:hover { border-color: var(--accent); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.yt-idea-card.yt-idea-high-viral { border-left: 4px solid var(--success); }
.yt-idea-card.yt-idea-high-value { border-left: 4px solid #3b82f6; }
.yt-idea-scores {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
}
.yt-idea-score {
  padding: 4px 10px;
  border-radius: 999px;
}
.yt-idea-score.viral-low { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.yt-idea-score.viral-mid { background: rgba(245, 158, 11, 0.25); color: #d97706; }
.yt-idea-score.viral-high { background: rgba(34, 197, 94, 0.25); color: var(--success); }
.yt-idea-score.value-low { background: rgba(100, 116, 139, 0.25); color: var(--text-dim); }
.yt-idea-score.value-mid { background: rgba(59, 130, 246, 0.2); color: #2563eb; }
.yt-idea-score.value-high { background: rgba(59, 130, 246, 0.25); color: #2563eb; }
.yt-idea-card-title {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.35;
  color: var(--text);
}
.yt-idea-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.yt-idea-meta span { display: flex; align-items: center; gap: 4px; }
.yt-idea-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.yt-idea-actions button,
.yt-idea-actions .yt-idea-btn {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}
.yt-idea-actions button:hover, .yt-idea-actions .yt-idea-btn:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}
.yt-idea-row {
  position: relative;
  padding: 16px 18px 16px 22px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.yt-idea-row.yt-idea-high-viral { border-left: 4px solid var(--success); }
.yt-idea-row.yt-idea-high-value { border-left: 4px solid #3b82f6; }
.yt-idea-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.yt-idea-source { font-size: 12px; color: var(--text-muted); }

/* Idea detail modal */
.yt-idea-modal-dialog {
  position: relative;
  width: min(560px, 92vw);
  max-height: 88vh;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: 0 25px 60px rgba(0,0,0,0.3);
  overflow: hidden;
  z-index: 81;
  display: flex;
  flex-direction: column;
}
.yt-idea-modal-content {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.yt-idea-modal-content h4 { margin: 16px 0 8px; font-size: 13px; color: var(--text-muted); }
.yt-idea-modal-content h4:first-child { margin-top: 0; }
.yt-idea-modal-content ul { margin: 0; padding-left: 20px; font-size: 13px; color: var(--text); }
.yt-idea-modal-content .yt-detail-keywords { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.yt-idea-modal-content .yt-detail-keywords span {
  padding: 4px 8px;
  background: var(--bg-elevated);
  border-radius: 999px;
  font-size: 11px;
  color: var(--text-muted);
}
.yt-idea-modal-actions { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.yt-refine-input,
.yt-schedule-input {
  display: block;
  width: 100%;
  max-width: 400px;
  margin: 8px 0 12px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
}
.yt-schedule-input { max-width: 200px; }
.yt-refine-btn,
.yt-schedule-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
}
.yt-refine-btn:hover,
.yt-schedule-btn:hover { opacity: 0.9; }
.yt-refine-btn:disabled,
.yt-schedule-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Inline video modal */
.yt-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
}
.yt-modal.hidden {
  display: none;
}
.yt-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
}
.yt-modal-dialog {
  position: relative;
  width: min(1400px, 94vw);
  height: min(788px, 85vh);
  max-height: 90vh;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  z-index: 81;
}
.yt-modal-body {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
}
.yt-modal-body iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}
.yt-modal-body .yt-video-open-link {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 83;
  font-size: 12px;
  padding: 6px 12px;
  background: rgba(15, 23, 42, 0.9);
  color: var(--accent);
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.yt-modal-body .yt-video-open-link:hover {
  background: rgba(30, 41, 59, 0.95);
}

/* Tracked Competitors popup */
.yt-tracked-modal-dialog {
  position: relative;
  width: min(420px, 92vw);
  max-height: 85vh;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  z-index: 81;
  display: flex;
  flex-direction: column;
}
.yt-tracked-modal-content {
  padding: 20px 24px 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.yt-tracked-modal-content h3 {
  margin-bottom: 8px;
  font-size: 16px;
}
.yt-tracked-modal-content .yt-competitor-list {
  max-height: 60vh;
  overflow-y: auto;
}
.yt-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 82;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, 0.88);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
}
.yt-modal-close:hover {
  background: rgba(15, 23, 42, 1);
}

.yt-refresh-wrap {
  position: fixed;
  bottom: 24px;
  left: 24px;
}
.yt-refresh-btn {
  padding: 10px 20px;
  font-size: 13px;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
}
.yt-refresh-btn:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}
.yt-refresh-btn.loading {
  opacity: 0.7;
  pointer-events: none;
}

@media (max-width: 900px) {
  .yt-stats-row { grid-template-columns: repeat(2, 1fr); }
  .yt-dashboard-grid { grid-template-columns: 1fr; }
  .yt-comments-cards { grid-template-columns: 1fr; }
}
