/* TV Guide — matches reference design (black header, purple panel, green grid) */

.guide-page {
    --guide-header-bg: #000000;
    --guide-ticker-bg: #1a0033;
    --guide-accent-green: #1cde02;
    --guide-channel-bg: #4527a0;
    --guide-channel-gradient: linear-gradient(90deg, #1636a8 0%, #4527a0 100%);
    --guide-program-bg: #6d4fc4;
    --guide-shopping-bg: #3a2066;
    --guide-program-border: rgba(255, 255, 255, 0.7);
    --guide-weather-bg: #14521f;
    --guide-game-bg: #14521f;
    --guide-footer-bg: linear-gradient(90deg, rgba(42, 16, 85, 0.95) 0%, rgba(0, 0, 0, 0.95) 50%, rgba(42, 16, 85, 0.95) 100%);
    --guide-now-playing-height: 300px;
    --guide-now-playing-poster-col: 132px;
}

.guide-page .top-bar {
    background: var(--guide-header-bg);
    border: none;
    border-bottom: 1px solid rgba(99, 27, 168, 0.45);
    flex-shrink: 0;
}

.guide-page .top-bar .tv-header {
    background: var(--guide-header-bg);
    min-height: 72px;
}

.guide-page .date-display,
.guide-page .signal-text {
    font-family: 'Barlow', sans-serif;
    font-weight: 600;
    color: #fff;
    text-shadow: none;
}

.guide-page .guide-breadcrumb {
    background: var(--guide-ticker-bg);
    height: 28px;
    border: none;
    box-shadow: none;
}

.guide-page .guide-breadcrumb .ticker-viewport {
    height: 100%;
}

.guide-page .guide-breadcrumb .ticker-content {
    padding-left: 100%;
    animation: none;
}

@keyframes guide-scroll-ticker {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

.guide-page .guide-breadcrumb .ticker-item {
    font-family: 'Barlow', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: rgba(221, 208, 255, 0.82);
    text-shadow: none;
    filter: none;
    padding: 0;
}

.guide-page .guide-breadcrumb .ticker-sep {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: rgba(221, 208, 255, 0.45);
    padding: 0 14px;
    font-size: 12px;
    line-height: 1;
}

/* Now playing + preview row */
.guide-page.screen-content {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.crt-screen:has(.guide-page) {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
}

.guide-page .info-section.nowplay-preview {
    height: var(--guide-now-playing-height);
    min-height: var(--guide-now-playing-height);
    max-height: var(--guide-now-playing-height);
    flex: 0 0 var(--guide-now-playing-height);
    align-items: stretch;
    background: linear-gradient(
        to right,
        rgb(72, 22, 118) 0%,
        rgb(52, 18, 92) 22%,
        rgb(28, 10, 48) 38%,
        rgb(12, 4, 20) 46%,
        #000000 52%,
        #000000 100%
    );
    border: none;
    overflow: hidden;
}

.guide-page .info-section.nowplay-preview .info-box {
    padding: 20px 24px;
    border-right: none;
    background: transparent;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
    align-self: stretch;
}

.guide-page .info-section.nowplay-preview .commercial-box {
    flex: 1.1;
    background: #000;
    padding: 0;
    position: relative;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    align-self: stretch;
    box-sizing: border-box;
}

.guide-page .info-section.nowplay-preview .commercial-content,
.guide-page .info-section.nowplay-preview .commercial-video-frame,
.guide-page .info-section.nowplay-preview .weather-preview-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    aspect-ratio: auto;
    border: none;
    box-shadow: none;
    background: #000;
}

.guide-page .info-section.nowplay-preview .weather-preview-frame {
    background: linear-gradient(135deg, rgba(99, 27, 168, 0.95) 0%, rgba(245, 125, 13, 0.75) 100%);
}

.guide-page .weather-preview-title {
    font-family: 'Barlow', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #f9d326;
    margin-bottom: 10px;
}

.guide-page .info-section.nowplay-preview .commercial-video {
    object-fit: contain;
    background: #000;
}

.guide-page .info-title {
    font-family: 'Barlow', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.85);
    border-bottom: none;
    margin-bottom: 10px;
}

.guide-page .current-time {
    font-family: 'Barlow', sans-serif;
    font-size: 34px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.guide-page .timezone-info,
.guide-page .current-channel,
.guide-page .current-window,
.guide-page .program-description {
    font-family: 'Barlow', sans-serif;
    color: rgba(255, 255, 255, 0.88);
    text-shadow: none;
}

.guide-page .current-program {
    font-family: 'Barlow', sans-serif;
    font-size: 17px;
    font-weight: 700;
    text-transform: uppercase;
    color: #fff;
    margin-top: 4px;
}

.guide-page .program-poster-frame {
    background: transparent;
    border: none;
    padding: 0;
    width: var(--guide-now-playing-poster-col);
    min-width: var(--guide-now-playing-poster-col);
    max-width: var(--guide-now-playing-poster-col);
    height: 100%;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
}

.guide-page .program-poster-frame:not([hidden]) {
    visibility: visible;
}

.guide-page .program-poster-frame img {
    max-height: calc(var(--guide-now-playing-height) - 48px);
    max-width: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(99, 27, 168, 0.45));
}

/* Channel logos (SSN, Static Channel): larger, centered in info-box negative space */
.guide-page .info-body.has-channel-graphic {
    grid-template-columns: minmax(0, 1fr) minmax(180px, 1.45fr);
    gap: 10px;
}

.guide-page .info-body.has-channel-graphic .program-poster-frame.channel-graphic {
    width: 100%;
    min-width: 0;
    max-width: none;
    align-self: stretch;
}

.guide-page .info-body.has-channel-graphic .program-poster-frame.channel-graphic img {
    max-height: calc(var(--guide-now-playing-height) - 64px);
    max-width: min(300px, 100%);
    width: auto;
    height: auto;
    margin: 0 auto;
    filter: drop-shadow(0 0 16px rgba(99, 27, 168, 0.55));
}

.guide-page .info-body,
.guide-page .info-body.has-poster {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--guide-now-playing-poster-col);
    gap: 14px;
    align-items: stretch;
    width: 100%;
    height: calc(var(--guide-now-playing-height) - 56px);
    min-height: 0;
    overflow: hidden;
}

