/*
 * /css/site.css
 *
 * Site-specific theme and streaming UI.
 * Bootstrap provides the layout grid, spacing, flex utilities, buttons,
 * cards, alerts, and responsive structure.
 */

/* ================================================================
   Theme
   ================================================================ */
:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --text: #18212b;
    --muted: #5f6d7a;
    --line: #d9e0e6;
    --brand: #123f68;
    --brand-dark: #0b2c49;
    --accent: #bd2c36;
    --online: #16834a;
    --offline: #9b2730;
    --shadow: 0 10px 30px rgba(18, 42, 63, .09);

    /* Bootstrap theme bridge. */
    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text);
    --bs-border-color: var(--line);
    --bs-link-color: var(--brand);
    --bs-link-hover-color: var(--brand-dark);
    --bs-border-radius: .5rem;
    --bs-border-radius-lg: .625rem;
}

body {
    min-height: 100vh;
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

/* Keep the public/admin content width close to the pre-Bootstrap design. */
@media (min-width: 1200px) {
    .container {
        max-width: 1180px;
    }
}

/* Brand Bootstrap's primary buttons without replacing Bootstrap behavior. */
.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-dark);
    --bs-btn-hover-border-color: var(--brand-dark);
    --bs-btn-active-bg: var(--brand-dark);
    --bs-btn-active-border-color: var(--brand-dark);
}

.btn-outline-primary {
    --bs-btn-color: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand-dark);
    --bs-btn-active-border-color: var(--brand-dark);
}

.min-w-0 {
    min-width: 0;
}

/* ================================================================
   Public header and shared navigation
   ================================================================ */
.site-header {
    color: #fff;
    background: linear-gradient(120deg, var(--brand-dark), var(--brand));
    border-bottom: 5px solid var(--accent);
}

.eyebrow {
    font-size: .77rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    opacity: .76;
}

.site-header h1 {
    font-size: clamp(2rem, 5vw, 3.7rem);
    line-height: 1.04;
    letter-spacing: -.035em;
}

.subtitle {
    max-width: 690px;
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: #dbe9f4;
}

.site-logo {
    width: auto;
    height: 90px;
}

@media (max-width: 575.98px) {
    .site-logo {
        height: 60px;
    }
}

.compact-header {
    color: #fff;
    background: var(--brand-dark);
    border-bottom: 4px solid var(--accent);
}

.brand {
    font-weight: 850;
}

/* ================================================================
   Notices and section headings
   ================================================================ */
.notice {
    background: #edf4fa;
    border-color: #ccdeec;
    border-left: 5px solid var(--brand);
}

.notice span {
    color: #455868;
}

.section-heading {
    border-bottom: 1px solid var(--line);
}

.section-heading h2 {
    font-size: 1.45rem;
}

.section-heading > span,
.status-summary {
    color: var(--muted);
    font-size: .86rem;
}

/* ================================================================
   Stream directory cards and thumbnails
   ================================================================ */
.stream-card {
    border-color: var(--line);
    box-shadow: var(--shadow);
}

.preview {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    color: #fff;
    text-decoration: none;
    background: linear-gradient(145deg, #203346, #0e1924);
}

.preview.is-disabled {
    cursor: default;
}

.stream-thumbnail {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    opacity: 0;
    object-fit: cover;
    transition: opacity .18s ease, transform .25s ease;
}

.stream-thumbnail.is-loaded {
    opacity: 1;
}

.preview:not(.is-disabled):hover .stream-thumbnail.is-loaded {
    transform: scale(1.025);
}

.stream-card.is-offline .stream-thumbnail {
    filter: grayscale(.45) brightness(.72);
}

.preview-placeholder {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 10px;
    color: #d9e5ee;
}

.preview-placeholder.is-hidden {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.camera-icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    padding-left: 4px;
    border: 1px solid rgba(255, 255, 255, .34);
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
}

.preview-placeholder span:last-child {
    font-size: .87rem;
    font-weight: 700;
}

/* LIVE, OFFLINE, and CONNECTING pills. */
.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    font-size: .73rem;
    font-weight: 850;
    letter-spacing: .04em;
    text-transform: uppercase;
    border-radius: 999px;
}

