/* ============================================================================
   ChannelResults — feuille de style de la vue partagée d'affichage des chaînes.

   SOURCE UNIQUE : ~/Madame CLAUDE/shared/channel-results/channel-results.css
   Ne jamais modifier les copies déposées dans les projets : elles sont
   écrasées par ./sync.sh. Toute correction se fait ici.

   Entièrement autonome : toutes les valeurs sont définies sur .cr-root, donc
   la vue s'affiche à l'identique sur un site en CSS maison (About your
   Platform) comme sur un site en Tailwind (TheMarketplace.tv). Les classes
   sont toutes préfixées « cr- » pour ne heurter aucune classe de l'hôte.
   ========================================================================== */

.cr-root {
  /* Couleurs */
  --cr-primary: #6d28d9;
  --cr-primary-dark: #4c1d95;
  --cr-primary-soft: rgba(109, 40, 217, 0.12);
  --cr-text: #111827;
  --cr-text-muted: #6b7280;
  --cr-surface: #ffffff;
  --cr-surface-2: #f9fafb;
  --cr-surface-offset: #f3f4f6;
  --cr-border: #e5e7eb;
  --cr-divider: #eef0f3;
  --cr-success: #047857;
  --cr-success-soft: rgba(4, 120, 87, 0.12);
  --cr-warning: #b45309;
  --cr-warning-soft: rgba(245, 158, 11, 0.16);
  /* Espacements */
  --cr-1: 0.25rem;
  --cr-2: 0.5rem;
  --cr-3: 0.75rem;
  --cr-4: 1rem;
  --cr-5: 1.25rem;
  --cr-6: 1.5rem;
  --cr-8: 2rem;
  /* Rayons, ombres, tailles de texte */
  --cr-radius-sm: 6px;
  --cr-radius-md: 8px;
  --cr-radius-lg: 14px;
  --cr-radius-full: 999px;
  --cr-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --cr-text-xs: 0.75rem;
  --cr-text-sm: 0.875rem;
  --cr-text-base: 1rem;
  --cr-text-lg: 1.125rem;
  --cr-text-xl: 1.5rem;

  display: block;
  color: var(--cr-text);
  background: var(--cr-surface);
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius-lg);
  overflow: hidden;
  font-family: inherit;
  text-align: start;
}

.cr-root *,
.cr-root *::before,
.cr-root *::after { box-sizing: border-box; }

/* ---------- En-tête : titre + bascule tableau / visuel ---------- */
.cr-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--cr-4); flex-wrap: wrap;
  padding: var(--cr-5) var(--cr-6);
  border-bottom: 1px solid var(--cr-divider);
}
.cr-header-title { font-size: var(--cr-text-lg); font-weight: 700; margin: 0; line-height: 1.3; }
.cr-header-sub { font-size: var(--cr-text-xs); color: var(--cr-text-muted); margin-top: 0.2rem; }

.cr-view-toggle {
  display: flex; gap: 2px; padding: 3px; border-radius: var(--cr-radius-full);
  background: var(--cr-surface-2); border: 1px solid var(--cr-border); flex-shrink: 0;
}
.cr-view-btn {
  display: flex; align-items: center; gap: 6px; padding: 0.4rem 0.85rem;
  border-radius: var(--cr-radius-full); border: none; background: transparent;
  color: var(--cr-text-muted); font-size: var(--cr-text-xs); font-weight: 600;
  font-family: inherit; cursor: pointer; transition: background 0.15s, color 0.15s;
}
.cr-view-btn:hover { color: var(--cr-text); }
.cr-view-btn.is-active { background: var(--cr-surface); color: var(--cr-primary); box-shadow: var(--cr-shadow-sm); }

/* ---------- Tableau ---------- */
.cr-table-wrap { overflow-x: auto; }
.cr-table { width: 100%; border-collapse: collapse; font-size: var(--cr-text-sm); }
.cr-table th {
  text-align: start; font-size: var(--cr-text-xs); text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--cr-text-muted); padding: var(--cr-3) var(--cr-6); background: var(--cr-surface-2);
  font-weight: 600; white-space: nowrap;
}
.cr-table td { padding: var(--cr-3) var(--cr-6); border-top: 1px solid var(--cr-divider); vertical-align: middle; }
.cr-table tr:hover td { background: var(--cr-surface-2); }
.cr-name { font-weight: 600; }
.cr-sub { font-size: var(--cr-text-xs); color: var(--cr-text-muted); font-weight: 400; margin-top: 1px; }
.cr-empty { text-align: center; color: var(--cr-text-muted); padding: var(--cr-8); }

/* ---------- Logo de chaîne ---------- */
.cr-logo {
  width: 36px; height: 36px; border-radius: var(--cr-radius-md);
  object-fit: contain; background: var(--cr-surface-offset);
  border: 1px solid var(--cr-divider); display: block;
}
.cr-logo-fallback {
  width: 36px; height: 36px; border-radius: var(--cr-radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--cr-text-xs); font-weight: 700; color: #fff;
  border: 1px solid var(--cr-divider);
}

/* ---------- Icônes de ressources (description / showreel / deck) ---------- */
.cr-resources { display: flex; gap: 6px; align-items: center; }
.cr-res-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: var(--cr-radius-md);
  border: 1px solid var(--cr-border); background: var(--cr-surface);
  color: var(--cr-primary); cursor: pointer; text-decoration: none; padding: 0;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}
.cr-res-btn:hover { background: var(--cr-surface-offset); border-color: var(--cr-primary); transform: translateY(-1px); }
.cr-res-btn.is-off { color: var(--cr-text-muted); opacity: 0.32; cursor: default; pointer-events: none; }

