/**
 * YouTube Subscription Archaeology — YouTube Dark Design System
 * ==============================================================
 * Authentic YouTube Dark UI, high-density layouts, and crisp typography.
 */

:root {
  --yt-bg-body: #0f0f0f;
  --yt-bg-surface: #0f0f0f;
  --yt-bg-elevated: #212121;
  --yt-bg-hover: #1f1f1f;
  --yt-bg-active: #272727;
  --yt-border: #272727;
  --yt-border-light: #3f3f3f;
  
  --yt-text-primary: #f1f1f1;
  --yt-text-secondary: #aaaaaa;
  --yt-text-muted: #717171;
  
  --yt-red: #ff0000;
  --yt-red-dark: #cc0000;
  --yt-blue: #3ea6ff;
  --yt-green: #2ba640;
  --yt-gold: #f59e0b;
  
  --yt-chip-bg: #272727;
  --yt-chip-hover: #3f3f3f;
  --yt-chip-active-bg: #f1f1f1;
  --yt-chip-active-text: #0f0f0f;
  
  --font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  --header-height: 56px;
  --sidebar-width: 240px;
}

/* ==========================================================================
   Base & Resets
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.yt-dark-body {
  background-color: var(--yt-bg-body);
  color: var(--yt-text-primary);
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

input, select, textarea {
  font-family: inherit;
  color: inherit;
}

/* Scrollbar fina estil YouTube */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #3f3f3f;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #717171;
}

/* ==========================================================================
   Top Header (56px)
   ========================================================================== */
.yt-header {
  position: sticky;
  top: 0;
  height: var(--header-height);
  background-color: var(--yt-bg-body);
  border-bottom: 1px solid var(--yt-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
}

.yt-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.yt-icon-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--yt-text-primary);
  transition: background 0.15s;
}

.yt-icon-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.yt-svg-icon {
  width: 24px;
  height: 24px;
}

.yt-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.yt-logo-badge {
  display: flex;
  align-items: center;
  justify-content: center;
}

.yt-play-icon {
  width: 32px;
  height: 24px;
}

.yt-brand-text {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.yt-brand-text .yt-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #fff;
}

.yt-brand-text .yt-badge-tag {
  font-size: 10px;
  font-weight: 700;
  background: #272727;
  color: var(--yt-text-secondary);
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
}

/* Barra de cerca central estil YouTube */
.yt-header-center {
  flex: 1;
  max-width: 600px;
  margin: 0 24px;
}

.yt-search-container {
  display: flex;
  align-items: center;
  width: 100%;
}

.yt-search-input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.yt-search-input {
  width: 100%;
  height: 40px;
  background-color: #121212;
  border: 1px solid #303030;
  border-right: none;
  border-radius: 40px 0 0 40px;
  padding: 0 36px 0 16px;
  color: var(--yt-text-primary);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.yt-search-input:focus {
  border-color: var(--yt-blue);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.yt-clear-btn {
  position: absolute;
  right: 12px;
  font-size: 18px;
  color: var(--yt-text-secondary);
  display: none;
}

.yt-clear-btn:hover {
  color: #fff;
}

.yt-search-btn {
  width: 64px;
  height: 40px;
  background-color: #222222;
  border: 1px solid #303030;
  border-radius: 0 40px 40px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--yt-text-secondary);
  transition: background 0.15s, color 0.15s;
}

.yt-search-btn:hover {
  background-color: #2a2a2a;
  color: #fff;
}

/* Header botons dreta */
.yt-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.yt-btn-header {
  height: 36px;
  padding: 0 14px;
  border-radius: 18px;
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--yt-text-primary);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}

.yt-btn-header:hover {
  background-color: rgba(255, 255, 255, 0.16);
}

.yt-btn-roulette {
  background-color: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.yt-btn-roulette:hover {
  background-color: rgba(245, 158, 11, 0.3);
}

/* ==========================================================================
   Two-Column App Layout (Sidebar + Main Content)
   ========================================================================== */
.yt-app-container {
  display: flex;
  min-height: calc(100vh - var(--header-height));
  position: relative;
}

/* ==========================================================================
   Sidebar Esquerra (240px Estil YouTube)
   ========================================================================== */
.yt-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background-color: var(--yt-bg-body);
  border-right: 1px solid var(--yt-border);
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  z-index: 50;
  transition: transform 0.2s ease, width 0.2s ease;
}

.yt-sidebar-scroll {
  padding: 12px 0 32px;
}

.yt-sidebar-section {
  padding: 4px 12px;
}

.yt-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--yt-text-secondary);
  padding: 8px 12px 6px;
}

.yt-sidebar-divider {
  height: 1px;
  background-color: var(--yt-border);
  margin: 8px 12px;
}

.yt-sidebar-nav {
  list-style: none;
}

.yt-nav-item {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  color: var(--yt-text-primary);
  font-size: 14px;
  font-weight: 400;
  transition: background 0.15s;
  position: relative;
}

.yt-nav-item:hover {
  background-color: var(--yt-bg-hover);
}

