/* ============================================================
   JONHFLIX — EPG (GUIA ELETRÔNICO DE PROGRAMAÇÃO)
   Estilos elegantes para o guia de programação, barra no card e player
   ============================================================ */

/* ------------------------------------------------------------
   1. INFORMAÇÕES EPG DENTRO DOS CARDS DE CANAIS
   ------------------------------------------------------------ */
.tv-card {
    position: relative;
    overflow: hidden;
}

.tv-card-epg {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 10px 10px;
    background: linear-gradient(180deg, rgba(10, 10, 15, 0) 0%, rgba(10, 10, 15, 0.92) 35%, rgba(10, 10, 15, 0.98) 100%);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 3;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tv-card-epg-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    gap: 5px;
}

.tv-card-epg-live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ff334b;
    box-shadow: 0 0 6px #ff334b;
    flex-shrink: 0;
    animation: epgPulse 2s infinite ease-in-out;
}

@keyframes epgPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

.tv-card-epg-times {
    font-size: 0.68rem;
    color: #a0a5b5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tv-card-epg-track {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 2px;
}

.tv-card-epg-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff416c, #ff4b2b);
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* ------------------------------------------------------------
   OVERLAY DE PROGRAMAÇÃO NO PLAYER AO VIVO
   ------------------------------------------------------------ */
.player-live-epg-overlay {
    position: absolute;
    bottom: 80px;
    left: 24px;
    max-width: 440px;
    background: rgba(14, 15, 22, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 14px 18px;
    color: #ffffff;
    z-index: 9999;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.player-live-epg-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.6px;
    color: #ff334b;
    background: rgba(255, 51, 75, 0.12);
    border: 1px solid rgba(255, 51, 75, 0.3);
    border-radius: 4px;
    padding: 2px 6px;
    margin-bottom: 6px;
}

.player-live-epg-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.3;
}

.player-live-epg-sub {
    font-size: 0.78rem;
    color: #a0a6b8;
    margin-top: 3px;
    font-weight: 500;
}

