/* ==============================================
   WM Livestream — Frontend Styles
   Isolated under #wm-ls-root for theme protection
   ============================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Design Tokens & Isolation Reset ─────────── */
#wm-ls-root {
    --wm-ls-primary: #2D3E50;
    --wm-ls-primary-light: #3A5068;
    --wm-ls-secondary: #6B9E8F;
    --wm-ls-accent: #4DB89A;
    --wm-ls-accent-dark: #3A9A7E;
    --wm-ls-bg: #FFFFFF;
    --wm-ls-bg-alt: #F8FAFB;
    --wm-ls-text: #0F172A;
    --wm-ls-text-muted: #64748B;
    --wm-ls-text-light: #94A3B8;
    --wm-ls-border: #E2E8F0;
    --wm-ls-font: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
    --wm-ls-shadow-derek:
        0px 0px 0px 1px rgb(0 0 0 / 0.06),
        0px 1px 1px -0.5px rgb(0 0 0 / 0.06),
        0px 3px 3px -1.5px rgb(0 0 0 / 0.06),
        0px 6px 6px -3px rgb(0 0 0 / 0.06),
        0px 12px 12px -6px rgb(0 0 0 / 0.06),
        0px 24px 24px -12px rgb(0 0 0 / 0.06);

    font-family: var(--wm-ls-font) !important;
    color: var(--wm-ls-text) !important;
    line-height: 1.5 !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Reset inherited theme styles */
#wm-ls-root *,
#wm-ls-root *::before,
#wm-ls-root *::after {
    box-sizing: border-box;
}

#wm-ls-root img {
    max-width: 100%;
    height: auto;
    border: none;
    outline: none;
}

#wm-ls-root button {
    font-family: var(--wm-ls-font);
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    margin: 0;
    color: inherit;
    font-size: inherit;
    line-height: inherit;
}

/* ── Logo + Badge Topbar ─────────────────────── */
#wm-ls-root .wm-ls-topbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

#wm-ls-root .wm-ls-logo {
    display: block;
    height: auto;
    /* Width controlled by inline style from admin setting */
}

/* ── LIVE Badge ──────────────────────────────── */
#wm-ls-root .wm-ls-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    padding: 8px 20px;
    border-radius: 9999px;
    border: 1px solid rgba(77, 184, 154, 0.25);
    background: rgba(77, 184, 154, 0.08);
}

#wm-ls-root .wm-ls-badge-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #6B9E8F;
    box-shadow: 0 0 8px rgba(107, 158, 143, 0.6);
    flex-shrink: 0;
}

#wm-ls-root .wm-ls-badge-text {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #6B9E8F;
    line-height: 1;
}

/* ── Heading ─────────────────────────────────── */
#wm-ls-root .wm-ls-heading {
    margin: 16px 0 0;
    padding: 0;
    text-align: center;
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.1;
    font-size: 30px;
    background: linear-gradient(to bottom, var(--wm-ls-primary), #334155, #94A3B8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@media (min-width: 768px) {
    #wm-ls-root .wm-ls-heading {
        font-size: 48px;
    }
}

/* ── Stream Card ─────────────────────────────── */
#wm-ls-root .wm-ls-stream-card {
    max-width: 1024px;
    margin: 40px auto 0;
    padding: 12px 12px 14px;
    border-radius: 16px;
    border: 1px solid var(--wm-ls-border);
    background: rgba(248, 250, 251, 0.7);
    box-shadow: var(--wm-ls-shadow-derek);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

@media (min-width: 768px) {
    #wm-ls-root .wm-ls-stream-card {
        padding: 16px 16px 18px;
    }
}

/* ── Play Trigger Button ─────────────────────── */
#wm-ls-root .wm-ls-play-trigger {
    display: block;
    width: 100%;
    text-align: left;
}

/* ── Video Container (16:9) ──────────────────── */
#wm-ls-root .wm-ls-video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 12px;
    background: #000;
}

#wm-ls-root .wm-ls-video-container--no-thumb {
    background: #1a1a1a;
}