.yt-nav-item.active {
  background-color: var(--yt-bg-active);
  font-weight: 600;
}

.yt-nav-item .nav-icon {
  font-size: 16px;
  width: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.yt-nav-item .nav-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yt-nav-item .nav-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--yt-text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 6px;
  border-radius: 10px;
}

.yt-nav-item.active .nav-badge {
  color: var(--yt-text-primary);
  background: rgba(255, 255, 255, 0.12);
}

.badge-fav {
  color: var(--yt-gold) !important;
}

.badge-gem {
  color: var(--yt-green) !important;
}

.badge-sleeper {
  color: #a78bfa !important;
}

.badge-discarded {
  color: #ef4444 !important;
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */
.yt-main-content {
  flex: 1;
  min-width: 0;
  background-color: var(--yt-bg-body);
  padding: 0 24px 48px;
}

/* ==========================================================================
   Barra de Chips de Categories Estil YouTube (100% Navegable)
   ========================================================================== */
.yt-chips-container {
  position: sticky;
  top: var(--header-height);
  background-color: var(--yt-bg-body);
  z-index: 40;
  display: flex;
  align-items: center;
  padding: 12px 0 10px;
  border-bottom: 1px solid var(--yt-border);
  gap: 8px;
}

.yt-chips-carousel {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 2px 0;
  flex: 1;
}

.yt-chips-carousel::-webkit-scrollbar {
  display: none;
}

.yt-chip-arrow {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--yt-chip-bg);
  color: var(--yt-text-primary);
  font-size: 18px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.yt-chip-arrow:hover {
  background: var(--yt-chip-hover);
}

.yt-chip {
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  background-color: var(--yt-chip-bg);
  color: var(--yt-text-primary);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, color 0.15s;
}

.yt-chip:hover {
  background-color: var(--yt-chip-hover);
}

.yt-chip.active {
  background-color: var(--yt-chip-active-bg);
  color: var(--yt-chip-active-text);
  font-weight: 600;
}

.yt-chip .chip-count {
  font-size: 11px;
  opacity: 0.75;
}

/* ==========================================================================
   Barra de Controls del Feed (Capçalera + Ordenació)
   ========================================================================== */
.yt-feed-header-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 12px;
  border-bottom: 1px solid #1c1c1c;
  gap: 16px;
  flex-wrap: wrap;
}

.toolbar-category-label {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.yt-sort-dropdown-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.yt-sort-label {
  font-size: 13px;
  color: var(--yt-text-secondary);
}

.yt-sort-select {
  height: 34px;
  background-color: #212121;
  border: 1px solid var(--yt-border);
  border-radius: 6px;
  color: var(--yt-text-primary);
  font-size: 13px;
  padding: 0 10px;
  outline: none;
  cursor: pointer;
}

.yt-sort-select:focus {
  border-color: var(--yt-blue);
}

.yt-view-toggle-group {
  display: flex;
  background: #212121;
  border: 1px solid var(--yt-border);
  border-radius: 6px;
  overflow: hidden;
}

.yt-view-btn {
  width: 34px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--yt-text-secondary);
  transition: background 0.15s, color 0.15s;
}

.yt-view-btn:hover {
  color: #fff;
}

.yt-view-btn.active {
  background: #333;
  color: #fff;
  font-weight: bold;
}

/* Indicador de càrrega mínim estil YouTube */
.yt-loading-bar {
  height: 3px;
  width: 100%;
  background-color: transparent;
  overflow: hidden;
  position: relative;
  display: none;
}

.yt-loading-bar.htmx-request {
  display: block;
}

.yt-loading-progress {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--yt-red), transparent);
  animation: yt-indeterminate 1s infinite linear;
}

@keyframes yt-indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ==========================================================================
   Barra de Metadades de Resultats
   ========================================================================== */
.yt-results-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0 8px;
  font-size: 13px;
  color: var(--yt-text-secondary);
  gap: 12px;
  flex-wrap: wrap;
}

.yt-results-meta-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.yt-active-filter-chip {
  background: #272727;
  color: #fff;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.yt-chip-remove {
  font-size: 14px;
  font-weight: bold;
  color: var(--yt-text-secondary);
  line-height: 1;
}

.yt-chip-remove:hover {
  color: #fff;
}

/* ==========================================================================
   Channel Row Component (NÍTID, COMPACTE, ESTIL YOUTUBE)
   ========================================================================== */
.yt-channel-feed {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.yt-channel-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  border-bottom: 1px solid #1a1a1a;
  background-color: transparent;
  transition: background-color 0.12s;
  position: relative;
}

.yt-channel-row:hover {
  background-color: var(--yt-bg-hover);
}

/* Destaqui suau per a joies, preferits i descartats */
.yt-channel-row.row-gem {
  border-left: 3px solid var(--yt-green);
  background-color: rgba(43, 166, 64, 0.03);
}

.yt-channel-row.row-favorite {
  border-left: 3px solid var(--yt-gold);
}