.guide-page .info-content {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.guide-page .current-program,
.guide-page #now-program {
    overflow: hidden;
}

.guide-page .current-program .program-title,
.guide-page #now-program {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.guide-page .program-description,
.guide-page #now-description {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.guide-page .current-channel,
.guide-page .current-window,
.guide-page #now-channel,
.guide-page #now-window {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Grid */
.guide-page .tv-guide-container {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.98) 0%, rgba(26, 0, 51, 0.95) 100%);
    border: none;
}

.guide-page .time-header {
    flex-shrink: 0;
}

/* Grid fills all the way to the footer; channel column stays locked
   while each row's programs strip scrolls horizontally behind it. */
.guide-page .channels-container {
    flex: 1 1 0;
    min-height: 0;
    height: 0;
    max-height: none !important;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 12px;
    scroll-padding-bottom: 12px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.guide-page .channels-container::-webkit-scrollbar {
    display: none;
}

/* The slot gridline overlay is anchored to the fixed row, so it would
   misalign with the scrolling timeline; program borders mark slots instead. */
.guide-page .channel-row::after {
    display: none;
}

.guide-page .channel-row {
    min-width: 0;
}

.guide-page .channel-row:last-child {
    margin-bottom: 0 !important;
}

.guide-page .programs-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    height: 100%;
    min-height: 0;
    align-self: stretch;
}

.guide-page .programs-scroll::-webkit-scrollbar {
    display: none;
}

.guide-page .time-track-wrapper {
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.guide-page .time-track-wrapper::-webkit-scrollbar {
    display: none;
}

.guide-page .time-header {
    background: rgba(26, 0, 51, 0.98);
}

.guide-page .time-header-inner {
    border-bottom: 1px solid rgba(99, 27, 168, 0.45);
}

.guide-page .time-label,
.guide-page .time-marker {
    font-family: 'Barlow', sans-serif;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.82);
    text-shadow: none;
}

.guide-page .time-label {
    border-right: 1px solid rgba(99, 27, 168, 0.45);
}

