/* ═══════════════════════════════════════════════════════════════
   RayTV — EPG Grid Guide Styles
   Virtual-scroll grid: channel column + timeline
═══════════════════════════════════════════════════════════════ */

/* ── Guide layout ───────────────────────────────────────────── */
.guide-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg);
}

/* Date/time navigation bar */
.guide-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  flex: 0 0 40px;
}

.guide-nav-btn {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: var(--text-sm);
  font-family: var(--font);
  padding: 2px var(--sp-3);
  min-height: 28px;
  cursor: pointer;
  transition: background var(--t-fast);
}

.guide-nav-btn:hover,
.guide-nav-btn.rt-focused {
  background: var(--bg-4);
  color: var(--text);
  outline: var(--focus-ring);
  outline-offset: 2px;
  box-shadow: var(--focus-shadow);
}

.guide-date-label {
  flex: 1;
  text-align: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-med);
  color: var(--text);
}

.guide-jump-now {
  font-size: var(--text-xs);
  color: var(--accent);
  background: none;
  border: 1px solid var(--accent-dim);
  border-radius: var(--r-sm);
  padding: 2px var(--sp-2);
  cursor: pointer;
  font-family: var(--font);
  min-height: 24px;
}

.guide-jump-now:hover,
.guide-jump-now.rt-focused {
  background: var(--accent-dim);
  outline: var(--focus-ring);
  outline-offset: 2px;
}

/* ── Grid container ─────────────────────────────────────────── */
.guide-grid-wrap {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Sticky header row: channel-label corner + time slots */
.guide-header-row {
  display: flex;
  flex: 0 0 32px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 20;
}

.guide-corner {
  flex: 0 0 var(--guide-ch-w, 100px);
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-2);
}

.guide-corner-label {
  font-size: var(--text-xs);
  color: var(--text-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Scrollable time header */
.guide-time-header {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.guide-time-inner {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  display: flex;
  align-items: center;
  /* width set dynamically via JS: pxPerHour * totalHours */
}

.guide-time-slot {
  flex: 0 0 var(--guide-slot-w, 120px);
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 var(--sp-2);
  border-right: 1px solid var(--border);
  font-size: var(--text-xs);
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.guide-time-slot.current-slot {
  color: var(--accent);
  font-weight: var(--weight-bold);
}

/* Now-line indicator */
.guide-now-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
  z-index: 10;
  pointer-events: none;
}

.guide-now-line::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
}

/* ── Channel + program rows ─────────────────────────────────── */
.guide-rows-wrap {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
}

/* Sticky channel column */
.guide-ch-col {
  flex: 0 0 var(--guide-ch-w, 100px);
  overflow: hidden;
  border-right: 1px solid var(--border);
  position: relative;
  z-index: 15;
  background: var(--bg-2);
}

.guide-ch-inner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  /* height set via JS */
}

.guide-ch-cell {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-2);
  height: var(--guide-row-h, 52px);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--t-fast);
}

.guide-ch-cell:hover,
.guide-ch-cell.rt-focused {
  background: var(--bg-3);
}

.guide-ch-cell.rt-focused {
  outline: var(--focus-ring);
  outline-offset: -2px;
  box-shadow: var(--focus-shadow);
  z-index: 2;
  position: relative;
}

.guide-ch-logo {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  object-fit: contain;
  border-radius: var(--r-sm);
  background: var(--bg-3);
}

.guide-ch-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.guide-ch-name {
  font-size: 11px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

.guide-ch-num {
  font-size: 10px;
  color: var(--text-dim);
  display: block;
}

/* Program cells area */
.guide-prog-area {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.guide-prog-inner {
  position: absolute;
  top: 0;
  left: 0;
  /* width + height set via JS */
}

/* One row of program cells for a channel */
.guide-prog-row {
  position: absolute;
  left: 0;
  right: 0;
  height: var(--guide-row-h, 52px);
  display: flex;
  border-bottom: 1px solid var(--border);
}

/* Individual program cell */
.guide-prog-cell {
  position: absolute;
  top: 0;
  height: 100%;
  padding: 0 var(--sp-2);
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  border-right: 1px solid var(--border);
  background: var(--bg);
  transition: background var(--t-fast);
  box-sizing: border-box;
}

.guide-prog-cell:hover,
.guide-prog-cell.rt-focused {
  background: var(--bg-3);
  z-index: 5;
}

.guide-prog-cell.rt-focused {
  outline: var(--focus-ring);
  outline-offset: -2px;
  box-shadow: var(--focus-shadow);
}

/* Currently airing cell */
.guide-prog-cell.now-airing {
  background: rgba(229, 0, 0, 0.06);
  border-top: 2px solid var(--accent);
}

.guide-prog-cell.now-airing:hover,
.guide-prog-cell.now-airing.rt-focused {
  background: rgba(229, 0, 0, 0.14);
}

/* Past cell */
.guide-prog-cell.past {
  opacity: 0.5;
}

.guide-prog-title {
  font-size: 11px;
  font-weight: var(--weight-med);
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

.guide-prog-time {
  font-size: 10px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ── Program detail tooltip / popup ─────────────────────────── */
.guide-detail-popup {
  position: absolute;
  bottom: 8px;
  left: var(--guide-ch-w, 100px);
  right: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-4);
  z-index: 50;
  animation: popup-in var(--t-base) ease-out;
  box-shadow: 0 4px 24px rgba(0,0,0,0.8);
}

@keyframes popup-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.guide-detail-title {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--text);
  margin-bottom: var(--sp-1);
}

.guide-detail-time {
  font-size: var(--text-xs);
  color: var(--accent);
  margin-bottom: var(--sp-2);
  font-variant-numeric: tabular-nums;
}

.guide-detail-desc {
  font-size: var(--text-xs);
  color: var(--text-2);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.guide-detail-actions {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}
