/* ============================================================
   RigarduMás — Guide TV v1.8.1
   Layout horizontal par tranches horaires (style Orange TV)
   ============================================================ */

:root {
  --rgd-bg:      #0a0a0a;
  --rgd-surface: #141414;
  --rgd-border:  #2a2a2a;
  --rgd-text:    #ffffff;
  --rgd-muted:   #888888;
  --rgd-accent:  var(--rgd-brand, #E8000D);
  --rgd-live:    var(--rgd-brand, #E8000D);
  --rgd-past:    0.4;
  --rgd-radius:  8px;
  --rgd-ch-w:    72px;
  --rgd-tv-text-sub: #aaa;
}

/* ── Wrapper ── */
.rgd-tv {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--rgd-text);
  background: var(--rgd-bg);
  min-height: 400px;
}

/* ── Navigation jours ── */
.rgd-tv__days {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 16px 8px;
  border-bottom: 1px solid var(--rgd-border);
}

.rgd-tv__day-btn {
  background: transparent;
  border: 1px solid var(--rgd-border);
  color: var(--rgd-muted);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.rgd-tv__day-btn:hover {
  border-color: var(--rgd-text);
  color: var(--rgd-text);
}
.rgd-tv__day-btn.is-active {
  background: var(--rgd-accent);
  border-color: var(--rgd-accent);
  color: #fff;
  font-weight: 600;
}

/* ── Navigation tranches horaires ── */
.rgd-tv__slots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--rgd-border);
}

.rgd-tv__slot-btn {
  background: transparent;
  border: 1px solid var(--rgd-border);
  color: var(--rgd-muted);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.rgd-tv__slot-btn:hover {
  border-color: var(--rgd-text);
  color: var(--rgd-text);
}
.rgd-tv__slot-btn.is-active {
  background: var(--rgd-surface);
  border-color: var(--rgd-accent);
  color: var(--rgd-text);
  font-weight: 700;
}

/* ── Zone contenu ── */
.rgd-tv__content {
  position: relative;
  min-height: 200px;
}

/* ── Loader ── */
.rgd-tv__loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.rgd-tv__loader[aria-hidden="true"] {
  display: none;
}
.rgd-tv__spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--rgd-border);
  border-top-color: var(--rgd-accent);
  border-radius: 50%;
  animation: rgd-spin .7s linear infinite;
}
@keyframes rgd-spin { to { transform: rotate(360deg); } }

/* ── Ligne chaîne : logo fixe + programmes scroll horizontal ── */
.rgd-tv__row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--rgd-border);
  min-height: 72px;
}
.rgd-tv__row:last-child { border-bottom: none; }

/* Logo chaîne — fixe à gauche */
.rgd-tv__row-channel {
  flex: 0 0 var(--rgd-ch-w);
  width: var(--rgd-ch-w);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  border-right: 1px solid var(--rgd-border);
  background: var(--rgd-bg);
  position: sticky;
  left: 0;
  z-index: 2;
}
.rgd-tv__row-channel a {
  display: flex;
  align-items: center;
  justify-content: center;
}
.rgd-tv__row-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 6px;
}
.rgd-tv__row-name {
  font-size: 10px;
  font-weight: 700;
  color: var(--rgd-muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .5px;
  line-height: 1.2;
  padding: 0 4px;
}

/* Zone programmes — scroll horizontal */
.rgd-tv__row-progs {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 0;
  align-items: stretch;
}
.rgd-tv__row-progs::-webkit-scrollbar { display: none; }

/* ── Programme ── */
.rgd-tv__prog {
  position: relative;
  flex: 0 0 auto;
  min-width: 160px;
  max-width: 220px;
  width: 180px;
  padding: 10px 14px;
  border-right: 1px solid var(--rgd-border);
  cursor: pointer;
  transition: background .15s;
  overflow: hidden;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.rgd-tv__prog:last-child { border-right: none; }
.rgd-tv__prog:hover { background: var(--rgd-surface); }
.rgd-tv__prog.is-past { opacity: var(--rgd-past); }
.rgd-tv__prog.is-live {
  background: rgba(var(--rgd-brand-rgb, 232, 0, 13), 0.06);
}
.rgd-tv__prog.is-live:hover {
  background: rgba(var(--rgd-brand-rgb, 232, 0, 13), 0.12);
}

/* Barre de progression */
.rgd-tv__prog-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--rgd-accent);
}