.guide-page .channel-row {
    background: transparent;
    border: none;
    margin-bottom: 6px;
    box-shadow: none;
    transform: none !important;
    align-items: stretch;
    height: var(--channel-row-height);
    min-height: var(--channel-row-height);
    max-height: var(--channel-row-height);
}

.guide-page .channel-row:hover,
.guide-page .channel-row.selected {
    transform: none !important;
    outline: none;
    box-shadow: none;
}

.guide-page .channel-info {
    background: var(--guide-channel-bg);
    border-right: 1px solid rgba(99, 27, 168, 0.55);
    height: 100%;
    align-self: stretch;
    box-sizing: border-box;
}

.guide-page .channel-number-badge {
    background: rgba(0, 0, 0, 0.22);
    border: none;
    border-right: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: none;
    width: 56px;
}

.guide-page .channel-number {
    font-family: 'Barlow', sans-serif;
    font-size: 18px;
    font-weight: 800;
    color: #b8a4e8;
    text-shadow: none;
}

.guide-page .channel-name,
.guide-page .channel-name-top,
.guide-page .channel-name-bottom {
    font-family: 'Barlow', sans-serif;
    font-weight: 700;
    color: #fff;
    text-shadow: none;
    text-transform: uppercase;
}

.guide-page .programs-row {
    background: #000;
    padding: 0;
    height: 100%;
    min-height: 100%;
    box-sizing: border-box;
}

.guide-page .program-block {
    top: 0;
    bottom: 0;
    box-sizing: border-box;
    background: var(--guide-program-bg) !important;
    border: 1px solid var(--guide-program-border) !important;
    box-shadow: none !important;
    transform: none !important;
    border-radius: 0;
}

.guide-page .program-block .program-title {
    font-family: 'Share Tech Mono', monospace;
    font-size: 15px;
    font-weight: 700;
    color: #fff !important;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.55);
    text-transform: uppercase;
}

.guide-page .program-block .program-time {
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    color: #fff !important;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.45);
}

.guide-page .program-block.now-playing {
    border: 1px solid var(--guide-accent-green) !important;
    background: #7a5cd6 !important;
}

.guide-page .program-block.weather-program {
    background: var(--guide-weather-bg) !important;
    border-color: rgba(28, 222, 2, 0.6) !important;
}

.guide-page .program-block.weather-program .program-title {
    color: #fff !important;
}

.guide-page .program-block.weather-program .program-time {
    color: #fff !important;
}

.guide-page .program-block.shopping-program {
    background: var(--guide-shopping-bg) !important;
}

.guide-page .program-block.static-program {
    background: var(--guide-game-bg) !important;
    border-color: rgba(28, 222, 2, 0.6) !important;
}

.guide-page .program-block.static-program .program-title,
.guide-page .program-block.static-program .program-time {
    color: #fff !important;
}

.guide-page .program-block .live-indicator {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 3;
    background: #d62828;
    color: #fff;
    padding: 1px 5px;
    font-family: 'Barlow', sans-serif;
    font-size: 9px;
    font-weight: 700;
    line-height: 1.2;
    border-radius: 2px;
    pointer-events: none;
    letter-spacing: 0.4px;
}

.guide-page .tv-guide-footer {
    flex-shrink: 0;
    margin-top: 0;
    background: var(--guide-footer-bg);
    border-top: 1px solid rgba(99, 27, 168, 0.45);
}

.guide-page .footer-copy,
.guide-page .footer-social,
.guide-page .footer-social a {
    font-family: 'Barlow', sans-serif;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.82);
    letter-spacing: 0.4px;
}

.guide-page .footer-social,
.guide-page .footer-social a {
    text-transform: uppercase;
}

.guide-page .footer-social a:hover {
    color: #fff;
}

