/* epg.css */
.epg-page-container {
    padding-top: 50px;
    min-height: 100vh;
    background-color: var(--bg-color);
}

.epg-header {
    padding: 25px 10% 0 10%;
    text-align: center;
}

.epg-header-content h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--text-color);
    text-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.epg-header-content p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}


/* Filtro de Categorias */
.categories-filter {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.cat-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.cat-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.cat-btn:hover:not(.active) {
    background: rgba(255,255,255,0.15);
    color: #ffffff;
}

.epg-list-section {
    padding: 1.6rem 10%;
}

.epg-list-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.epg-channel-row {
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    height: auto; /* Allow height to expand based on vertical content */
    transition: transform 0.2s, box-shadow 0.2s;
}

.epg-channel-row:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.2);
}

.epg-channel-info {
    width: 100%;
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 0.8rem 1rem;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-main);
    transition: background 0.3s ease;
}

.epg-channel-info:hover {
    background: rgba(255, 255, 255, 0.05);
}

.epg-channel-info img {
    width: 45px;
    height: 45px;
    object-fit: contain;
    border-radius: 8px;
    margin-right: 1rem;
    background: transparent;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.epg-channel-info:hover img {
    transform: scale(1.15) translateY(-3px);
}

.epg-channel-info span {
    color: var(--text-color);
    font-weight: 600;
    font-size: 1rem;
    text-align: left;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s;
}

.epg-channel-info:hover span {
    color: var(--primary);
}

.epg-programs-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 1rem;
}

/* Hide scrollbar for epg container */
.epg-programs-container::-webkit-scrollbar {
    height: 8px;
}
.epg-programs-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}
.epg-programs-container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.epg-program-card {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    border: 1px solid transparent;
    transition: background 0.2s, border-color 0.2s;
}

.epg-program-card:hover {
    background: rgba(255, 255, 255, 0.1);
}

.epg-program-card.active {
    background: rgba(var(--primary-color-rgb, 0, 123, 255), 0.15);
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(var(--primary-color-rgb, 0, 123, 255), 0.3);
}

.epg-program-title {
    font-size: 0.9rem;
    color: var(--text-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: center;
}

.epg-program-time {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: normal;
    margin-bottom: 0.8rem;
}

.epg-program-card.active .epg-program-time {
    color: var(--primary-color);
    font-weight: bold;
}

.epg-progress-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: auto;
    overflow: hidden;
}

.epg-progress-bar {
    height: 100%;
    background: var(--primary-color, #3b82f6);
    transition: width 1s linear;
}

.epg-status-msg {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
    padding: 1rem;
}

/* =================================================== */
/* SMART TV (960px) E TABLETS DEITADOS                 */
/* =================================================== */
@media (max-width: 1024px) and (orientation: landscape) {
    .epg-header {
        padding-left: 5% !important;
        padding-right: 5% !important;
    }
    .epg-list-section {
        padding-left: 5% !important;
        padding-right: 5% !important;
    }
    .epg-list-container {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 15px !important;
    }
}

@media (max-width: 768px) {
    .epg-header-content h1 {
        font-size: 1.55rem;
        line-height: 1.15;
        margin-bottom: 8px;
    }

    .epg-header {
        padding: 1.5rem 16px 0 16px;
    }

    .epg-list-section {
        padding: 1rem 16px;
    }

    .epg-list-container {
        grid-template-columns: 1fr;
    }

    .epg-channel-info {
        padding: 0.5rem 1rem;
    }
    
    .epg-channel-info img {
        width: 40px;
        height: 40px;
    }
    
    .epg-programs-container {
        padding: 0.8rem;
    }
    
    .epg-combined-card {
        padding: 0.8rem;
    }

    .epg-time-progress-wrapper {
        gap: 5px;
    }

    .epg-time-text {
        font-size: 0.75rem;
    }

    .epg-upcoming-time {
        min-width: 35px;
    }
    
    .categories-filter {
        gap: 9px;
        max-width: 350px;
        margin: 20px auto 0;
    }

    .cat-btn {
        min-width: 72px;
        padding: 8px 14px;
        font-size: 0.82rem;
    }
}

/* EPG Combined Card */
.epg-combined-card {
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.epg-current-program {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.8rem;
    margin-bottom: 0.8rem;
}

.epg-time-progress-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.epg-time-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: bold;
    white-space: nowrap;
}

.epg-time-progress-wrapper .epg-progress-container {
    margin-top: 0;
    flex: 1;
}

.epg-upcoming-programs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.epg-upcoming-item {
    display: flex;
    gap: 10px;
    align-items: center;
}

.epg-upcoming-time {
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: 600;
    min-width: 38px;
}

.epg-upcoming-title {
    font-size: 0.8rem;
    color: var(--text-color);
    display: -webkit-box;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Modal do Programa */
.program-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.program-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.program-modal-content {
    background: var(--card-bg, #1a1a1a);
    border: 1px solid var(--border-color, #333);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.program-modal-overlay.active .program-modal-content {
    transform: translateY(0);
}

.program-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.5);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    z-index: 10;
    transition: background 0.2s;
}

.program-modal-close:hover {
    background: var(--primary-color, #3b82f6);
}

.program-modal-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-bottom: 1px solid var(--border-color, #333);
}

.program-modal-body {
    padding: 1.5rem;
}

.program-modal-body h2 {
    color: var(--text-color, #fff);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.program-modal-time {
    color: var(--primary-color, #3b82f6);
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.program-modal-desc {
    color: var(--text-muted, #aaa);
    font-size: 1rem;
    line-height: 1.5;
}
