/* --- Main Player Wrapper --- */
.cts-player-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #000;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    color: #fff;
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none; /* IE 10+ */
    user-select: none;
}

#cts-video-container {
    width: 100%;
    height: 100%;
}

#cts-video-container video,
#cts-video-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* --- Overlays --- */
.cts-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Allows clicks to pass through to the video */
    display: flex; /* Flexbox is great for positioning */
    box-sizing: border-box;
}

/* Poster Overlay */
#cts-poster-overlay {
    background-size: cover;
    background-position: center;
    cursor: pointer;
    pointer-events: auto;
    justify-content: center;
    align-items: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    z-index: 30;
}
#cts-poster-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.cts-play-button {
    width: 80px;
    height: 80px;
    background-color: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    position: relative;
    z-index: 2;
}
.cts-play-button::after {
    content: '';
    position: absolute;
    left: 32px;
    top: 20px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 20px 0 20px 30px;
    border-color: transparent transparent transparent white;
}
.cts-play-button-pulse {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    animation: pulse-animation 2s infinite;
    z-index: 1;
}
@keyframes pulse-animation {
    0% { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(1.5); opacity: 0; }
}


/* Logo Overlay */
#cts-logo-overlay {
    padding: 1.5vmin;
    z-index: 20;
}
#cts-logo-overlay img {
    height: auto;
    opacity: 0.9;
}
#cts-logo-overlay.top-left { justify-content: flex-start; align-items: flex-start; }
#cts-logo-overlay.top-right { justify-content: flex-end; align-items: flex-start; }
#cts-logo-overlay.bottom-left { justify-content: flex-start; align-items: flex-end; padding-bottom: 60px; /* Avoid controls */ }
#cts-logo-overlay.bottom-right { justify-content: flex-end; align-items: flex-end; padding-bottom: 60px; /* Avoid controls */ }


/* Live Badge Overlay */
#cts-live-badge-overlay {
    padding: 2vmin;
    z-index: 20;
}
#cts-live-badge-overlay.top-left { justify-content: flex-start; align-items: flex-start; }
#cts-live-badge-overlay.top-right { justify-content: flex-end; align-items: flex-start; }
#cts-live-badge-overlay::before {
    content: attr(data-text);
    padding: 0.5vmin 1.2vmin;
    font-size: 1.8vmin;
    font-weight: bold;
    display: inline-block;
    text-transform: uppercase;
}


/* YT Pause & Offline Overlays */
#cts-yt-pause-overlay, #cts-offline-overlay {
    background-color: rgba(0,0,0,0.8);
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    z-index: 25;
}
#cts-offline-overlay span, #cts-yt-pause-overlay span {
    font-size: 1.5em;
    font-weight: 500;
}
@media (max-width: 600px) {
    #cts-offline-overlay span, #cts-yt-pause-overlay span { font-size: 1em; }
}

/* Ticker Overlay */
#cts-ticker-overlay-wrapper {
    top: auto;
    bottom: 50px; /* Height of controls bar */
    height: 40px;
    align-items: center;
    z-index: 20;
    overflow: hidden;
}
.cts-ticker-content {
    width: 100%;
    white-space: nowrap;
}
.cts-ticker-text {
    display: inline-block;
    padding-left: 100%; /* Start off-screen */
    animation: ticker-scroll linear infinite;
    font-size: 16px;
    will-change: transform; /* Performance boost */
}
@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* --- Controls Bar --- */
#cts-controls-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    box-sizing: border-box;
    z-index: 21;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    pointer-events: auto;
}
.cts-control-btn {
    background: transparent;
    border: none;
    width: 30px;
    height: 30px;
    cursor: pointer;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
    transition: transform 0.1s ease;
}
.cts-control-btn:hover {
    transform: scale(1.1);
}
#cts-play-pause-btn.playing { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="white"><path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/></svg>'); }
#cts-play-pause-btn.paused { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="white"><path d="M8 5v14l11-7z"/></svg>'); }
#cts-mute-btn.muted { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="white"><path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"/></svg>'); }
#cts-mute-btn.unmuted { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="white"><path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/></svg>'); }
#cts-fullscreen-btn { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" fill="white"><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg>'); }
.cts-controls-left { display: flex; align-items: center; gap: 10px; }
#cts-volume-slider { width: 80px; -webkit-appearance: none; appearance: none; height: 5px; background: #ddd; border-radius: 5px; outline: none; }
#cts-volume-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 15px; height: 15px; background: #fff; border-radius: 50%; cursor: pointer; }

/* --- Upcoming Programs --- */
#cts-upcoming-accordion { margin-top: 10px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
#cts-upcoming-toggle { width: 100%; text-align: left; padding: 12px 15px; border: 1px solid #ddd; background-color: #f7f7f7; cursor: pointer; font-size: 1em; font-weight: 500; color: #333; }
#cts-upcoming-list { list-style: none; padding: 10px 15px; margin: 0; border: 1px solid #ddd; border-top: none; }
#cts-upcoming-list li { padding: 8px 0; border-bottom: 1px solid #eee; color: #555; }
#cts-upcoming-list li:last-child { border-bottom: none; }