.preview > .status {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 3;
    color: #fff;
    backdrop-filter: blur(5px);
}

.status-checking {
    background: rgba(92, 104, 116, .9);
}

.status-online {
    background: rgba(22, 131, 74, .96);
}

.status-offline {
    background: rgba(155, 39, 48, .96);
}

.preview-label {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 3;
    padding: 5px 8px;
    color: #fff;
    background: rgba(4, 18, 31, .74);
    border-radius: 5px;
    font-size: .68rem;
    font-weight: 700;
}

.stream-card h3 {
    font-size: 1rem;
    line-height: 1.25;
}

.stream-card .stream-meta {
    font-size: .84rem;
    color: var(--muted);
}

.stream-card .preview-time {
    font-size: .7rem;
}

.offline-label {
    color: var(--offline);
    font-size: .8rem;
    font-weight: 800;
}

/* ================================================================
   Footer
   ================================================================ */
.site-footer {
    color: #cbd9e5;
    background: #13283b;
}

.footer-inner {
    font-size: .85rem;
}

/* ================================================================
   Watch page and video player
   ================================================================ */
.watch-heading h1 {
    font-size: clamp(1.7rem, 4vw, 2.7rem);
}

.watch-heading .eyebrow {
    color: var(--brand);
    opacity: 1;
}

.player-status {
    color: #fff;
}

.player-shell {
    background: #071019;
    border-color: #1e3344;
    box-shadow: var(--shadow);
}

.video-stage {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 16 / 9;
    background: #05090d;
}

.video-stage video {
    display: block;
    width: 100%;
    height: 100%;
    opacity: 0;
    background: #05090d;
    object-fit: contain;
    transition: opacity .2s ease;
}

.video-stage video.is-ready {
    opacity: 1;
}

.player-message {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 8px;
    text-align: center;
    color: #fff;
    background: #06111b;
}

.player-message span {
    max-width: 520px;
    color: #bbc9d4;
}

.offline-message {
    background:
        linear-gradient(rgba(4, 10, 15, .88), rgba(4, 10, 15, .88)),
        url('/images/offline.svg') center / contain no-repeat,
        #06111b;
}

.loading-spinner {
    width: 34px;
    height: 34px;
    border: 4px solid rgba(255, 255, 255, .25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: player-spin .85s linear infinite;
}

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

.player-controls {
    color: #c4d0da;
    background: #10202d;
}

.player-control-note {
    flex: 1;
    font-size: .82rem;
}

/* ================================================================
   Other streams and error page
   ================================================================ */
.mini-stream {
    color: var(--brand-dark);
    background: var(--surface);
    border: 1px solid var(--line);
    font-size: .9rem;
    font-weight: 700;
    text-decoration: none;
    transition:
        border-color .15s ease,
        box-shadow .15s ease,
        transform .15s ease;
}

.mini-stream.is-online:hover {
    border-color: #9ab6d6;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
    transform: translateY(-1px);
}

.mini-stream.is-online:focus-visible {
    outline: 3px solid rgba(18, 63, 104, .24);
    outline-offset: 2px;
}

.mini-stream.is-offline {
    cursor: default;
}

.mini-stream-name {
    min-width: 0;
    overflow-wrap: anywhere;
}

.mini-stream .status {
    color: #fff;
}

.mini-arrow {
    color: var(--brand);
    font-size: 1rem;
    font-weight: 850;
    line-height: 1;
}

.error-panel {
    max-width: 680px;
    box-shadow: var(--shadow);
}

.error-panel .eyebrow {
    color: var(--accent);
    opacity: 1;
}

.error-panel h1 {
    font-size: 2.4rem;
}