/* Desktop — preserve original channel column + ticker (never apply mobile overrides) */
@media (min-width: 769px) {
    .guide-page .guide-breadcrumb {
        display: block;
    }

    .guide-page .channel-info {
        display: flex;
        flex-direction: row;
        align-items: stretch;
        justify-content: flex-start;
        background: var(--guide-channel-bg);
        padding: 0;
        height: 100%;
        min-height: 0;
        max-height: none;
    }

    .guide-page .channel-number-badge {
        display: flex;
        width: 56px;
        min-width: 56px;
        background: rgba(0, 0, 0, 0.22);
        border-right: 1px solid rgba(255, 255, 255, 0.18);
        padding: 0;
    }

    .guide-page .channel-number {
        font-size: 18px;
        color: #b8a4e8;
        letter-spacing: normal;
        text-transform: none;
    }

    .guide-page .channel-number::before {
        content: none;
    }

    .guide-page .channel-meta {
        flex: 1;
        padding: 8px 12px;
        text-align: left;
    }

    .guide-page .channel-name,
    .guide-page .channel-name-top,
    .guide-page .channel-name-bottom {
        font-size: inherit;
        letter-spacing: 0.6px;
        line-height: 1.1;
    }

    .guide-page .channel-row {
        display: grid;
        grid-template-columns: var(--channel-info-width) 1fr;
        align-items: stretch;
        height: var(--channel-row-height);
        min-height: var(--channel-row-height);
        max-height: var(--channel-row-height);
        margin-bottom: 6px;
    }

    .guide-page .info-section.nowplay-preview {
        height: var(--guide-now-playing-height);
        min-height: var(--guide-now-playing-height);
        max-height: var(--guide-now-playing-height);
        flex: 0 0 var(--guide-now-playing-height);
    }

    .guide-page .info-section.nowplay-preview .info-box,
    .guide-page .info-section.nowplay-preview .commercial-box {
        height: 100%;
        min-height: 0;
        max-height: none;
        overflow: hidden;
        align-self: stretch;
    }

    .guide-page .info-section.nowplay-preview .commercial-box {
        flex: 1.1;
    }
}