/* ── Thumbnail Image ─────────────────────────── */
#wm-ls-root .wm-ls-thumb-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* ── Play Button Overlay ─────────────────────── */
#wm-ls-root .wm-ls-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.15);
    transition: background 0.3s;
}

#wm-ls-root .wm-ls-play-trigger:hover .wm-ls-play-overlay {
    background: rgba(0, 0, 0, 0.3);
}

#wm-ls-root .wm-ls-play-btn {
    width: 72px;
    height: auto;
    transition: transform 0.3s, filter 0.3s;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

#wm-ls-root .wm-ls-play-trigger:hover .wm-ls-play-btn {
    transform: scale(1.1);
}

@media (max-width: 480px) {
    #wm-ls-root .wm-ls-play-btn {
        width: 52px;
    }
}

/* ── Video Placeholder ───────────────────────── */
#wm-ls-root .wm-ls-video-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 24px;
    text-align: center;
    font-size: 14px;
    color: var(--wm-ls-text-muted);
}

/* ── Intro Text (inside card, tight) ─────────── */
#wm-ls-root .wm-ls-intro-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--wm-ls-accent);
    margin: 10px 0 4px;
    padding: 0;
    text-align: center;
}

/* ── Help Link (below card) ──────────────────── */
#wm-ls-root .wm-ls-help-row {
    max-width: 1024px;
    margin: 24px auto 0;
    text-align: center;
}

#wm-ls-root .wm-ls-help-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--wm-ls-text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

#wm-ls-root .wm-ls-help-link:hover {
    color: var(--wm-ls-accent);
}

/* ── Archive Section ─────────────────────────── */
#wm-ls-root .wm-ls-archive-section {
    max-width: 1024px;
    margin: 48px auto 0;
}

#wm-ls-root .wm-ls-archive-header {
    margin-bottom: 12px;
    text-align: center;
}

#wm-ls-root .wm-ls-archive-heading-text {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.1;
    background: linear-gradient(to bottom, var(--wm-ls-primary), #334155, #94A3B8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    padding: 0;
}

@media (min-width: 768px) {
    #wm-ls-root .wm-ls-archive-heading-text {
        font-size: 26px;
    }
}

/* ── Toggle Button ───────────────────────────── */
#wm-ls-root .wm-ls-archive-toggle-wrap {
    display: flex;
    justify-content: center;
}

#wm-ls-root .wm-ls-archive-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 9999px;
    border: 1px solid var(--wm-ls-border) !important;
    background: rgba(248, 250, 251, 0.7) !important;
    color: var(--wm-ls-text);
    transition: border-color 0.2s, background 0.2s;
    line-height: 1;
}

#wm-ls-root .wm-ls-archive-toggle:hover {
    border-color: rgba(107, 158, 143, 0.5) !important;
    background: var(--wm-ls-bg-alt) !important;
}

#wm-ls-root .wm-ls-chevron {
    width: 20px;
    height: 20px;
    transition: transform 0.2s;
}

#wm-ls-root .wm-ls-chevron.wm-ls-open {
    transform: rotate(180deg);
}

/* ── Archive Panel ───────────────────────────── */
#wm-ls-root .wm-ls-archive-panel {
    margin-top: 20px;
}

/* ── Year Filter ─────────────────────────────── */
#wm-ls-root .wm-ls-filter-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

#wm-ls-root .wm-ls-filter-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--wm-ls-text-muted);
}

#wm-ls-root .wm-ls-year-select {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--wm-ls-border);
    background: var(--wm-ls-bg-alt);
    font-size: 14px;
    color: var(--wm-ls-text);
    outline: none;
    transition: border-color 0.2s;
    font-family: var(--wm-ls-font);
    cursor: pointer;
}

#wm-ls-root .wm-ls-year-select:focus {
    border-color: var(--wm-ls-accent);
}

/* ── Archive Grid ────────────────────────────── */
#wm-ls-root .wm-ls-archive-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 640px) {
    #wm-ls-root .wm-ls-archive-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── Archive Card ────────────────────────────── */