/* Inner */
.rgd-tv__prog-inner {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rgd-tv__prog-time {
  font-size: 11px;
  color: var(--rgd-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: 5px;
}

.rgd-tv__prog-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--rgd-text);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.35;
}

.rgd-tv__prog-cat {
  font-size: 11px;
  color: var(--rgd-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rgd-tv__prog-rating {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--rgd-accent);
  padding: 1px 5px;
  border-radius: 3px;
  align-self: flex-start;
}

/* Live dot */
.rgd-tv__live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--rgd-live);
  border-radius: 50%;
  animation: rgd-pulse 1.2s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes rgd-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .3; }
}

/* ── Overlay ── */
.rgd-tv__overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1000;
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity .25s ease;
}
.rgd-tv__overlay.is-open {
  display: block;
  opacity: 1;
}

/* ── Panel slide-in Pickx (repris de v1.7.2) ── */
.rgd-tv__panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 360px;
  max-width: 92vw;
  background: #111118;
  z-index: 1001;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
  box-shadow: -4px 0 32px rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
  padding-top: 84px;
}
.rgd-tv__panel.is-open {
  transform: translateX(0);
}

.rgd-tv__panel-close {
  position: sticky;
  top: 0;
  z-index: 2;
  align-self: flex-end;
  background: rgba(17,17,24,.85);
  border: none;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 10px 14px;
  line-height: 1;
  backdrop-filter: blur(4px);
}
.rgd-tv__panel-close:hover { color: var(--rgd-brand, #E8000D); }

.rgd-tv__panel-inner {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.rgd-tv__panel-image-wrap {
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #1a1a25;
  flex-shrink: 0;
}
.rgd-tv__panel-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rgd-tv__panel-body {
  padding: 16px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rgd-tv__panel-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: .72rem;
}
.rgd-tv__panel-cat {
  background: var(--rgd-brand, #E8000D);
  color: #fff;
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: .68rem;
}
.rgd-tv__panel-time {
  color: var(--rgd-tv-text-sub);
  font-size: .78rem;
}
.rgd-tv__panel-dur {
  color: var(--rgd-tv-text-sub);
  font-size: .72rem;
}

.rgd-tv__panel-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  margin: 4px 0 0;
}

.rgd-tv__panel-sub {
  font-size: .82rem;
  color: var(--rgd-brand, #E8000D);
  font-style: italic;
  margin: 0;
}

.rgd-tv__panel-desc {
  font-size: .82rem;
  color: var(--rgd-tv-text-sub);
  line-height: 1.55;
  margin: 0;
}

.rgd-tv__panel-channel {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.rgd-tv__panel-ch-logo {
  height: 24px;
  width: auto;
  max-width: 60px;
  object-fit: contain;
  background: #fff;
  border-radius: 3px;
  padding: 2px 4px;
  flex-shrink: 0;
}
.rgd-tv__panel-ch-name {
  font-size: .85rem;
  color: #fff;
  font-weight: 500;
}

.rgd-tv__panel-btn {
  display: inline-block;
  margin-top: 6px;
  background: var(--rgd-brand, #E8000D);
  color: #fff !important;
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 5px;
  font-weight: 600;
  font-size: .88rem;
  text-align: center;
  transition: background .2s;
  align-self: stretch;
}
.rgd-tv__panel-btn:hover { background: #b5000a; }

/* Curseur pointer */
.rgd-tv__prog { cursor: pointer; }

/* ── Responsive ── */
@media (max-width: 768px) {
  :root { --rgd-ch-w: 52px; }

  .rgd-tv__row-logo { width: 36px; height: 36px; }

  .rgd-tv__prog {
    min-width: 140px;
    width: 155px;
  }

  .rgd-tv__panel {
    width: 100vw;
    max-width: 100vw;
    padding-top: 65px;
  }

  /* Croix rouge fixe en bas à droite — toujours visible sur mobile */
  .rgd-tv__panel-close {
    position: fixed;
    bottom: 20px;
    right: 20px;
    top: auto;
    z-index: 100001;
    background: var(--rgd-brand, #E8000D);
    color: #fff;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,.5);
    border: 2px solid rgba(255,255,255,.2);
  }
  .rgd-tv__panel-close:hover { background: #b5000a; }
}

@media (max-width: 600px) {
  .rgd-tv__days,
  .rgd-tv__slots {
    padding: 10px 12px;
    gap: 6px;
  }
  .rgd-tv__day-btn,
  .rgd-tv__slot-btn {
    font-size: 12px;
    padding: 5px 10px;
  }
}
