:root {
    --color-bg-main: #121212;
    --color-bg-secondary: #1E1E1E;
    --color-accent: #FF6E42;
    --color-accent-pink: #F658A4;
    --color-text-main: #FFFFFF;
    --color-text-secondary: #B0B0B0;
    --color-border: #2E2E2E;
}

/* Remove global overrides to respect theme fonts/colors */

.tv-schedule {
    background: var(--color-bg-secondary);
    border-radius: 12px;
    padding: 20px;
    margin: 20px auto;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tv-schedule:hover {
    transform: none;
    box-shadow: none;
}

.tv-schedule-header {
    color: var(--color-text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tv-schedule-current-program {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.tv-schedule-current-program a {
    color: var(--color-text-main);
    text-decoration: none;
    transition: color 0.2s;
}

.tv-schedule-current-program a:hover {
    color: var(--color-accent);
}

.tv-schedule-progress {
    height: 4px;
    background: var(--color-bg-main);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.tv-schedule-progress-bar {
    height: 100%;
    background: #FF6E42;
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Keep end-of-program state solid orange, no gradient */
.tv-schedule-progress-ending {
    background: #FF6E42;
}

.tv-schedule-upcoming-list {
    flex: 1;
    overflow-y: auto;
    max-height: 250px;
}

.tv-schedule.details-visible .tv-schedule-upcoming-list {
    max-height: 250px;
}

.tv-schedule-program {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}

.tv-schedule-program:last-child {
    border-bottom: none;
}

.tv-schedule-time {
    flex: 0 0 55px;
    font-weight: 500;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.tv-schedule-name {
    flex: 1;
    font-size: 0.9rem;
    min-width: 0; /* Prevent text overflow issues */
}

.tv-schedule-name a {
    color: inherit;
    text-decoration: none;
}

.tv-schedule-name a:hover {
    color: var(--color-accent);
}

.tvschedule-details-button, .tvschedule-more-button {
    background-color: var(--color-bg-main);
    color: var(--color-text-main);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    transition: background-color 0.2s, border-color 0.2s;
    margin-top: 16px;
    font-family: inherit;
}

.tvschedule-details-button:hover, .tvschedule-more-button:hover {
    background-color: var(--color-border);
    border-color: var(--color-text-secondary);
    filter: none;
}

.tvschedule-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    overscroll-behavior: contain;
}

/* Force overlay to be on top of any site elements */
.tvschedule-modal-overlay.tvschedule-modal-overlay {
    z-index: 2147483647;
}

.tvschedule-modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Prevent body from scrolling when modal is open */
body.tvschedule-modal-open {
    overflow: hidden;
}

.tvschedule-modal {
    background: var(--color-bg-secondary);
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

/* ===== New slider UI (tabs + horizontal cards) ===== */
/* Root container overrides for slider layout */
.tv-schedule.tvs-container {
    background: transparent;
    padding: 0;
    margin: 0 0 24px 0;
    max-width: 100%;
    gap: 0;
}

.tvs-header { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    margin: 0 0 12px 0; 
}

.tvs-tabsbar { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    width: 100%;
}
.tvs-tabsbar .tvs-nav:disabled { opacity: .35; pointer-events: none; background: transparent; }

.tvs-cardsbar { display:flex; align-items:center; gap:8px; margin-left:12px; }

.tvs-nav { 
    background: transparent; 
    border: 0; 
    color: #fff; 
    opacity: .9; 
    width: 34px; 
    height: 34px; 
    display: grid; 
    place-items: center; 
    border-radius: 10px; 
    transition: background .2s ease, opacity .2s ease; 
}
.tvs-nav:hover { background: rgba(255,255,255,.06); opacity: 1; }
.tvs-nav:disabled { opacity: .25; pointer-events: none; background: transparent; }

.tvs-tabs-viewport { overflow: hidden; flex: 1; min-width: 0; }
.tvs-tabs { display: flex; gap: 10px; overflow-x: auto; padding: 2px; scrollbar-width: none; }
.tvs-tabs::-webkit-scrollbar { display: none; height: 0; }

.tvs-tab { 
    background: rgba(255,255,255,.06); 
    color: #fff; 
    border: 0; 
    border-radius: 10px; 
    padding: 6px 10px; 
    cursor: pointer; 
    font: inherit; 
    font-size: 14px; 
    line-height: 1; 
    opacity: .9; 
    transition: background .2s ease, opacity .2s ease; 
    white-space: nowrap; 
}
.tvs-tab:hover { opacity: 1; background: rgba(255,255,255,.1); }
.tvs-tab.is-active { background: #fff; color: #000; opacity: 1; }

.tvs-viewport { position: relative; overflow: hidden; display:flex; align-items:stretch; }
.tvs-track { 
    display: flex; 
    gap: 20px; 
    overflow-x: auto; 
    padding: 8px 2px 6px 2px; 
    scroll-snap-type: x mandatory; 
    -webkit-overflow-scrolling: touch; 
    scrollbar-width: none; 
    flex: 1 1 auto;
}
.tvs-track::-webkit-scrollbar { display: none; height: 0; }

/* Bottom bar */
.tvs-bottombar { display:flex; justify-content:center; gap:12px; padding: 10px 0 0; }
.tvs-bottombar .tvs-nav { background: rgba(255,255,255,.08); border:1px solid rgba(255,255,255,.16); border-radius: 999px; width:34px; height:34px; display:grid; place-items:center; color:#fff; }
.tvs-bottombar .tvs-nav:hover { background: rgba(255,255,255,.14); }

/* Safe areas (minimal) */
.tvs-viewport { --tvs-nav-space: 0px; --tvs-nav-top-space: 0px; }
.tvs-viewport .tvs-content { left: calc(16px + var(--tvs-nav-space)); right: calc(16px + var(--tvs-nav-space)); }
.tvs-viewport .tvs-meta { left: calc(16px + var(--tvs-nav-space)); right: calc(16px + var(--tvs-nav-space)); top: calc(14px + var(--tvs-nav-top-space)); }

/* Card */
.tvs-card {
    position: relative;
    flex: 0 0 auto;
    width: 100%;
    max-width: 720px;
    min-height: 180px;
    border-radius: 22px;
    background: var(--color-bg-secondary);
    overflow: hidden;
    color: #fff;
    scroll-snap-align: start;
}

.tvs-card { 
    background-image: var(--tvs-bg); 
    background-size: cover; 
    background-position: center; 
}
.tvs-card-overlay { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.86) 0%, rgba(0,0,0,.62) 58%, rgba(0,0,0,.34) 100%); }
.tvs-card::after { content:""; position:absolute; inset:0; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); border-radius: inherit; pointer-events:none; }

.tvs-meta { position: absolute; left: 16px; right: 16px; top: 14px; z-index: 2; display: flex; align-items: center; gap: 12px; }
.tvs-badge-now {
    display: inline-block;
    font-weight: 800;
    font-size: 28px;
    letter-spacing: 0.4px;
    background: linear-gradient(90deg, #FF6E42 0%, #F658A4 100%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tvs-time {
    display: inline-block;
    margin-left: auto;
    font-size: 16px;
    font-weight: 800;
    color: #fff;
}

.tvs-content { position: absolute; left: 16px; right: 16px; bottom: 16px; z-index: 2; display: flex; flex-direction: column; gap: 10px; }
.tvs-content { top: auto; }
.tvs-title { font-size: 22px; font-weight: 700; color: #fff; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 1; line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; margin-top: 4px; }
.tvs-card a.tvs-card-link { color: inherit; text-decoration: none; }
.tvs-desc { color: rgba(255,255,255,.84); font-size: 15px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tvs-more { align-self:flex-start; display:inline-flex; gap:6px; align-items:center; background: rgba(255,255,255,.12); color:#fff; border:0; border-radius:10px; padding:6px 10px; font: inherit; font-size: 13px; line-height: 1; cursor:pointer; opacity:.92; transition: background .2s ease, opacity .2s ease; }
.tvs-more:hover { opacity:1; background: rgba(255,255,255,.18); }

/* Mini modal visual (CSS-only additions for better placement) */
.tvs-mini-modal { display:none; position:fixed; inset:0; align-items:center; justify-content:center; z-index:2147483646; pointer-events:auto; }
.tvs-mini-modal .tvs-mini-backdrop { position:absolute; inset:0; background:rgba(0,0,0,.6); }
.tvs-mini-modal .tvs-mini-content { position:relative; max-width:760px; width:92%; background:#1E1E1E; color:#fff; border-radius:16px; padding:18px; border:1px solid rgba(255,255,255,.12); box-shadow:0 20px 60px rgba(0,0,0,.45); display:flex; flex-direction:column; gap:12px; }
.tvs-mini-modal .tvs-mini-close { position:absolute; top:10px; right:10px; background:transparent; border:0; color:#fff; opacity:.85; cursor:pointer; }
.tvs-mini-modal .tvs-mini-head { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.tvs-mini-modal .tvs-mini-time { font-size:18px; font-weight:600; background:rgba(255,255,255,.1); padding:8px 12px; border-radius:12px; }
.tvs-mini-modal .tvs-mini-title { font-size:22px; font-weight:700; line-height:1.25; }
.tvs-mini-modal .tvs-mini-poster { width:100%; aspect-ratio:16/9; background:#2a2a2a; border-radius:12px; overflow:hidden; }
.tvs-mini-modal .tvs-mini-poster img { width:100%; height:100%; object-fit:cover; display:block; }
.tvs-mini-modal .tvs-mini-text { max-height:60vh; overflow:auto; white-space:pre-wrap; line-height:1.5; font-size:15px; color:rgba(255,255,255,.92); }

.tvs-empty, .tvs-loading { color: var(--color-text-secondary); padding: 32px 0; text-align: center; width: 100%; }

@media (min-width: 1024px) {
    .tvs-card { width: 100%; max-width: 820px; min-height: 240px; border-radius: 26px; }
    .tvs-title { font-size: 24px; }
    .tvs-desc { font-size: 16px; }
    .tvs-time { font-size: 28px; }
    .tvs-badge-now { font-size: 36px; }
}

@media (max-width: 640px) {
    .tvs-viewport { --tvs-nav-space: 12px; --tvs-nav-top-space: 2px; }
    .tvs-tabsbar { gap: 8px; }
    .tvs-nav { width: 30px; height: 30px; opacity: .85; }
    .tvs-tab { padding: 6px 8px; font-size: 12px; }
    .tvs-track { gap: 12px; }
    .tvs-card { width: 100%; min-height: 190px; border-radius: 18px; }
    .tvs-meta { left: 12px; right: 12px; top: 10px; gap: 8px; }
    .tvs-content { left: 12px; right: 12px; bottom: 12px; top: auto; }
    .tvs-badge-now { font-size: 24px; }
    .tvs-time { font-size: 14px; }
    .tvs-title { font-size: 18px; }
    .tvs-desc { font-size: 14px; }
}

.tvschedule-modal-overlay.visible .tvschedule-modal {
    transform: scale(1);
}

.tvschedule-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
}

.tvschedule-modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    font-family: inherit;
}

.tvschedule-modal-close {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s;
}

.tvschedule-modal-close:hover {
    color: var(--color-text-main);
}

.tvschedule-modal-content {
    padding: 0;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.tvschedule-days-tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border);
    padding: 0 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tvschedule-tab {
    padding: 12px 16px;
    cursor: pointer;
    color: var(--color-text-secondary);
    border-bottom: 2px solid transparent;
    transition: color 0.2s;
    font-weight: 500;
    white-space: nowrap;
}

.tvschedule-tab.active {
    color: var(--color-text-main);
    border-bottom: 2px solid var(--color-accent);
}

.tvschedule-days-content {
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

.tvschedule-day-content {
    display: none;
    padding: 10px 20px;
}

.tvschedule-day-content.active {
    display: block;
}

.tvschedule-day-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 10px;
    padding-top: 10px;
    color: var(--color-text-main);
}

.tvschedule-program {
    display: flex;
    gap: 15px;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}

.tvschedule-program:last-child {
    border-bottom: none;
}

.tvschedule-program-image {
    width: 120px;
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    object-fit: cover;
    object-position: center;
    display: block;
    max-width: 100%;
    flex-shrink: 0;
    background-color: var(--color-bg-main);
}

.tvschedule-program-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tvschedule-program-description {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.tvschedule-no-programs {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-secondary);
}

.tv-schedule-offline-notice {
    text-align: center;
    padding: 10px;
    background-color: #4f2525;
    color: #ffcccc;
    border-radius: 8px;
    margin-bottom: 10px;
}


.tvschedule-spinner-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.tvschedule-spinner {
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-left-color: var(--color-accent);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: tvschedule-spin 1s linear infinite;
}

@keyframes tvschedule-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Removed empty ruleset */

.tv-schedule-offline {
    background-color: transparent;
    padding: 0;
    margin-bottom: 0;
    position: relative;
    display: block;
    height: auto;
    min-height: auto;
    color: #f0f0f0;
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
}

.tv-schedule-offline:hover {
    transform: none;
}

.tv-schedule-offline-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #ff3030;
    display: inline-block;
    margin-right: 8px;
    vertical-align: middle;
}

.tv-schedule-offline-message {
    font-weight: 500;
    color: #ffffff;
    font-size: 16px;
    display: inline-block;
    vertical-align: middle;
}

.tv-schedule-offline-container {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    margin: 0;
    padding: 8px 12px;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 4px;
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
}

.tv-schedule-offline .tvschedule-details-button {
    margin-top: 10px;
    margin-bottom: 10px;
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--color-bg-main);
    color: var(--color-text-main);
    border: 1px solid var(--color-accent);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    text-transform: none;
    letter-spacing: 0.2px;
}

.tv-schedule-offline .tvschedule-details-button:hover {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
    transform: translateY(-1px);
}

.tv-schedule-now {
    background: transparent;
    color: var(--color-text-main);
    padding: 0;
    border-bottom: none;
}

.tv-schedule-upcoming-header {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    border-bottom: 1px solid var(--color-bg-main);
    padding-bottom: 8px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tv-schedule-program:hover {
    background: rgba(var(--color-accent-rgb), 0.1);
    box-shadow: none;
}

.tv-schedule-program:last-child {
    border-bottom: none;
}

.tv-schedule-no-programs {
    color: #777;
    font-style: italic;
    padding: 15px 0;
    text-align: center;
    font-size: 14px;
}

.tv-schedule .loading {
    text-align: center;
    padding: 10px;
    color: #999;
    font-style: italic;
}

.tvschedule-icon {
    color: var(--color-accent);
    font-size: 0.9rem;
}

/* Ensure program layout is always horizontal */
.tv-schedule-program,
.tvschedule-program {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 15px !important;
}

.tv-schedule-time,
.tvschedule-time {
    flex-shrink: 0 !important;
}

.tv-schedule-name,
.tvschedule-name {
    flex-grow: 1 !important;
    flex-shrink: 1 !important;
}

/* Ultra-specific rules to override any conflicting styles */
.tv-schedule .tv-schedule-program,
.tv-schedule .tvschedule-program,
.tvschedule-modal .tv-schedule-program,
.tvschedule-modal .tvschedule-program {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 15px !important;
}

@media screen and (max-width: 600px) {
    .tvschedule-modal-content {
        width: 95%;
        margin: 20px auto;
        padding: 20px;
    }
    
    .tvschedule-tab {
        padding: 10px 2px;
        font-size: 0.75rem;
    }
    
    .tvschedule-tab:before {
        font-size: 1rem;
    }
    
    .tvschedule-tab:after {
        font-size: 0.65rem;
    }
    
    .tvschedule-time {
        flex: 0 0 50px;
        font-size: 0.8rem;
    }
    
    .tvschedule-name {
        font-size: 0.85rem;
    }
    
    /* IMPORTANT: Keep horizontal layout on mobile */
    .tv-schedule-program,
    .tvschedule-program {
        flex-direction: row !important;
        align-items: center !important;
        padding: 10px 0;
    }
}

/* On very small screens, hide posters to simplify scrolling */
@media screen and (max-width: 480px) {
    .tvschedule-program-image {
        display: none;
    }
}

@media screen and (max-width: 600px) {
    .tv-schedule {
        width: auto;
        margin: 10px;
        padding: 16px;
    }
    
    /* IMPORTANT: Maintain horizontal layout on mobile */
    .tv-schedule-program,
    .tvschedule-program {
        flex-direction: row !important;
        align-items: center !important;
        padding: 10px 0;
        gap: 12px !important;
    }
    
    .tv-schedule-time,
    .tvschedule-time {
        flex: 0 0 45px !important;
        font-size: 0.8rem;
    }
    
    .tv-schedule-name,
    .tvschedule-name {
        font-size: 0.85rem;
        flex: 1 !important;
    }
} 