/* Main player container */
.cctv-player[data-cctv] {
    width: 100%;
    min-width: 0;
    max-width: var(--cctv-max-width, 1025px);
    color: inherit;
    font: inherit;
    overflow-wrap: anywhere;
    container-type: inline-size;

    /* Custom properties */
    --cctv-accent: #821bdd;
    --cctv-control-gap: .5rem;
    --cctv-border-color: #aaa;
    --cctv-radius: 0px;
}

/* Apply consistent box sizing */
.cctv-player,
.cctv-player * {
    box-sizing: border-box;
}

/* Player alignment */
.cctv-player.cctv-align-center {
    margin-left: auto;
    margin-right: auto;
}

.cctv-player.cctv-align-left {
    margin-left: 0;
    margin-right: auto;
}

.cctv-player.cctv-align-right {
    margin-left: auto;
    margin-right: 0;
}

/* Hidden elements */
.cctv-player [hidden] {
    display: none !important;
}

/* Video screen */
.cctv-player .cctv-screen {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--cctv-radius);
    overflow: hidden;
}

/* Video element */
.cctv-player .cctv-video {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: contain;
	border: 4px solid #fefefe;

}

/* Tune / loading button */
.cctv-player .cctv-tune {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    color: #111;
    max-width: calc(100% - 1rem);
    white-space: normal;
}

/* Controls layout */
.cctv-player .cctv-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--cctv-control-gap);
    margin-top: 20px;
}

/* Buttons */
.cctv-player button {
    font: inherit;
    line-height: 1.3;
    min-height: 44px;
    max-width: 100%;
    white-space: normal;
    padding: .4em .65em;
    border: 1px solid var(--cctv-border-color);
    border-radius: var(--cctv-radius);
    cursor: pointer;
}

/* Prevent controls from overflowing */
.cctv-player .cctv-controls > * {
    min-width: 0;
    max-width: 100%;
}

/* Disabled buttons */
.cctv-player button:disabled {
    opacity: .55;
    cursor: default;
}

/* Keyboard focus indicators */
.cctv-player button:focus-visible,
.cctv-player input:focus-visible,
.cctv-player a:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

/* Volume control */
.cctv-player .cctv-volume {
    display: flex;
    align-items: center;
    gap: .5em;
    min-height: 44px;
    font-size: 1em;
}

.cctv-player .cctv-volume input {
    width: 8rem;
    min-width: 0;
    max-width: 100%;
    /accent-color: var(--cctv-accent);
}

/* Paragraph spacing */
.cctv-player p {
    margin: .6em 0;
    line-height: 1.5;
}

/* Status, position, and attribution text */
.cctv-player .cctv-status,
.cctv-player .cctv-position,
.cctv-player .cctv-attribution {
    font-size: 1em;
}

/* Progress bar */
.cctv-player .cctv-progress {
    height: 12px;
    background: #969595;
    border: 1px solid var(--cctv-border-color);
}

/* Progress indicator inside the bar */
.cctv-player .cctv-progress span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--cctv-accent);
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
    .cctv-player * {
        animation: none !important;
        transition: none !important;
    }
}

/* Compact layout on narrow screens */
@container (max-width: 420px) {
    .cctv-player .cctv-controls {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cctv-player .cctv-volume {
        grid-column: 1 / -1;
    }

    .cctv-player .cctv-volume input {
        flex: 1;
        width: auto;
    }
}



/* Keep Now Playing and broadcast time on one row */
.cctv-player .cctv-now-row {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: nowrap;
    width: 100%;
	padding-top: 20px;
	padding-bottom: 3px;
}

.cctv-player .cctv-now,
.cctv-player .cctv-position {
    margin: 0;
}

.cctv-player .cctv-now {
    min-width: 0;
    flex: 1;
}

.cctv-player .cctv-position {
    flex-shrink: 0;
    white-space: nowrap;
    text-align: right;
}

/* Keep progress bar underneath */
.cctv-player .cctv-progress {
    display: block;
    width: 100%;
}
.cctv-player button[data-cctv-action="live"] {
    display: none !important;
}


/* Windows 3.0-style volume slider */

/* Base slider and track */
.cctv-player .cctv-volume input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    height: 12px;
    background: #969595;
    border: 1px solid #808080;
    border-radius: 0;
    cursor: pointer;
}

/* Chrome, Edge, and Safari */
.cctv-player .cctv-volume input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 24px;
    border-radius: 0;
    background: #c0c0c0;
    border-top: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
    border-right: 2px solid #404040;
    border-bottom: 2px solid #404040;
    box-shadow: 1px 1px 0 #000000;
    cursor: pointer;
}

/* Firefox */
.cctv-player .cctv-volume input::-moz-range-thumb {
    width: 14px;
    height: 20px;
    border-radius: 0;
    background: #c0c0c0;
    border: 2px solid;
    border-top-color: #ffffff;
    border-left-color: #ffffff;
    border-right-color: #404040;
    border-bottom-color: #404040;
    box-shadow: 1px 1px 0 #000000;
    cursor: pointer;
}

/* Firefox track */
.cctv-player .cctv-volume input::-moz-range-track {
    height: 14px;
    background: transparent;
    border: none;
}

/* Force all player typography to 1em */
.cctv-player[data-cctv],
.cctv-player[data-cctv] * {
    font-size: 1em !important;
}

/* Align status text with volume controls */
.cctv-player .cctv-controls {
    display: flex;
    align-items: center;
}

/* Keep status on the controls row, aligned to the right */
.cctv-player .cctv-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.cctv-player .cctv-status {
    flex: 1 1 160px;
    min-width: 0;
    margin: 0 0 0 auto;
    text-align: right;
}


.cctv-player .cctv-up-next-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    width: 100%;
	padding-top:2px;
}

.cctv-player .cctv-up-next,
.cctv-player .cctv-attribution {
    margin: 0;
}

.cctv-player .cctv-attribution {
    margin-left: auto;
    text-align: right;
}


/* Windows 3.x-style raised player buttons */
.cctv-player .cctv-controls button,
.cctv-player .cctv-tune {
    appearance: none;
    border-radius: 0;
    background: #c0c0c0;
    border-top: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
    border-right: 2px solid #404040;
    border-bottom: 2px solid #404040;
    box-shadow: 1px 1px 0 #000000;
    color: #000000;
    cursor: pointer;
}

/* Pressed state */
.cctv-player .cctv-controls button:active,
.cctv-player .cctv-tune:active {
    border-top-color: #404040;
    border-left-color: #404040;
    border-right-color: #ffffff;
    border-bottom-color: #ffffff;
    box-shadow: none;
    transform: translate(1px, 1px);
}

/* Disabled state */
.cctv-player .cctv-controls button:disabled,
.cctv-player .cctv-tune:disabled {
    color: #808080;
    text-shadow: 1px 1px 0 #ffffff;
    cursor: default;
}