.yt-channel-row.row-discarded {
  opacity: 0.5;
  filter: grayscale(0.5);
  border-left: 3px dashed #ef4444;
}

/* 1. Columna Avatar */
.yt-avatar-col {
  flex-shrink: 0;
  width: 68px;
  height: 68px;
}

.yt-avatar-link {
  display: block;
  width: 100%;
  height: 100%;
}

.yt-channel-avatar {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  object-fit: cover;
  background-color: #212121;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: block;
}

.yt-avatar-fallback {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #2a2a2a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 2. Columna Central d'Informació */
.yt-channel-info-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Fila 1: Títol + Estrella + Badges */
.yt-row-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.yt-channel-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--yt-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 480px;
}

.yt-channel-title:hover {
  color: var(--yt-blue);
}

.yt-fav-star {
  font-size: 17px;
  color: #555;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s, transform 0.1s;
}

.yt-fav-star:hover {
  color: var(--yt-gold);
  transform: scale(1.15);
}

.yt-fav-star.active {
  color: var(--yt-gold);
}

.yt-badge {
  font-size: 11px;
  font-weight: 500;
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
  line-height: 1.3;
}

.yt-badge-cluster {
  background-color: #242424;
  color: var(--yt-text-secondary);
  cursor: pointer;
  border: 1px solid #333;
}

.yt-badge-cluster:hover {
  background-color: #333;
  color: #fff;
}

.yt-badge-meta {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--yt-text-secondary);
}

.yt-badge-gem {
  background-color: rgba(43, 166, 64, 0.15);
  color: #34d399;
  font-weight: 600;
}

/* Fila 2: Mètriques Clau */
.yt-row-metrics-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--yt-text-secondary);
  flex-wrap: wrap;
}

.yt-handle {
  color: var(--yt-text-primary);
  font-weight: 500;
}

.yt-dot {
  color: #555;
  font-size: 10px;
}

.yt-metric-text strong {
  color: var(--yt-text-primary);
}

.yt-metric-views strong {
  color: #60a5fa;
}

/* Fila 3: Activitat i Últim Vídeo */
.yt-row-activity-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  flex-wrap: wrap;
}

.yt-activity-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
}

.yt-activity-badge.yt-active {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
}

.yt-activity-badge.yt-sleeper {
  background: rgba(167, 139, 250, 0.15);
  color: #c4b5fd;
}

.yt-last-video-title {
  color: var(--yt-text-secondary);
  max-width: 450px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-style: italic;
}

.yt-btn-play-mini {
  background: rgba(255, 0, 0, 0.15);
  color: #ff4d4d;
  border: 1px solid rgba(255, 0, 0, 0.3);
  border-radius: 12px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
  transition: background 0.15s;
}

.yt-btn-play-mini:hover {
  background: rgba(255, 0, 0, 0.28);
}

.yt-activity-untested {
  color: var(--yt-text-muted);
  font-size: 11px;
}

.yt-btn-check-mini {
  background: #272727;
  color: var(--yt-text-secondary);
  border: 1px solid #383838;
  border-radius: 12px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 500;
  transition: background 0.15s;
}

.yt-btn-check-mini:hover {
  background: #383838;
  color: #fff;
}

/* Fila 4: Descripció (1 línia tallada netament) */
.yt-row-desc {
  font-size: 12.5px;
  color: #909090;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  max-width: 750px;
}

/* Fila 5: Notes de l'usuari */
.yt-row-notes-preview {
  font-size: 12px;
  color: var(--yt-blue);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 600px;
}

.yt-row-notes-preview:hover {
  text-decoration: underline;
}

/* 3. Columna d'Accions a la Dreta */
.yt-channel-actions-col {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  margin-left: 12px;
}

.yt-status-wrapper {
  position: relative;
}

.yt-status-select {
  height: 30px;
  background-color: #212121;
  border: 1px solid #383838;
  border-radius: 15px;
  color: var(--yt-text-primary);
  font-size: 12px;
  padding: 0 10px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}

.yt-status-select:hover {
  border-color: #555;
}

.yt-status-select.status-gem {
  color: #34d399;
  border-color: rgba(43, 166, 64, 0.4);
}

.yt-status-select.status-reviewed {
  color: #60a5fa;
}

.yt-status-select.status-discarded {
  color: #f87171;
}

.yt-action-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.yt-action-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: 14px;
  font-size: 11.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.yt-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--yt-text-secondary);
}

.yt-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.yt-btn-youtube {
  background: rgba(255, 255, 255, 0.1);
  color: var(--yt-text-primary);
}

.yt-btn-youtube:hover {
  background: #fff;
  color: #0f0f0f;
}

/* ==========================================================================
   Format Graella Compacta (Mode opcional alternatiu)
   ========================================================================== */
.yt-channel-feed.view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  width: 100%;
}

.yt-channel-feed.view-grid .yt-channel-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 14px;
  background-color: #1a1a1a;
  border: 1px solid var(--yt-border);
  border-radius: 12px;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
  position: relative;
  transition: transform 0.15s, background-color 0.15s, border-color 0.15s;
}