.player-live-epg-desc {
    font-size: 0.78rem;
    color: #c0c5d6;
    margin-top: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ------------------------------------------------------------
   2. BOTÃO DO GUIA DE PROGRAMAÇÃO NO TOPO DA TV
   ------------------------------------------------------------ */
.btn-guia-epg {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 20px;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(10px);
}

.btn-guia-epg:hover {
    background: rgba(255, 65, 108, 0.2);
    border-color: rgba(255, 65, 108, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(255, 65, 108, 0.25);
}

.btn-guia-epg svg {
    width: 16px;
    height: 16px;
    color: #ff416c;
}

/* ------------------------------------------------------------
   3. MODAL COMPLETO DO GUIA DE PROGRAMAÇÃO (TIMELINE / GRADE)
   ------------------------------------------------------------ */
.epg-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(5, 5, 10, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.epg-modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.epg-modal-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
    color: #f0f2f7;
    font-family: inherit;
}

/* Cabeçalho do Guia */
.epg-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    background: rgba(18, 18, 24, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    gap: 16px;
    flex-shrink: 0;
}

.epg-modal-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.epg-modal-title-group h2 {
    font-size: 1.3rem;
    font-weight: 800;
    margin: 0;
    background: linear-gradient(90deg, #ffffff, #a2b4d6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.epg-modal-badge {
    background: rgba(255, 65, 108, 0.15);
    color: #ff4b6b;
    border: 1px solid rgba(255, 65, 108, 0.3);
    border-radius: 12px;
    padding: 3px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.epg-modal-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.epg-search-input {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 8px 14px;
    color: #ffffff;
    font-size: 0.85rem;
    outline: none;
    min-width: 220px;
    transition: all 0.2s ease;
}

.epg-search-input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: #ff416c;
    box-shadow: 0 0 0 2px rgba(255, 65, 108, 0.2);
}

.epg-btn-agora {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    padding: 8px 14px;
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.epg-btn-agora:hover {
    background: rgba(255, 255, 255, 0.16);
}

.epg-btn-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.epg-btn-close:hover {
    background: rgba(255, 65, 108, 0.3);
    border-color: #ff416c;
}

/* Área rolável do Guia (Grid 2D) */
.epg-grid-scroll {
    flex: 1;
    overflow: auto;
    position: relative;
    background: #0c0d12;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.epg-grid-scroll::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.epg-grid-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* Tabela EPG */
.epg-table {
    display: flex;
    flex-direction: column;
    min-width: max-content;
    position: relative;
}

/* Régua de Horários no topo (Sticky) */
.epg-ruler-row {
    display: flex;
    position: sticky;
    top: 0;
    background: #14151e;
    z-index: 10;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    height: 44px;
}

.epg-ruler-corner {
    position: sticky;
    left: 0;
    width: 220px;
    min-width: 220px;
    background: #181924;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 12;
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #8f96a8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.epg-ruler-slots {
    display: flex;
    position: relative;
}

.epg-ruler-slot {
    display: flex;
    align-items: center;
    padding-left: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #8c93a8;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    box-sizing: border-box;
}

/* Linha vermelha "Agora" */
.epg-now-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ff334b;
    z-index: 8;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(255, 51, 75, 0.8);
}

.epg-now-line::before {
    content: '';
    position: absolute;
    top: 0;
    left: -4px;
    width: 10px;
    height: 10px;
    background: #ff334b;
    border-radius: 50%;
    box-shadow: 0 0 8px #ff334b;
}

/* Fileira de cada Canal */
.epg-channel-row {
    display: flex;
    min-height: 62px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.15s ease;
}

.epg-channel-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Coluna do Canal (Sticky à esquerda) */
.epg-channel-col {
    position: sticky;
    left: 0;
    width: 220px;
    min-width: 220px;
    background: #101118;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 14px;
    cursor: pointer;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.3);
}

.epg-channel-col:hover {
    background: #161822;
}

.epg-channel-logo {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    object-fit: contain;
    flex-shrink: 0;
}

.epg-channel-logo-empty {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: #ff416c;
    flex-shrink: 0;
}

.epg-channel-info {
    overflow: hidden;
}

.epg-channel-name {
    font-size: 0.84rem;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.epg-channel-cat {
    font-size: 0.68rem;
    color: #7b8296;
}

/* Faixa de Programas do Canal */
.epg-programs-track {
    display: flex;
    position: relative;
    align-items: center;
    padding: 6px 0;
}

.epg-program-block {
    position: absolute;
    height: 50px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 6px 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.15s ease;
    box-sizing: border-box;
}

.epg-program-block:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
    z-index: 4;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.epg-program-block.no-ar {
    background: rgba(255, 65, 108, 0.12);
    border-color: rgba(255, 65, 108, 0.4);
}

.epg-program-block.no-ar:hover {
    background: rgba(255, 65, 108, 0.22);
    border-color: #ff416c;
}

.epg-program-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.epg-program-time {
    font-size: 0.68rem;
    color: #8c93a8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.epg-program-block.no-ar .epg-program-time {
    color: #ff6b87;
    font-weight: 600;
}

/* ------------------------------------------------------------
   4. MODAL DETALHE DO PROGRAMA AO CLICAR NA GRADE
   ------------------------------------------------------------ */
.epg-detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.epg-detail-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.epg-detail-card {
    background: #171822;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    max-width: 520px;
    width: 100%;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
    transform: scale(0.95);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.epg-detail-overlay.open .epg-detail-card {
    transform: scale(1);
}

.epg-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.epg-detail-channel-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.08);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #ffffff;
}

.epg-detail-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.3;
    margin: 4px 0 0;
}

.epg-detail-schedule {
    font-size: 0.82rem;
    color: #ff6b87;
    font-weight: 600;
}

.epg-detail-synopsis {
    font-size: 0.88rem;
    color: #c2c7d6;
    line-height: 1.55;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 6px;
}

.epg-detail-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 6px;
}

.epg-btn-watch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #ff416c, #ff4b2b);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    padding: 10px 20px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.epg-btn-watch:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(255, 65, 108, 0.4);
}

.epg-btn-dismiss {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #ffffff;
    padding: 10px 16px;
    font-size: 0.85rem;
    cursor: pointer;
}

.epg-btn-dismiss:hover {
    background: rgba(255, 255, 255, 0.14);
}

/* Responsividade Mobile */
@media (max-width: 640px) {
    .epg-ruler-corner,
    .epg-channel-col {
        width: 140px;
        min-width: 140px;
        padding: 0 8px;
    }

    .epg-channel-name {
        font-size: 0.75rem;
    }

    .epg-search-input {
        min-width: 130px;
        font-size: 0.78rem;
    }
}
