/* ====== Guía de TV (layout con panel lateral) ====== */
.view-guide{
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  background: var(--bg); color:#fff; font-family: sans-serif;
  --panel:#181628; --line:#2a2740; --focus-ring:#9c6bff;
  --modal-top: 22vh;
  overflow: hidden;        /* evita scroll del documento en TVs viejos */

}

/* Grid de 2 columnas: izquierda (aside) + derecha (main) */
.guide-layout{
  position: absolute; inset: 0;
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 100%;
  overflow: hidden;        /* asegura que sólo los hijos definidos scrolleen */

}

/* ===== LADO IZQUIERDO ===== */
.guide-aside{
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  background: color-mix(in oklab, var(--bg), #000 25%);
  border-right: 1px solid var(--line);
}

.backchip{
  display: flex; align-items: center; gap: 8px;
  background: transparent; border: 1px solid var(--line);
  color:#e8e6ff; padding: 8px 10px; border-radius: 10px;
  cursor: pointer;
}
.backchip img{ width:18px; height:18px; display:block; }
.backchip:focus-visible{ box-shadow: 0 0 0 3px var(--focus-ring); }

.guide-cats{
  flex: 1 1 auto; min-height: 0;
  display:flex; flex-direction: column; gap:6px;
  overflow-y: auto; padding-right: 2px;
}
.guide-cats::-webkit-scrollbar{ width:8px; }
.guide-cats::-webkit-scrollbar-thumb{ background:#4a4a6e; border-radius:4px; }
.cat-chip{
  width: 100%;
  text-align: left;
  background: var(--surface-2, #20232a);
  color: var(--text, #eee);
  border: 0; border-radius: 8px;
  padding: 8px 10px; font-size: .9rem;
  cursor: pointer;
}
.cat-chip:hover{ background: var(--surface-3, #2c3039); }
.cat-chip.is-active{ background: var(--card); color:#fff; font-weight:600; }
.cat-chip:focus-visible{ outline:2px solid var(--focus-ring); outline-offset:2px; }

.guide-main{
  display: grid;
  grid-template-rows: 56px 1fr;
  min-width: 0;
  min-height: 0;          
  overflow: hidden;       
}

.guide-header{
  display:flex; align-items:center; gap:.5rem;
  padding:.5rem; background: var(--card-2);
  border-bottom: 1px solid var(--line);
}
.guide-nav{
  background: transparent; border: 0; color:#cfcfff;
  font-size: 1.5rem; cursor: pointer; padding: 0 1rem; outline: none;
}
.guide-nav:disabled{ opacity:.3; cursor:not-allowed; }
.guide-nav:focus-visible{ box-shadow: 0 0 0 3px var(--focus-ring); border-radius: 10px; }
.guide-times{ flex:1; display:flex; justify-content:space-around; }
.guide-timecell{ flex:1; text-align:center; font-weight:600; color:#cfcfff; }

.guide-grid{
  min-height: 0;
  height: 100%;           
  overflow-y: auto;       
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.guide-grid::-webkit-scrollbar{ width:8px; }
.guide-grid::-webkit-scrollbar-track{ background:#000; }
.guide-grid::-webkit-scrollbar-thumb{ background:#0099ff; border-radius:4px; }

.guide-row{
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 12px;
  min-height: 70px;
  border-bottom: 1px solid var(--line);
}

.guide-channel{
  position: sticky; left: 0; z-index: 2;
  background: color-mix(in oklab, var(--bg), #000 20%);
  backdrop-filter: blur(6px);
  border-right: 1px solid var(--line);
  display:flex; align-items:center;
  padding: .25rem .5rem;
}
.guide-channel__wrap{ display:flex; align-items:center; gap:.5rem; }
.guide-channel__logo{ width:48px; height:32px; object-fit:contain; background:#333; border-radius:4px; }
.guide-channel__meta{ display:flex; flex-direction:column; font-size:.8rem; }
.guide-channel__name{ font-weight:600; color:#fff; }
.guide-channel__id{ font-size:.7rem; color:#aaa; }

.guide-track{
  display: grid;
  grid-auto-rows: 1fr;
  grid-auto-flow: column;
  min-width: 720px;
  padding: .25rem;
  background: var(--bg);
}

.guide-track {
  background-image: repeating-linear-gradient(
    to right,
    transparent,
    transparent calc(100% / (12 * 1)),
    rgba(255,255,255,0.06) calc(100% / (12 * 1)),
    rgba(255,255,255,0.06) calc(100% / (12 * 1))
  );
}

.guide-item{
  background: var(--tile, var(--card));
  color:#fff; border:0; border-radius:6px;
  padding:.25rem .5rem; font-size:.8rem; text-align:left;
  white-space: nowrap; overflow:hidden; text-overflow: ellipsis;
  cursor: pointer;
}
.guide-item:focus{ outline: 2px solid #ff00ff; outline-offset: 2px; }
.guide-item:disabled{ background:#222; color:#777; cursor:default; }
.guide-item__title{ font-weight:600; font-size:.85rem; }
.guide-item__time{ font-size:.7rem; color:#ddd; }

/* Estados */
.guide-item.is-live{
  outline: 2px solid var(--accent, #9c6bff);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent, #9c6bff), transparent 70%);
}
.guide-item.is-placeholder{ opacity:.9; font-style:italic; }

/* ===== Modal (igual que antes) ===== */
.pgm-modal.hidden{ display:none; }
.pgm-modal{
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: flex-start; justify-content: center; padding: 24px;
}
.pgm-modal__backdrop{ position:absolute; inset:0; background: rgba(0,0,0,.6); }
.pgm-modal__card{
  position: relative; z-index: 1;
  max-width: min(920px, 92vw);
  max-height: calc(100dvh - 48px);
  overflow: auto;
  border-radius: 16px;
  background: var(--panel-bg, #111);
  border: 1px solid #6e49c8;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
  padding: 20px; color:#fff;
  margin-top: var(--modal-top, 22vh);
}
.pgm-modal__close{ position:absolute; top:12px; right:12px; background: transparent; border: 0; color:#d6cfff; font-size:18px; cursor:pointer; outline:none; }
.pgm-modal .pgm-modal__close:focus-visible{ box-shadow: 0 0 0 3px var(--focus-ring); border-radius:10px; }
.pgm-modal__header{ display:grid; grid-template-columns:72px 1fr auto; gap:14px; align-items:center; margin-bottom:12px; }
.pgm-modal__logo{ width:72px; height:72px; object-fit:contain; background:#2b2942; border-radius:12px; }
.pgm-modal__titles{ display:flex; flex-direction:column; }
.pgm-modal__channel{ font-weight:800; font-size:22px; letter-spacing:.3px; }
.pgm-modal__id{ color:#bdb7ff; font-size:12px; margin-top:2px; }
.pgm-modal__live-badge{ background:#7a49c6; border:1px solid #9d79db; padding:6px 12px; border-radius:999px; font-size:12px; font-weight:800; }
.pgm-modal__meta{ display:grid; grid-template-columns:1fr auto; gap:8px; align-items:end; margin:8px 0 12px; border-top:1px solid #322b54; padding-top:12px; }
.pgm-modal__label{ color:#c6a3ff; font-size:12px; text-transform:uppercase; letter-spacing:.6px; }
.pgm-modal__title{ grid-column:1/2; font-size:18px; font-weight:700; }
.pgm-modal__time{ grid-column:2/2; font-size:14px; color:#cfcfff; text-align:right; }
.pgm-modal__desc{ background:#15132a; border:1px solid #2d2950; border-radius:12px; padding:12px; line-height:1.5; color:#e9e6ff; max-height:40vh; overflow:auto; }
.pgm-modal__actions{ display:flex; justify-content:center; margin-top:16px; }

.pgm-modal__cta{ background:#5b2aa7; border:1px solid #7a49c6; color:#fff; border-radius:12px; padding:10px 18px; font-weight:700; cursor:pointer; }
.pgm-modal [data-focusable]:not(.pgm-modal__cta):not(.pgm-modal__close):focus{
  outline: none !important;
}
.pgm-modal__cta:focus{ outline:none; box-shadow:0 0 0 2px var(--focus), 0 0 0 4px rgba(240,0,160,.35); }