/* ---------- Étiquettes et badges ---------- */
.cr-tag {
  display: inline-flex; padding: 0.2rem 0.55rem; border-radius: var(--cr-radius-full);
  font-size: var(--cr-text-xs); font-weight: 600;
  background: var(--cr-surface-offset); color: var(--cr-text-muted);
}
.cr-tag-FAST { background: var(--cr-primary-soft); color: var(--cr-primary); }
.cr-tag-PayTV { background: var(--cr-success-soft); color: var(--cr-success); }
.cr-tag-AVOD, .cr-tag-SVOD { background: var(--cr-warning-soft); color: var(--cr-warning); }
.cr-tag-muted { background: var(--cr-surface-2); color: var(--cr-text-muted); border: 1px dashed var(--cr-border); }
.cr-badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: var(--cr-radius-full); line-height: 1.6;
  background: var(--cr-warning-soft); color: var(--cr-warning);
  border: 1px solid rgba(245, 158, 11, 0.4);
}
.cr-na { color: var(--cr-text-muted); font-style: italic; font-size: var(--cr-text-xs); }

/* ---------- Cases à cocher ---------- */
.cr-check { width: 17px; height: 17px; accent-color: var(--cr-primary); cursor: pointer; margin: 0; }
.cr-check-ro { color: var(--cr-primary); font-weight: 700; }

/* ---------- Cartes visuelles ---------- */
.cr-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--cr-5); padding: var(--cr-6);
}
.cr-card {
  border: 1px solid var(--cr-border); border-radius: var(--cr-radius-lg); overflow: hidden;
  background: var(--cr-surface); display: flex; flex-direction: column;
}
.cr-card:has(.cr-check:checked) { border-color: var(--cr-primary); box-shadow: 0 0 0 2px var(--cr-primary-soft); }
.cr-card-banner {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--cr-primary) 0%, var(--cr-primary-dark) 100%);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.cr-card-banner img { width: 100%; height: 100%; object-fit: contain; background: var(--cr-surface-offset); }
.cr-card-banner-fallback {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: var(--cr-text-xl); font-weight: 700; color: #fff; letter-spacing: 0.02em;
}
.cr-card-badge {
  position: absolute; top: var(--cr-3); inset-inline-start: var(--cr-3);
  background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 10px; font-weight: 700;
  letter-spacing: 0.06em; padding: 0.25rem 0.6rem; border-radius: var(--cr-radius-sm);
}
.cr-card-select {
  position: absolute; top: 8px; inset-inline-end: 8px; z-index: 3;
  background: rgba(255, 255, 255, 0.92); border-radius: var(--cr-radius-sm);
  padding: 4px 6px; display: flex; cursor: pointer;
}
.cr-card-body { padding: var(--cr-4) var(--cr-5); display: flex; flex-direction: column; gap: var(--cr-3); flex: 1; }
.cr-card-title { font-size: var(--cr-text-base); font-weight: 700; line-height: 1.25; }
.cr-card-meta {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--cr-2) var(--cr-3);
  font-size: var(--cr-text-xs); margin: 0;
}
.cr-card-meta dt { color: var(--cr-text-muted); text-transform: uppercase; letter-spacing: 0.03em; font-size: 10px; }
.cr-card-meta dd { font-weight: 600; margin: 1px 0 0; }
.cr-card-desc {
  font-size: var(--cr-text-xs); color: var(--cr-text-muted); line-height: 1.5; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.cr-card-actions { display: flex; justify-content: flex-start; margin-top: auto; padding-top: var(--cr-2); }

/* ---------- Pagination ---------- */
.cr-more { display: flex; justify-content: center; padding: var(--cr-4); border-top: 1px solid var(--cr-divider); }
.cr-more-btn {
  padding: 0.55rem 1.1rem; border-radius: var(--cr-radius-md);
  border: 1px solid var(--cr-border); background: var(--cr-surface);
  color: var(--cr-text); font-size: var(--cr-text-sm); font-weight: 600;
  font-family: inherit; cursor: pointer;
}
.cr-more-btn:hover { background: var(--cr-surface-offset); border-color: var(--cr-primary); color: var(--cr-primary); }

/* ---------- Fiche description ---------- */
.cr-modal {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: var(--cr-4); background: rgba(17, 24, 39, 0.55);
}
.cr-modal-box {
  background: var(--cr-surface); color: var(--cr-text); border-radius: var(--cr-radius-lg);
  max-width: 560px; width: 100%; max-height: 80vh; overflow-y: auto;
  padding: var(--cr-6); box-shadow: 0 18px 48px rgba(16, 24, 40, 0.28);
}
.cr-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--cr-4); margin-bottom: var(--cr-4); }
.cr-modal-title { font-size: var(--cr-text-lg); font-weight: 700; margin: 0; }
.cr-modal-body { font-size: var(--cr-text-sm); color: var(--cr-text-muted); line-height: 1.6; white-space: pre-wrap; margin: 0; }
.cr-modal-close {
  border: 1px solid var(--cr-border); background: var(--cr-surface); color: var(--cr-text-muted);
  border-radius: var(--cr-radius-md); width: 30px; height: 30px; flex-shrink: 0;
  cursor: pointer; font-size: 18px; line-height: 1; font-family: inherit;
}
.cr-modal-close:hover { background: var(--cr-surface-offset); color: var(--cr-text); }

.cr-hidden { display: none !important; }

/* ---------- Écrans étroits ---------- */
@media (max-width: 640px) {
  .cr-header { padding: var(--cr-4); }
  .cr-table th, .cr-table td { padding: var(--cr-3) var(--cr-4); }
  .cr-cards { padding: var(--cr-4); gap: var(--cr-4); grid-template-columns: 1fr; }
}