.yt-channel-feed.view-grid .yt-channel-row:hover {
  background-color: #222222;
  border-color: #444444;
  transform: translateY(-2px);
}

.yt-channel-feed.view-grid .yt-channel-row.row-gem {
  border: 1px solid rgba(43, 166, 64, 0.5);
  box-shadow: 0 0 12px rgba(43, 166, 64, 0.1);
}

.yt-channel-feed.view-grid .yt-channel-row.row-favorite {
  border: 1px solid rgba(245, 158, 11, 0.5);
}

.yt-channel-feed.view-grid .yt-channel-row.row-discarded {
  border: 1px dashed #ef4444;
}

/* Estrella de favorit posicionada a la cantonada superior dreta de la targeta */
.yt-channel-feed.view-grid .yt-fav-star {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 18px;
  z-index: 2;
  padding: 4px;
}

/* 1. Avatar centrat a dalt */
.yt-channel-feed.view-grid .yt-avatar-col {
  width: 80px;
  height: 80px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.yt-channel-feed.view-grid .yt-channel-avatar,
.yt-channel-feed.view-grid .yt-avatar-fallback {
  width: 80px;
  height: 80px;
}

/* 2. Columna d'informació centrada i amb amplada restringida al 100% */
.yt-channel-feed.view-grid .yt-channel-info-col {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  overflow: hidden;
  gap: 6px;
}

/* Fila de títol en graella: Títol a dalt, centrat i truncat */
.yt-channel-feed.view-grid .yt-row-title-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.yt-channel-feed.view-grid .yt-channel-title {
  width: 100%;
  max-width: 100%;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.yt-channel-feed.view-grid .yt-badge-cluster {
  max-width: 190px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  vertical-align: middle;
  font-size: 11px;
}

.yt-channel-feed.view-grid .yt-badge-meta,
.yt-channel-feed.view-grid .yt-badge-gem {
  font-size: 10.5px;
  white-space: nowrap;
}

/* Fila de mètriques: Compacta i ajustada a la targeta */
.yt-channel-feed.view-grid .yt-row-metrics-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 3px 6px;
  width: 100%;
  max-width: 100%;
  font-size: 11.5px;
  color: var(--yt-text-secondary);
  line-height: 1.4;
  overflow: hidden;
}

.yt-channel-feed.view-grid .yt-handle {
  width: 100%;
  text-align: center;
  display: block;
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.yt-channel-feed.view-grid .yt-handle + .yt-dot {
  display: none;
}

.yt-channel-feed.view-grid .yt-metric-text {
  white-space: nowrap;
}

/* Ocultem views per vídeo a la graella per no saturar d'espai */
.yt-channel-feed.view-grid .yt-metric-views {
  display: none;
}

/* Fila d'activitat: només la píndola d'estat d'activitat */
.yt-channel-feed.view-grid .yt-row-activity-line {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

/* Ocultem el títol llarg de l'últim vídeo a la graella perquè no té espai horitzontal */
.yt-channel-feed.view-grid .yt-last-video-title {
  display: none;
}

/* Ocultem la descripció a la graella compacta (estil YouTube) */
.yt-channel-feed.view-grid .yt-row-desc {
  display: none;
}

/* Notes personals si n'hi ha */
.yt-channel-feed.view-grid .yt-row-notes-preview {
  width: 100%;
  max-width: 100%;
  text-align: center;
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 3. Columna d'accions a baix centrada */
.yt-channel-feed.view-grid .yt-channel-actions-col {
  width: 100%;
  max-width: 100%;
  align-items: center;
  margin-left: 0;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.yt-channel-feed.view-grid .yt-status-wrapper {
  width: 100%;
}

.yt-channel-feed.view-grid .yt-status-select {
  width: 100%;
  text-align: center;
  text-align-last: center;
  height: 32px;
}

.yt-channel-feed.view-grid .yt-action-buttons {
  width: 100%;
  display: flex;
  gap: 6px;
}

.yt-channel-feed.view-grid .yt-action-btn {
  flex: 1;
  text-align: center;
  height: 30px;
}

/* ==========================================================================
   Paginació YouTube
   ========================================================================== */
.yt-pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 32px;
  padding: 16px 0;
  border-top: 1px solid var(--yt-border);
}

.yt-page-btn {
  height: 38px;
  padding: 0 18px;
  border-radius: 19px;
  background-color: #272727;
  color: var(--yt-text-primary);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s;
}

.yt-page-btn:hover:not([disabled]) {
  background-color: #3f3f3f;
}

.yt-page-btn[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

.yt-page-info {
  font-size: 13px;
  color: var(--yt-text-secondary);
}

/* ==========================================================================
   Empty State
   ========================================================================== */
.yt-empty-feed {
  padding: 60px 20px;
  text-align: center;
}

.yt-empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.yt-empty-feed h3 {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 8px;
}

.yt-empty-feed p {
  color: var(--yt-text-secondary);
  margin-bottom: 16px;
}

.yt-btn-pill {
  height: 36px;
  padding: 0 16px;
  border-radius: 18px;
  font-size: 13.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.yt-btn-primary {
  background-color: #fff;
  color: #0f0f0f;
}

.yt-btn-primary:hover {
  background-color: #e5e5e5;
}

/* ==========================================================================
   Modals Estil YouTube
   ========================================================================== */
.yt-modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(5px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.yt-modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.yt-modal-dialog {
  background-color: #212121;
  border: 1px solid #333;
  border-radius: 12px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  animation: yt-modal-pop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes yt-modal-pop {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.yt-modal-sm { max-width: 440px; }
.yt-modal-md { max-width: 600px; }
.yt-modal-lg { max-width: 880px; }
.yt-modal-player { max-width: 900px; background-color: #000; }
.yt-modal-video {
  max-width: 940px;
  width: 92%;
  margin: auto;
  background-color: #111;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.95);
}

.yt-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #2e2e2e;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.yt-modal-title {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
}

.yt-modal-subtitle {
  font-size: 12.5px;
  color: var(--yt-text-secondary);
}

.yt-btn-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--yt-text-secondary);
}

.yt-btn-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.yt-modal-body {
  padding: 20px;
  overflow-y: auto;
}

.yt-modal-desc {
  font-size: 13.5px;
  color: var(--yt-text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
}

.yt-video-aspect-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
}

.yt-video-aspect-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* KPIs i Gràfics */
.yt-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.yt-kpi-item {
  background: #181818;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}

.yt-kpi-item .kpi-num {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  display: block;
}

.yt-kpi-item .kpi-lbl {
  font-size: 12px;
  color: var(--yt-text-secondary);
}

.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.chart-box {
  background: #181818;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  padding: 16px;
}

.chart-box h4 {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 12px;
}

.chart-canvas-wrapper {
  position: relative;
  height: 240px;
}

/* Ruleta Modal */
.roulette-filter-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.yt-btn-roulette-spin {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  font-weight: 700;
}

.yt-btn-roulette-spin:hover {
  filter: brightness(1.1);
}

.roulette-placeholder {
  color: var(--yt-text-secondary);
  text-align: center;
  padding: 30px;
}

.roulette-cards-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.roulette-item-card {
  background: #181818;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Formularis Modals */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--yt-text-secondary);
  margin-bottom: 6px;
}

.yt-textarea {
  width: 100%;
  background: #181818;
  border: 1px solid #383838;
  border-radius: 6px;
  padding: 8px 10px;
  color: #fff;
  font-size: 13px;
  resize: vertical;
  outline: none;
}

.modal-actions-right {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.file-dropzone {
  border: 2px dashed #3f3f3f;
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 14px;
  transition: border-color 0.15s;
}

.file-dropzone:hover {
  border-color: var(--yt-blue);
}

.dropzone-icon {
  font-size: 32px;
  display: block;
  margin-bottom: 8px;
}

.export-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.export-option-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #181818;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  color: var(--yt-text-primary);
  transition: background 0.15s, border-color 0.15s;
}

.export-option-link:hover {
  background: #252525;
  border-color: #444;
}

/* Toast */
.yt-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #282828;
  color: #fff;
  border: 1px solid #383838;
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  z-index: 300;
  display: none;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 960px) {
  .yt-sidebar {
    position: fixed;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.8);
  }

  .yt-sidebar.open {
    transform: translateX(0);
  }

  .charts-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .yt-channel-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .yt-channel-actions-col {
    align-items: flex-start;
    margin-left: 0;
    width: 100%;
  }

  .yt-status-select {
    width: 100%;
  }
}

/* ==========================================================================
   Fase 1: Escaneig d'Activitat i Canals Zombis
   ========================================================================== */

/* Botó Escanejar al Header */
.yt-btn-header.yt-btn-scan {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.2), rgba(249, 115, 22, 0.2));
  border: 1px solid rgba(234, 179, 8, 0.4);
  color: #fbbf24;
}

.yt-btn-header.yt-btn-scan:hover {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.35), rgba(249, 115, 22, 0.35));
  color: #fef08a;
  transform: translateY(-1px);
}

/* Badges de Zombie i Estat */
.badge-zombie {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #f87171 !important;
}

.yt-badge-zombie {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.yt-badge-dead {
  background: rgba(185, 28, 28, 0.35);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.yt-activity-badge.yt-cooling {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.yt-activity-badge.yt-badge-dead {
  background: rgba(220, 38, 38, 0.2);
  color: #f87171;
}

/* Botó directe de baixa / gestió de subscripció */
.yt-action-btn.yt-btn-sub-link {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.yt-action-btn.yt-btn-sub-link:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

/* Botó Descartar Zombis en Bloc */
.yt-btn-bulk-discard {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  margin-left: 12px;
  transition: background 0.15s, color 0.15s;
}

.yt-btn-bulk-discard:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #fff;
}

/* Modal Escaneig d'Activitat */
.yt-scan-status-card {
  background: #181818;
  border: 1px solid #282828;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
}

.scan-status-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.scan-badge {
  background: #2a2a2a;
  color: #aaa;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
}

.scan-badge.active {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.4);
  animation: pulseScan 1.5s infinite;
}

@keyframes pulseScan {
  0% { opacity: 0.8; }
  50% { opacity: 1; }
  100% { opacity: 0.8; }
}

.scan-channel-name {
  font-size: 13px;
  color: var(--yt-text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.yt-progress-container {
  width: 100%;
  height: 8px;
  background: #282828;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.yt-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #eab308, #f97316);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.scan-progress-numbers {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--yt-text-secondary);
  margin-bottom: 16px;
}

.yt-scan-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.scan-metric-box {
  background: #202020;
  border-radius: 6px;
  padding: 10px 8px;
  text-align: center;
}

.scan-metric-box .metric-val {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.scan-metric-box .metric-lbl {
  font-size: 11px;
  color: var(--yt-text-secondary);
  margin-top: 2px;
}

.yt-scan-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.yt-btn-modal-ghost {
  background: transparent;
  color: var(--yt-text-secondary);
  border: 1px solid #383838;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.yt-btn-modal-ghost:hover {
  background: #282828;
  color: #fff;
}

/* ==========================================================================
   NOVA ARQUITECTURA VISUAL: CAPÇALERA, FEED I SALA DE NETEJA
   ========================================================================== */

/* 1. Capçalera Superior Moderna */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 64px;
  background-color: rgba(15, 15, 15, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.topbar-left {
  display: flex;
  align-items: center;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.brand-logo-icon {
  font-size: 24px;
}

.brand-text-group {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #fff;
}

.brand-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #fbbf24;
}

/* Pestanyes Centrals */
.topbar-nav-tabs {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px;
  border-radius: 24px;
  gap: 4px;
}

.nav-tab-btn {
  background: transparent;
  border: none;
  color: var(--yt-text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.nav-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-tab-btn.active {
  background: #fff;
  color: #0f0f0f;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.tab-badge-counter {
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}

.tab-badge-counter.badge-gold {
  background: #f59e0b;
  color: #000;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-topbar-tool {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--yt-text-primary);
  border-radius: 18px;
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, transform 0.1s;
}

.btn-topbar-tool:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

/* OAuth Google / YouTube Controls a la Capçalera */
.btn-topbar-oauth {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  border-radius: 18px;
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-topbar-oauth:hover {
  background: rgba(239, 68, 68, 0.28);
  border-color: #ef4444;
  color: #fff;
  transform: translateY(-1px);
}

.oauth-status-badge {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
  border-radius: 18px;
  height: 36px;
  padding: 0 10px 0 12px;
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.oauth-dot {
  font-size: 10px;
}

.oauth-email {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-oauth-sync {
  background: transparent;
  border: none;
  color: #6ee7b7;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.btn-oauth-sync:hover {
  background: rgba(16, 185, 129, 0.2);
  transform: rotate(45deg);
}

.btn-oauth-sync.spinning {
  animation: spin 1s linear infinite;
  pointer-events: none;
}

.btn-oauth-logout {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.btn-oauth-logout:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Animació de targeta de vídeo en ser desubscrita via HTMX */
.yt-video-card.htmx-swapping {
  opacity: 0;
  transform: scale(0.92) translateY(8px);
  transition: all 0.25s ease-out;
}

/* 2. Contenidor de Vistes */
.app-main-viewport {
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px;
  min-height: calc(100vh - 64px);
}

.main-view-pane {
  display: none;
}

.main-view-pane.active {
  display: block;
}

/* 3. Subtoolbar del Feed (Carrusel de Categories estil YouTube Desktop) */
.feed-subnav-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  width: 100%;
  flex-wrap: wrap;
}

.categories-carousel-container {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  position: relative;
}

.carousel-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
  user-select: none;
}

.carousel-nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.06);
}

.carousel-nav-btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
  pointer-events: none;
}

.feed-category-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  flex-wrap: nowrap;
  padding: 4px 2px;
  scroll-behavior: smooth;
  width: 100%;
}

.feed-category-pills::-webkit-scrollbar {
  height: 3px;
}

.feed-category-pills::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.feed-category-pills.expanded {
  flex-wrap: wrap;
  overflow-x: visible;
}

.btn-toggle-wrap-pills {
  height: 30px;
  padding: 0 10px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--yt-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-toggle-wrap-pills:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.cat-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid transparent;
  color: var(--yt-text-primary);
  border-radius: 14px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.cat-pill:hover {
  background: rgba(255, 255, 255, 0.15);
}

.cat-pill.active {
  background: #fff;
  color: #0f0f0f;
  font-weight: 600;
}

.feed-right-options {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.gems-toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 5px 12px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: #fbbf24;
  user-select: none;
  white-space: nowrap;
}

.gems-toggle-label input {
  display: none;
}

.gems-toggle-label input:checked + .toggle-custom-box {
  transform: scale(1.15);
}

/* 4. Graella del Feed de Vídeos (Alta Densitat: 4-5 columnes a Desktop) */
.yt-feed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 20px 14px;
  width: 100%;
  margin-bottom: 32px;
}

.yt-video-card {
  display: flex;
  flex-direction: column;
  background: transparent;
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.15s ease;
}

.yt-video-card:hover {
  transform: translateY(-2px);
}

.video-thumb-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
}

.video-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.yt-video-card:hover .video-thumb-img {
  transform: scale(1.02);
}

.video-badge-time {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
  z-index: 2;
}

.video-play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}

.yt-video-card:hover .video-play-overlay {
  opacity: 1;
}

.play-circle {
  width: 40px;
  height: 40px;
  background: rgba(255, 0, 0, 0.9);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  padding-left: 2px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

/* Botons flotants d'acció sobre la miniatura en hover */
.video-hover-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.18s ease;
  z-index: 5;
}

.yt-video-card:hover .video-hover-actions {
  opacity: 1;
}

.btn-hover-action {
  background: rgba(15, 15, 15, 0.85);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.btn-hover-action:hover {
  background: rgba(255, 255, 255, 0.95);
  color: #000;
}

.btn-hover-fav.active {
  color: #f59e0b;
  border-color: #f59e0b;
  background: rgba(0, 0, 0, 0.9);
}

.btn-hover-unsub {
  background: rgba(239, 68, 68, 0.85);
  border-color: rgba(239, 68, 68, 0.9);
  color: #fff;
}

.btn-hover-unsub:hover {
  background: #ef4444;
  color: #fff;
}

/* Fila de Detalls compacta */
.video-details-row {
  display: flex;
  gap: 10px;
  padding: 10px 2px 2px 2px;
}

.channel-avatar-link {
  flex-shrink: 0;
}

.channel-mini-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.channel-avatar-fallback {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #282828;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-meta-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  flex: 1;
}

.video-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  line-height: 1.28;
  margin: 0;
  cursor: pointer;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-title:hover {
  color: #e5e5e5;
}

.video-channel-line {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--yt-text-secondary);
  margin-top: 1px;
}

.video-channel-line .channel-name {
  color: var(--yt-text-secondary);
  text-decoration: none;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-channel-line .channel-name:hover {
  color: #fff;
}

.meta-dot {
  color: #666;
  font-size: 9px;
}

.meta-time {
  color: var(--yt-text-secondary);
  white-space: nowrap;
}

.video-cluster-tag {
  font-size: 10.5px;
  color: #888;
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 6px;
  border-radius: 6px;
  align-self: flex-start;
  margin-top: 2px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
}

.btn-quick-fav {
  background: transparent;
  border: none;
  font-size: 16px;
  color: #666;
  cursor: pointer;
  transition: color 0.15s, transform 0.1s;
}

.btn-quick-fav:hover {
  color: #f59e0b;
  transform: scale(1.15);
}

.btn-quick-fav.active {
  color: #f59e0b;
}

.btn-quick-yt {
  font-size: 12px;
  color: var(--yt-text-secondary);
  text-decoration: none;
  padding: 3px 8px;
  border-radius: 4px;
}

.btn-quick-yt:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.btn-quick-unsub {
  font-size: 12px;
  color: #f87171;
  text-decoration: none;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-quick-unsub:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fff;
}

.feed-load-more-wrapper {
  display: flex;
  justify-content: center;
  margin: 32px 0 48px 0;
}

.btn-load-more {
  background: #272727;
  color: #fff;
  border: 1px solid #383838;
  font-size: 14px;
  font-weight: 500;
  padding: 12px 28px;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-load-more:hover {
  background: #3f3f3f;
}

/* 5. Sala de Neteja (Declutter Studio) */
.declutter-studio-view {
  max-width: 860px;
  margin: 0 auto;
}

.dc-cemetery-banner {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(185, 28, 28, 0.15));
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 14px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.cemetery-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.cemetery-icon {
  font-size: 36px;
}

.cemetery-text h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
  color: #fca5a5;
}

.cemetery-text p {
  margin: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.4;
}

.btn-discard-all-zombies {
  background: #ef4444;
  color: #fff;
  border: none;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
}

.btn-discard-all-zombies:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.dc-kpi-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.dc-kpi-pill {
  background: #181818;
  border: 1px solid #282828;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dc-kpi-pill .lbl {
  color: var(--yt-text-secondary);
}

.dc-kpi-pill .val {
  font-weight: 700;
  color: #fff;
}

.dc-kpi-pill.session-pill {
  margin-left: auto;
  border-color: rgba(234, 179, 8, 0.4);
}

.dc-kpi-pill .val.highlight {
  color: #fbbf24;
}

.dc-swipe-section {
  background: #141414;
  border: 1px solid #242424;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
}

.dc-swipe-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  border-bottom: 1px solid #222;
  padding-bottom: 14px;
}

.dc-section-tag {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #a855f7;
}

.dc-shortcuts-legend {
  font-size: 12px;
  color: var(--yt-text-secondary);
}

.dc-shortcuts-legend code {
  background: #252525;
  color: #fbbf24;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: inherit;
  font-weight: 700;
}

/* Targeta Individual de Triatge (Tinder Card) */
.declutter-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  transition: transform 0.25s, opacity 0.25s;
}

.declutter-card.swipe-anim-discard {
  transform: translateX(-60px) rotate(-4deg);
  opacity: 0.2;
}

.declutter-card.swipe-anim-keep {
  transform: translateX(60px) rotate(4deg);
  opacity: 0.2;
}

.declutter-card.swipe-anim-gem {
  transform: translateY(-50px) scale(1.05);
  opacity: 0.2;
}

.dc-header {
  display: flex;
  gap: 16px;
  align-items: center;
}

.dc-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.dc-avatar-fallback {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #282828;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dc-channel-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 6px 0;
}

.dc-channel-title a {
  color: #fff;
  text-decoration: none;
}

.dc-channel-title a:hover {
  text-decoration: underline;
}

.dc-meta-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dc-badge {
  font-size: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--yt-text-secondary);
  padding: 2px 10px;
  border-radius: 12px;
}

.dc-badge.dc-badge-cluster {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.dc-video-preview {
  background: #0a0a0a;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #202020;
}

.dc-video-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  cursor: pointer;
  overflow: hidden;
}

.dc-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dc-play-btn {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.dc-video-thumb:hover .dc-play-btn {
  opacity: 1;
  background: rgba(0, 0, 0, 0.2);
}

.dc-video-date {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.85);
  color: #fbbf24;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
}

.dc-video-info {
  padding: 12px 16px;
}

.dc-video-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--yt-text-secondary);
  font-weight: 600;
  margin-bottom: 2px;
}

.dc-video-title {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}

.dc-no-video {
  padding: 40px 20px;
  text-align: center;
  color: var(--yt-text-secondary);
}

.dc-no-video-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.dc-description {
  font-size: 14px;
  color: var(--yt-text-secondary);
  line-height: 1.5;
  margin: 0;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 16px;
  border-radius: 8px;
}

/* Botons d'Acció Gegants del Declutter */
.dc-action-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 8px;
}

.btn-dc-action {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px 8px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-dc-action .dc-key-hint {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.4);
  padding: 1px 5px;
  border-radius: 3px;
  color: #bbb;
}

.btn-dc-action .dc-btn-icon {
  font-size: 22px;
}

.btn-dc-action .dc-btn-text {
  font-size: 13px;
  font-weight: 600;
}

/* Discard (Vermell) */
.btn-dc-discard {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.btn-dc-discard:hover {
  background: rgba(239, 68, 68, 0.25);
  transform: translateY(-2px);
}

/* Skip (Gris) */
.btn-dc-skip {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--yt-text-secondary);
}

.btn-dc-skip:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transform: translateY(-2px);
}

