/*
 * ConnCast TV Guide Styles
 * Copyright (c) 2025 Paul Engrath
 * Author: Paul Engrath <pengrath@gmail.com>
 * All rights reserved.
 */

/* TV Guide Styles */
.tv-guide-container {
    display: flex;
    flex-direction: column;
    background-color: #1a1a1a;
    color: #fff;
    font-family: Arial, sans-serif;
    height: 100vh;
    position: relative;
}

/* Loading bar */
.loading-bar-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 2000;
}

/* Inline mode for loading bar (used inside .tv-guide) */
.loading-bar-container.inline {
    position: static;
    width: 60%;
    max-width: 600px;
    margin: 0 auto;
    z-index: auto;
}

.loading-bar-track {
    height: 4px;
    background: rgba(255, 255, 255, 0.12);
}

.loading-bar-progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4a9eff, #82c4ff);
    box-shadow: 0 0 8px rgba(74, 158, 255, 0.6);
    transition: width 250ms ease;
}

/* TV guide loading placeholder */
.tv-loading-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    min-height: 240px;
    padding: 24px 0;
}

.tv-loading-text {
    color: #bbb;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}

.advertisement-banner,
.feature-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 90px;
    background-color: #2a2a2a;
    border-top: 1px solid #444;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.advertisement-banner.clickable,
.feature-banner.is-link {
    cursor: pointer;
}

.advertisement-banner.clickable:hover,
.feature-banner.is-link:hover {
    background-color: #333;
}

.advertisement-content,
.feature-content {
    height: 100%;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.advertisement-image,
.feature-image {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.current-time {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #444;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
}

.current-time:hover {
    border-color: #4a9eff;
    box-shadow: 0 2px 8px rgba(74, 158, 255, 0.2);
}

.real-time {
    font-size: 1.2em;
    font-weight: bold;
    color: #888;
}

.manual-time {
    font-size: 1.2em;
    font-weight: bold;
    color: #4a9eff;
}

.time-selector-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.time-selector {
    background: #2a2a2a;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: auto;
}

.time-selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #444;
}

.time-selector-header h3 {
    margin: 0;
    color: #fff;
}

.close-button {
    background: none;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
    padding: 0 5px;
}

.close-button:hover {
    color: #fff;
}

.time-selector-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.current-time-button {
    background: linear-gradient(135deg, #4a9eff22 0%, #4a9eff44 100%);
    border: 1px solid #4a9eff;
    color: #4a9eff;
    padding: 12px;
    border-radius: 6px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
}

.current-time-button:hover {
    background: linear-gradient(135deg, #4a9eff44 0%, #4a9eff66 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(74, 158, 255, 0.2);
}

.time-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.time-option {
    background: #1a1a1a;
    border: 1px solid #444;
    color: #fff;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.time-option:hover {
    background: #333;
    border-color: #4a9eff;
}

.time-option.selected {
    background: #4a9eff22;
    border-color: #4a9eff;
    color: #4a9eff;
    font-weight: bold;
}

.tv-guide {
    flex: 1;
    overflow-x: auto;
    overflow-y: auto;
    position: relative;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.tv-guide::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

.tv-guide table {
    border-collapse: collapse;
    table-layout: fixed;
    margin: 0;
    border: none;
    min-width: 100%;
}

.tv-guide th,
.tv-guide td {
    border-left: none;
    padding: 10px;
    box-sizing: border-box;
    outline: none;
    transition: all 0.2s ease;
    max-width: 130px;
}

.tv-guide th.time-header-slot{
    padding:0px;
}

.tv-guide th.time-header-slot div.time-header-slot-content{
    border-right: 1px solid #333;
    border-bottom: 1px solid #333;
    padding: 10px;
}

.tv-guide td.focused {
    z-index: 1;
    position: relative;
}

.tv-guide td.selected::after {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    border-radius: 2px;
    pointer-events: none;
    animation: focusPulse 2s infinite;
}

@keyframes focusPulse {
    0% { box-shadow: 0 0 0 0 rgba(74, 158, 255, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(74, 158, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 158, 255, 0); }
}

.tv-guide {
    max-height: calc(100vh - 150px); /* Viewport height minus ad banner and some padding */
    overflow: auto;
}

.tv-guide table {
    border-collapse: collapse;
    width: max-content;
}

.tv-guide thead {
    position: sticky;
    top: 0;
    z-index: 3;
    background-color: #1a1a1a;
}

.tv-guide tbody {
    overflow-y: auto;
}

.tv-guide th {
    background-color: #2a2a2a;
    text-align: center;
    font-size: 0.9em;
    font-weight: normal;
    white-space: nowrap;
    transition: background-color 0.3s ease;
}

.tv-guide th.current {
    background-color: #4a9eff22;
    font-weight: bold;
    color: #4a9eff;
    position: relative;
}

.tv-guide th.current::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #4a9eff;
}

.channel-header {
    position: sticky;
    left: 0;
    z-index: 3;
    background-color: #2a2a2a !important;
    border-left: 2px solid #444;
    border-right:1px solid #444;
}

.tv-guide th.channel-header, .tv-guide td.channel-info {
    position: sticky;
    left: 0;
    background-color: #2a2a2a;
    z-index: 2;
    width: 180px;
    flex-direction: column;
    justify-content: center;
    border-right-color: #444 !important;
    border-right-style: solid !important;
    border-right-width: 1px !important;

}

.tv-guide th.channel-header, .tv-guide td.channel-info{
    padding: 0px;
}

.tv-guide th.channel-header .channel-info-content, .tv-guide td.channel-info .channel-info-content {
    padding: 10px;
    border-right: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.tv-guide th.channel-header .channel-info-content {
    border-bottom: 1px solid #333;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.background-music-player {
    display: flex;
    align-items: center;
}

.music-toggle-button {
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    padding: 0;
}

.music-toggle-button:hover {
    background: #3a3a3a;
    transform: scale(1.05);
}

.music-toggle-button:active {
    transform: scale(0.95);
}

.channel-details {
    display: flex;
    flex-direction: column;
}

.channel-number {
    font-size: 1.2em;
    font-weight: bold;
    color: #fff;
    text-align: left;
}

.channel-name {
    font-size: 0.9em;
    color: #ccc;
    margin-top: 4px;
}

.program-slot {
    background-color: #2d2d2d;
    transition: all 0.2s;
    vertical-align: top;
    height: 80px;
    position: relative;
    cursor: pointer;
    min-width: 150px;
    box-sizing: border-box;
    padding: 10px;
    border-right: 1px solid #333;
    border-bottom: 1px solid #333;
}

.program-content {
    height: 100%;
    overflow: hidden;
}

.program-title {
    font-weight: bold;
    margin-bottom: 5px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.program-description {
    font-size: 0.9em;
    color: #ccc;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.program-slot.selected {
    background-color: #3d3d3d;
    box-shadow: inset 0 0 0 2px #4a9eff;
    z-index: 1;
}

.brand-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    padding: 15px 40px;
    border-bottom: 2px solid #444;
}

.brand-left {
    text-align: left;
}

.brand-name {
    font-family: 'Arial Black', Arial, sans-serif;
    font-size: 2em;
    font-weight: 900;
    color: #4a9eff;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin: 0;
}

.brand-tagline {
    color: #ccc;
    font-size: 0.9em;
    margin-top: 5px;
}

.program-details {
    background-color: #2a2a2a;
    border-bottom: 2px solid #444;
    padding: 20px;
    min-height: 310px;
    max-height: 480px;
}

.program-details-content {
    display: flex;
    gap: 20px;
    width: 100%;
    align-items: stretch;
    flex-direction: row;
    justify-content: space-between;
    padding: 0 20px;
    position: relative;
    height: 100%;
    max-height: 268px;
}
.program-details-image {
    width: 300px;
    flex-shrink: 0;
    overflow: hidden;
    padding-right: 26px;
    border-right: 1px solid #333;
    height: 100%;
    min-height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.program-details-text {
    flex: 1;
    min-width: 0;
    border-right: 1px solid #333;
    padding: 0 26px;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 260px;
}

.program-details-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    max-width: 300px;
    height: auto;
    object-fit: contain;
    border-radius: 15px;
    transition: opacity 0.2s ease;
    cursor: pointer;
    display: block;
    margin: 0 auto;
}

.program-details-image img:hover {
    filter: brightness(1.2);
}

/* Lightbox styles */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    cursor: pointer;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    cursor: default;
}

.lightbox-image {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
    transition: background-color 0.2s ease, transform 0.2s ease;
    z-index: 10000;
}

.lightbox-close:hover {
    background-color: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

/* Responsive lightbox styles */
@media (max-width: 768px) {
    .lightbox-content {
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .lightbox-close {
        top: -10px;
        right: -10px;
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .lightbox-close {
        top: -8px;
        right: -8px;
        width: 30px;
        height: 30px;
        font-size: 18px;
    }
}

.program-details-title {
    font-size: 1.4em;
    font-weight: bold;
    margin: 0 0 15px 0;
    color: #fff;
}

.promotion-badge {
    background-color: #007bff;
    color: white;
    font-size: 0.7em;
    padding: 3px 8px;
    border-radius: 12px;
    margin-left: 10px;
    font-weight: normal;
    display: inline-block;
}

.program-details-placeholder {
    text-align: center;
    padding: 20px;
    color: #666;
}

.program-details-description {
    font-size: 1em;
    line-height: 1.5;
    color: #ccc;
    flex: 1;
    overflow: auto;
    padding-right: 10px;
    text-align: left;
    scrollbar-width: thin;
    scrollbar-color: #4a9eff #2a2a2a;
}

.program-details-description::-webkit-scrollbar {
    width: 6px;
}

.program-details-description::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 3px;
}

.program-details-description::-webkit-scrollbar-thumb {
    background-color: #4a9eff;
    border-radius: 3px;
    transition: background-color 0.3s ease;
}

.program-details-description::-webkit-scrollbar-thumb:hover {
    background-color: #5eaeff;
}

.program-details-description a {
    color: #4a9eff;
    text-decoration: none;
}

.program-details-description a:hover {
    text-decoration: underline;
}

/* Channel icon styles */
.channel-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    max-width: 60px;
}

.channel-info-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 170px;
    padding-left: 26px;
    margin-right: 20px;
}

.channel-icon-container {
    width: 150px;
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.channel-info-container .channel-details-icon {
    max-width: 130px;
    max-height: 130px;
    object-fit: contain;
}

.channel-info-content .channel-icon img{
    max-width: 60px;
    max-height: 60px;
    object-fit: contain;
    border-radius: 4px;
}

.channel-details {
    max-width: 90px;
    text-align: left;
}

.channel-description {
    font-size: 0.9em;
    color: #ccc;
    text-align: center;
    max-height: 126px;
    overflow: hidden;
    padding: 0 5px;
    display: -webkit-box;
    -webkit-line-clamp: 8;
    line-clamp: 8;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}

.program-title {
    font-weight: bold;
    margin: 8px 70px 5px 8px;
}

.program-description {
    font-size: 0.9em;
    color: #ccc;
    margin: 0 70px 8px 8px;
    max-height: 40px;
    overflow: hidden;
}

.program-slot.empty-slot {
    background-color: #222;
}

.program-slot:hover {
    background-color: #3d3d3d;
}

.program-title {
    font-weight: bold;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.program-description {
    font-size: 0.8em;
    color: #aaa;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.advertisement-banner,
.feature-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(42, 42, 42, 0.95);
    border-top: 2px solid #444;
    z-index: 1000;
    height: 90px;
}

.advertisement-content,
.feature-content {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.advertisement-image,
.feature-image {
    height: 90px;
    width: auto;
    object-fit: contain;
}

.advertisement-banner.clickable,
.feature-banner.is-link {
    cursor: pointer;
    transition: background-color 0.2s;
}

.advertisement-banner.clickable:hover,
.feature-banner.is-link:hover {
    background: rgba(52, 52, 52, 0.95);
}

@media (max-width: 1200px) {
    /* Make brand header vertically thinner */
    .brand-header {
        padding: 8px 20px;
    }
    
    .brand-name {
        font-size: 1.2em;
    }
    
    .brand-tagline {
        display: none;
    }
    
    /* Make header controls shorter/less tall */
    .current-time {
        padding: 4px 8px;
        font-size: 0.9em;
    }
    
    .real-time {
        font-size: 1em;
    }
    
    /* Make advertisement content vertically thinner */
    .advertisement-banner,
    .feature-banner {
        height: 60px;
    }
    
    .advertisement-content,
    .feature-content {
        height: 60px;
    }
    
    .music-toggle-button {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
    
    /* Hide channel info container */
    .program-details .channel-info-container {
        display: none;
    }

    .tv-guide{
        min-height: 300px;
    }

}

/* Mobile styles for 600px and below */
@media (max-width: 768px) {

    .program-details {
        height: 50%;
        padding: 15px;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .program-details-title {
        text-align: center;
        margin-bottom: 5px;
    }
    .program-details-description {
        text-align: center;
    }
    
    /* Make program-details-content and program-details-text 50% each */
    .program-details-content {
        flex-direction: column;
        gap: 15px;
        padding: 0 15px;
        max-height: none;
        flex: 1;
        overflow: hidden;
        display: flex;
    }
    
    .program-details-image {
        width: 100%;
        height: auto;
        min-height: auto;
        padding-right: 0;
        border-right: none;
        border-bottom: 1px solid #333;
        padding-bottom: 15px;
        justify-content: flex-start;
    }
    
    .program-details-image img {
        width: 100%;
        max-width: 260px;
        max-height: 260px;
        height: auto;
    }
    
    .program-details-text {
        width: 100%;
        border-right: none;
        padding: 0;
        min-height: auto;
        flex: 1;
        overflow: auto;
        display: flex;
        flex-direction: column;
    }
}