#wm-ls-root .wm-ls-archive-card {
    display: block;
    width: 100%;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--wm-ls-border) !important;
    background: rgba(248, 250, 251, 0.65) !important;
    padding: 12px;
    text-decoration: none;
    color: inherit;
    text-align: left;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

#wm-ls-root .wm-ls-archive-card:hover {
    transform: translateY(-2px);
    border-color: rgba(107, 158, 143, 0.4) !important;
    box-shadow: var(--wm-ls-shadow-derek);
}

/* ── Archive Thumbnail ───────────────────────── */
#wm-ls-root .wm-ls-archive-thumb {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 6px;
    background: #1a1a1a;
}

#wm-ls-root .wm-ls-archive-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s;
}

#wm-ls-root .wm-ls-archive-card:hover .wm-ls-archive-img {
    transform: scale(1.02);
}

#wm-ls-root .wm-ls-archive-no-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 12px;
    color: var(--wm-ls-text-muted);
}

/* ── Archive Meta ────────────────────────────── */
#wm-ls-root .wm-ls-archive-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}

#wm-ls-root .wm-ls-archive-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--wm-ls-text);
    margin: 0;
    padding: 0;
    transition: color 0.2s;
    line-height: 1.3;
}

#wm-ls-root .wm-ls-archive-card:hover .wm-ls-archive-title {
    color: var(--wm-ls-accent);
}

#wm-ls-root .wm-ls-archive-year {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid var(--wm-ls-border);
    background: var(--wm-ls-bg);
    font-size: 12px;
    color: var(--wm-ls-text-muted);
    line-height: 1.5;
}

/* ── Empty State ─────────────────────────────── */
#wm-ls-root .wm-ls-archive-empty {
    margin-top: 16px;
    font-size: 14px;
    color: var(--wm-ls-text-muted);
}

/* ── Pagination ──────────────────────────────── */
#wm-ls-root .wm-ls-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

#wm-ls-root .wm-ls-page-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--wm-ls-border) !important;
    background: transparent !important;
    font-size: 14px;
    color: var(--wm-ls-text);
    transition: border-color 0.2s;
    font-family: var(--wm-ls-font);
}

#wm-ls-root .wm-ls-page-btn:hover:not(:disabled) {
    border-color: rgba(107, 158, 143, 0.5) !important;
}

#wm-ls-root .wm-ls-page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#wm-ls-root .wm-ls-page-info {
    font-size: 14px;
    color: var(--wm-ls-text-muted);
}

/* ── Screen Reader Only ──────────────────────── */
#wm-ls-root .wm-ls-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ==============================================
   LIGHTBOX
   ============================================== */
.wm-ls-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
}

.wm-ls-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    animation: wmLsFadeIn 0.2s ease;
}

.wm-ls-lightbox-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 24px;
}

.wm-ls-lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    z-index: 2;
    background: none !important;
    border: none !important;
    color: #fff !important;
    font-size: 36px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    padding: 8px;
    opacity: 0.7;
    transition: opacity 0.2s;
    font-family: 'Inter', sans-serif;
}

.wm-ls-lightbox-close:hover {
    opacity: 1;
}

.wm-ls-lightbox-video {
    width: 100%;
    max-width: 1100px;
    aspect-ratio: 16 / 9;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.wm-ls-lightbox-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

@keyframes wmLsFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ==============================================
   Responsive Fine-Tuning
   ============================================== */

@media (max-width: 480px) {
    #wm-ls-root .wm-ls-heading {
        font-size: 24px;
    }

    #wm-ls-root .wm-ls-archive-title {
        font-size: 14px;
    }

    #wm-ls-root .wm-ls-stream-card {
        padding: 12px;
    }

    #wm-ls-root .wm-ls-archive-card {
        padding: 10px;
    }

    .wm-ls-lightbox-content {
        padding: 12px;
    }

    .wm-ls-lightbox-close {
        top: 8px;
        right: 12px;
        font-size: 28px;
    }
}