/* Keep (Verd) */
.btn-dc-keep {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.btn-dc-keep:hover {
  background: rgba(16, 185, 129, 0.25);
  transform: translateY(-2px);
}

/* Gem (Or / Blau) */
.btn-dc-gem {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(59, 130, 246, 0.15));
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.btn-dc-gem:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(59, 130, 246, 0.3));
  transform: translateY(-2px);
}

/* 6. Explorador Simplificat */
.explorer-search-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.exp-input-wrapper {
  flex: 1;
  min-width: 280px;
}

.explorer-input {
  width: 100%;
  height: 44px;
  background: #181818;
  border: 1px solid #303030;
  border-radius: 22px;
  padding: 0 20px;
  font-size: 14px;
  color: #fff;
  outline: none;
  transition: border-color 0.15s;
}

.explorer-input:focus {
  border-color: #3b82f6;
}

.explorer-filter-selects {
  display: flex;
  gap: 8px;
}

.exp-select {
  height: 44px;
  background: #181818;
  border: 1px solid #303030;
  border-radius: 22px;
  padding: 0 16px;
  font-size: 13px;
  color: var(--yt-text-primary);
  outline: none;
  cursor: pointer;
}

.exp-select:focus {
  border-color: #3b82f6;
}

/* 7. Santuari de Perles */
.gems-header-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(168, 85, 247, 0.1));
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 24px;
}

.gems-header-banner h2 {
  margin: 0 0 6px 0;
  font-size: 20px;
  color: #fbbf24;
}

.gems-header-banner p {
  margin: 0;
  color: var(--yt-text-secondary);
  font-size: 14px;
}

/* Selector de Recomanació del Feed */
.feed-sort-wrapper {
  display: inline-flex;
  align-items: center;
  margin-right: 10px;
}

.cat-sort-select {
  height: 34px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 17px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cat-sort-select:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.cat-sort-select:focus {
  border-color: #3b82f6;
}

.cat-sort-select option {
  background: #181818;
  color: #fff;
}
