/* ============================================================
   Grade de programação (EPG)
   Canais nas linhas, tempo na horizontal, programa ao vivo em
   destaque. Layout por porcentagem: nada de grid com `gap` (não
   existe no Chromium 68) nem de sombra/filtro.
   ============================================================ */

.epg-screen {
    display: flex;
    flex-direction: column;
    padding: var(--safe-y) var(--safe-x);
    background: var(--bg-base);
}

.epg-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding-bottom: var(--gap-md);
}

.epg-header-copy .eyebrow {
    margin: 0 0 var(--gap-xs);
    color: var(--section-accent);
    font-size: var(--fs-tiny);
    font-weight: var(--fw-medium);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.epg-title {
    margin: 0;
    font-size: var(--fs-h1);
    font-weight: var(--fw-light);
    line-height: var(--lh-h1);
    letter-spacing: var(--tracking-h1);
}

.epg-clock {
    margin: 0 var(--gap-lg) 0 0;
    color: var(--text-secondary);
    font-size: var(--fs-small);
}

.epg-back {
    flex: 0 0 auto;
}

/* ── grade ─────────────────────────────────────────────────── */
.epg-grid {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-top: 1px solid var(--border-subtle);
}

.epg-head {
    display: flex;
    flex: 0 0 auto;
    height: calc(var(--unit) * 44);
    border-bottom: 1px solid var(--border-default);
}

.epg-corner {
    flex: 0 0 calc(var(--unit) * 300);
    display: flex;
    align-items: center;
    padding-left: var(--gap-sm);
    color: var(--text-tertiary);
    font-size: var(--fs-tiny);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* Régua de horários: posições em % dentro da janela de 3 h */
.epg-scale {
    position: relative;
    flex: 1 1 auto;
}

.epg-tick {
    position: absolute;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    padding-left: calc(var(--unit) * 8);
    border-left: 1px solid var(--border-subtle);
    color: var(--text-tertiary);
    font-size: var(--fs-tiny);
    white-space: nowrap;
}

/* ── linha de canal ────────────────────────────────────────── */
.epg-row {
    display: flex;
    flex: 1 1 0;
    align-items: stretch;
    min-height: 0;
    padding: 0;
    border: 0;
    border-bottom: 1px solid var(--border-subtle);
    border-radius: 0;
    background: transparent;
    color: var(--text-primary);
    text-align: left;
}

.epg-row:focus,
.epg-row.focus {
    background: var(--bg-hover);
    box-shadow: inset var(--focus-ring) 0 0 var(--section-accent);
}

.epg-channel {
    flex: 0 0 calc(var(--unit) * 300);
    display: flex;
    align-items: center;
    min-width: 0;
    padding: 0 var(--gap-sm);
}

.epg-channel-number {
    flex: 0 0 auto;
    width: calc(var(--unit) * 44);
    color: var(--text-tertiary);
    font-size: var(--fs-tiny);
}

.epg-channel-name {
    overflow: hidden;
    font-size: var(--fs-small);
    font-weight: var(--fw-medium);
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* ── faixa de programas ────────────────────────────────────── */
.epg-track {
    position: relative;
    flex: 1 1 auto;
    margin: calc(var(--unit) * 8) 0;
    overflow: hidden;
}

.epg-block {
    position: absolute;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 calc(var(--unit) * 12);
    overflow: hidden;
    border-radius: calc(var(--unit) * 8);
    background: var(--bg-elevated);
    /* Sem margin: a largura já vem calculada em % */
}

/* O programa no ar ganha a cor da seção: é o que o olho procura */
.epg-block--live {
    background: var(--section-tint);
    box-shadow: inset 0 0 0 1px var(--section-accent);
}

.epg-block--gap,
.epg-block--empty {
    background: transparent;
    color: var(--text-tertiary);
    font-size: var(--fs-tiny);
}

.epg-block-title {
    overflow: hidden;
    font-size: var(--fs-small);
    line-height: 1.2;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.epg-block--live .epg-block-title {
    color: var(--section-accent);
    font-weight: var(--fw-medium);
}

.epg-block-time {
    margin-top: calc(var(--unit) * 4);
    color: var(--text-tertiary);
    font-size: var(--fs-tiny);
    line-height: 1;
}

.epg-empty {
    margin: var(--gap-lg) 0 0;
    color: var(--text-secondary);
    font-size: var(--fs-small);
}

.epg-keys {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    padding-top: var(--gap-sm);
}

html.no-flex-gap .epg-keys > * + * {
    margin-left: var(--gap-sm);
}

/* ============================================================
   Barra de progresso do programa no player
   Mesmo dado do EPG, agora visível: quanto falta para acabar.
   ============================================================ */
.player-epg-progress {
    display: block;
    width: calc(var(--unit) * 420);
    height: calc(var(--unit) * 4);
    margin-top: calc(var(--unit) * 8);
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
}

.player-epg-progress[hidden] {
    display: none;
}

.player-epg-progress-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--section-accent);
    transition: width 400ms linear;
}