@media (max-width: 768px) {
    .guide-page {
        --channel-info-width: 88px;
        --channel-row-height: 56px;
        --guide-mobile-channel-bg: var(--guide-channel-bg);
        --guide-now-playing-height: 188px;
        --guide-now-playing-poster-col: 72px;
    }

    .guide-page .guide-breadcrumb {
        display: none;
    }

    .guide-page .info-section.nowplay-preview {
        flex-direction: column;
    }

    .guide-page .info-section.nowplay-preview .info-box {
        border-right: none;
        border-bottom: none;
        flex: 1 1 auto;
        padding: 10px 12px;
        width: 100%;
        height: 100%;
        box-sizing: border-box;
        align-self: stretch;
    }

    .guide-page .info-section.nowplay-preview .commercial-box {
        display: none !important;
    }

    .guide-page .info-body,
    .guide-page .info-body.has-poster {
        grid-template-columns: minmax(0, 1fr) var(--guide-now-playing-poster-col);
        gap: 8px;
        height: calc(var(--guide-now-playing-height) - 36px);
    }

    .guide-page .info-title {
        margin-bottom: 2px;
        font-size: 9px;
    }

    .guide-page .current-time {
        font-size: 22px;
        margin-bottom: 2px;
        line-height: 1.05;
    }

    .guide-page .timezone-info {
        font-size: 10px;
        line-height: 1.2;
        margin-bottom: 2px;
    }

    .guide-page .current-program,
    .guide-page #now-program {
        font-size: 13px;
        line-height: 1.15;
        margin-top: 0;
    }

    .guide-page .program-description,
    .guide-page #now-description {
        font-size: 10px;
        line-height: 1.25;
        margin-top: 2px;
    }

    .guide-page .current-channel,
    .guide-page .current-window,
    .guide-page #now-channel,
    .guide-page #now-window {
        font-size: 10px;
        line-height: 1.2;
        margin-top: 1px;
    }

    .guide-page .program-poster-frame img {
        max-height: calc(var(--guide-now-playing-height) - 40px);
        max-width: var(--guide-now-playing-poster-col);
    }

    .guide-page .info-body.has-channel-graphic {
        grid-template-columns: minmax(0, 1fr) minmax(100px, 1.25fr);
        gap: 6px;
    }

    .guide-page .info-body.has-channel-graphic .program-poster-frame.channel-graphic img {
        max-height: calc(var(--guide-now-playing-height) - 44px);
        max-width: min(150px, 100%);
    }

    .guide-page .tv-guide-container {
        overflow: hidden;
        padding: 6px 8px 8px;
        flex: 1 1 auto;
        min-height: 0;
    }

    .guide-page .tv-guide-footer {
        flex-shrink: 0;
    }

    .screen-content.guide-page {
        height: 100%;
        max-height: 100%;
        min-height: 0;
    }

    .guide-page .time-header {
        overflow: hidden !important;
    }

    .guide-page .time-header-inner {
        display: grid !important;
        grid-template-columns: var(--channel-info-width) 1fr;
        overflow: hidden !important;
        min-width: 0;
    }

    .guide-page .time-label {
        width: var(--channel-info-width);
        min-width: var(--channel-info-width);
        font-size: 10px;
        padding: 4px 4px;
    }

    .guide-page .time-track-wrapper {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        min-width: 0;
    }

    .guide-page .channels-container {
        display: block !important;
        flex-direction: unset !important;
        gap: 0 !important;
        overflow-x: hidden !important;
        overflow-y: auto;
        flex: 1 1 0;
        min-height: 0;
        height: 0;
        max-height: none !important;
        padding-bottom: 12px;
        scroll-padding-bottom: 12px;
        -webkit-overflow-scrolling: touch;
    }

    .guide-page .channel-row {
        display: grid !important;
        grid-template-columns: var(--channel-info-width) minmax(0, 1fr) !important;
        grid-template-rows: 1fr;
        flex-direction: row !important;
        align-items: stretch;
        height: var(--channel-row-height);
        min-height: var(--channel-row-height);
        max-height: var(--channel-row-height);
        min-width: 0;
        margin-bottom: 3px !important;
        padding: 0 !important;
        gap: 0 !important;
    }

    .guide-page .channel-info {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: var(--channel-info-width);
        min-width: var(--channel-info-width);
        max-width: var(--channel-info-width);
        height: 100%;
        padding: 4px 5px;
        gap: 2px;
        background: var(--guide-mobile-channel-bg);
        position: sticky;
        left: 0;
        z-index: 4;
        border-right: 1px solid rgba(99, 27, 168, 0.55);
        border-bottom: none;
    }

    .guide-page .channel-number-badge {
        width: 100%;
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
        justify-content: center;
    }

    .guide-page .channel-number {
        font-size: 10px;
        font-weight: 800;
        letter-spacing: 0.3px;
        color: #b8a4e8;
        text-transform: uppercase;
    }

    .guide-page .channel-number::before {
        content: 'CH ';
    }

    .guide-page .channel-meta {
        width: 100%;
        padding: 0;
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .guide-page .channel-name,
    .guide-page .channel-name.multi-line,
    .guide-page .channel-name.single-line,
    .guide-page .channel-name-top,
    .guide-page .channel-name-bottom {
        font-size: 8px;
        letter-spacing: 0.2px;
        line-height: 1.12;
        text-align: center;
        width: 100%;
    }

    .guide-page .channel-name.multi-line {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .guide-page .programs-scroll {
        overflow-x: auto;
        overflow-y: hidden;
        min-width: 0;
        height: 100%;
        -webkit-overflow-scrolling: touch;
    }

    .guide-page .programs-row {
        height: 100%;
        min-height: 100%;
        max-height: 100%;
        padding: 0;
    }

    .guide-page .program-block {
        top: 0;
        bottom: 0;
        padding: 4px 8px;
    }

    .guide-page .program-block .program-title {
        font-size: 11px;
        margin-bottom: 2px;
    }

    .guide-page .program-block .program-time {
        font-size: 9px;
    }

    .guide-page .program-block.shopping-program {
        background: var(--guide-shopping-bg) !important;
    }

    .guide-page .program-block.weather-program {
        background: var(--guide-weather-bg) !important;
        border-color: rgba(28, 222, 2, 0.6) !important;
    }

    .guide-page .program-block.weather-program .program-title,
    .guide-page .program-block.weather-program .program-time {
        color: #fff !important;
    }
}

@media (max-width: 540px) {
    .guide-page {
        --channel-info-width: 76px;
    }

    .guide-page .channel-name,
    .guide-page .channel-name-top,
    .guide-page .channel-name-bottom {
        font-size: 7px;
    }
}
