/**
 * SETTV YouTube Live Stream Styles v2
 * 
 * - Live badge on Videos tab
 * - Live card in videos grid
 * - Full-width live stream page
 */

:root {
    --settv-live-bg: #0a0a0a;
    --settv-live-surface: #141414;
    --settv-live-surface-hover: #1c1c1c;
    --settv-live-border: #262626;
    --settv-live-text: #ffffff;
    --settv-live-text-muted: #737373;
    --settv-live-accent: #ef4444;
    --settv-live-radius: 12px;
    --settv-live-radius-sm: 8px;
}

/* ============================================
   Live Badge (used everywhere)
   ============================================ */
.settv-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--settv-live-accent);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #fff;
    line-height: 1;
}

.settv-live-badge__dot {
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    animation: settv-pulse 1.5s ease-in-out infinite;
}

@keyframes settv-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

/* Badge in nav tab */
.settv-live-badge--tab {
    padding: 2px 6px;
    font-size: 9px;
    gap: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

.settv-live-badge--tab .settv-live-badge__dot {
    width: 6px;
    height: 6px;
}

/* ============================================
   Live Card (in videos grid)
   ============================================ */
.settv-live-card {
    margin-bottom: 1.5rem;
}

.settv-live-card__link {
    display: block;
    background: var(--settv-live-surface);
    border-radius: var(--settv-live-radius);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    border: 2px solid var(--settv-live-accent);
    transition: transform 0.2s, box-shadow 0.2s;
}

.settv-live-card__link:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(239, 68, 68, 0.3);
}

.settv-live-card__thumbnail {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}

.settv-live-card__thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.settv-live-card__overlay {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.settv-live-card__viewers {
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 4px;
    font-size: 12px;
    color: #fff;
}

.settv-live-card__play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 72px;
    height: 72px;
    background: rgba(239, 68, 68, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    opacity: 0;
    transition: opacity 0.2s;
}

.settv-live-card__link:hover .settv-live-card__play {
    opacity: 1;
}

.settv-live-card__play svg {
    margin-left: 4px; /* Visual centering for play icon */
}

.settv-live-card__info {
    padding: 1rem 1.25rem;
}

.settv-live-card__title {
    margin: 0 0 0.25rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--settv-live-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.settv-live-card__meta {
    margin: 0;
    font-size: 0.875rem;
    color: var(--settv-live-text-muted);
}

/* ============================================
   Full-Width Immersive Live Page
   ============================================ */
.settv-live-fullwidth-page {
    position: relative;
    min-height: calc(100vh - 60px); /* Account for mobile header */
    background: #000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Force mobile/compact site header on live pages - hide ALL desktop elements */
body.settv-live-page .beeteam368-top-menu,
body.settv-live-page .beeteam368-top-menu-control {
    display: none !important;
}

/* Hide the main nav links */
body.settv-live-page .beeteam368-main-nav {
    display: none !important;
}

/* Hide sticky duplicate when not active */
body.settv-live-page .beeteam368-main-menu.sticky-menu:not(.is-sticky) {
    display: none !important;
}

/* Hide mobile exit button on desktop */
.settv-live-exit-btn {
    display: none;
}

/* Show mobile elements on desktop for live page */
body.settv-live-page .beeteam368-logo-mobile,
body.settv-live-page .beeteam368-mobile-menu-btn,
body.settv-live-page .beeteam368-sidemenu-btn {
    display: block !important;
}

/* Keep only one main menu bar, compact height */
body.settv-live-page .beeteam368-main-menu:not(.sticky-menu) {
    padding: 0 !important;
}

body.settv-live-page .beeteam368-main-menu-row {
    min-height: 56px !important;
    height: 56px !important;
}

/* Header Bar - compact stream info bar */
.settv-live-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    height: 50px;
    background: var(--settv-live-surface);
    border-bottom: 1px solid var(--settv-live-border);
    flex-shrink: 0;
}

.settv-live-header__left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.settv-live-header__back {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--settv-live-text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 8px 12px;
    margin: -8px -12px;
    border-radius: 8px;
    transition: all 0.2s;
}

.settv-live-header__back:hover {
    color: var(--settv-live-text);
    background: rgba(255, 255, 255, 0.1);
}

.settv-live-header__artist {
    display: flex;
    align-items: center;
    gap: 10px;
}

.settv-live-header__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.settv-live-header__name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--settv-live-text);
}

.settv-live-header__youtube-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(255, 0, 0, 0.15);
    border-radius: 6px;
    color: #ff0000;
    transition: all 0.2s;
}

.settv-live-header__youtube-link:hover {
    background: rgba(255, 0, 0, 0.25);
    color: #ff0000;
}

.settv-live-header__right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.settv-live-header__viewers {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: var(--settv-live-text-muted);
}

.settv-live-header__offline-badge {
    padding: 4px 10px;
    background: var(--settv-live-border);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--settv-live-text-muted);
}

/* Title Bar */
.settv-live-titlebar {
    padding: 0.75rem 1.25rem;
    background: var(--settv-live-bg);
    border-bottom: 1px solid var(--settv-live-border);
    flex-shrink: 0;
}

.settv-live-titlebar__title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--settv-live-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Video + Chat Container */
.settv-live-container {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 400px;
    min-height: 500px;
    max-height: calc(100vh - 200px); /* Leave room for site header + stream bar */
}

.settv-live-video {
    position: relative;
    background: #000;
    min-height: 400px;
}

.settv-live-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Chat Panel */
.settv-live-chat {
    display: flex;
    flex-direction: column;
    background: var(--settv-live-surface);
    border-left: 1px solid var(--settv-live-border);
}

.settv-live-chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--settv-live-border);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--settv-live-text);
}

.settv-live-chat__close {
    display: none; /* Only shown on mobile */
    background: none;
    border: none;
    color: var(--settv-live-text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.settv-live-chat__close:hover {
    color: var(--settv-live-text);
    background: rgba(255, 255, 255, 0.1);
}

.settv-live-chat__frame {
    flex: 1;
    position: relative;
}

.settv-live-chat__frame iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.settv-live-chat__footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    font-size: 11px;
    color: var(--settv-live-text-muted);
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid var(--settv-live-border);
}

.settv-live-chat__youtube-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #ff0000;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.2s, transform 0.2s;
}

.settv-live-chat__youtube-btn:hover {
    background: #cc0000;
    color: #fff;
    transform: scale(1.02);
}

.settv-live-chat__youtube-btn svg {
    flex-shrink: 0;
}

.settv-live-chat__popout-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #ff0000;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    font-family: inherit;
}

.settv-live-chat__popout-btn:hover {
    background: #cc0000;
    color: #fff;
    transform: scale(1.02);
}

.settv-live-chat__popout-btn svg {
    flex-shrink: 0;
}

/* Mobile Chat Toggle (FAB) */
.settv-live-chat-toggle {
    display: none; /* Hidden on desktop */
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: var(--settv-live-accent);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
    z-index: 100;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.settv-live-chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 28px rgba(239, 68, 68, 0.5);
}

.settv-live-chat-toggle__count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #fff;
    color: var(--settv-live-accent);
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    display: none; /* Could show unread count */
}

/* Offline State */
.settv-live-offline {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--settv-live-bg);
    padding: 2rem;
}

.settv-live-offline__content {
    text-align: center;
    max-width: 500px;
}

.settv-live-offline__icon {
    color: var(--settv-live-text-muted);
    opacity: 0.25;
    margin-bottom: 2rem;
}

.settv-live-offline__title {
    margin: 0 0 1rem;
    font-size: 2rem;
    font-weight: 700;
    color: var(--settv-live-text);
}

.settv-live-offline__text {
    margin: 0 0 2.5rem;
    font-size: 1.125rem;
    color: var(--settv-live-text-muted);
    line-height: 1.6;
}

.settv-live-offline__actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buttons */
.settv-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.settv-btn--primary {
    background: var(--settv-live-accent);
    color: #fff;
}

.settv-btn--primary:hover {
    background: #dc2626;
    color: #fff;
}

.settv-btn--secondary {
    background: var(--settv-live-surface);
    color: var(--settv-live-text);
    border: 1px solid var(--settv-live-border);
}

.settv-btn--secondary:hover {
    background: var(--settv-live-surface-hover);
    color: var(--settv-live-text);
}

.settv-btn--youtube {
    background: #ff0000;
    color: #fff;
}

.settv-btn--youtube:hover {
    background: #cc0000;
    color: #fff;
}

/* ============================================
   Responsive: Tablet
   ============================================ */
@media (max-width: 1024px) {
    .settv-live-container {
        grid-template-columns: 1fr 320px;
    }
    
    .settv-live-header__back span {
        display: none;
    }
}

/* ============================================
   Responsive: Mobile
   ============================================ */
@media (max-width: 767px) {
    /* Make page scrollable on mobile instead of fixed fullscreen */
    .settv-live-fullwidth-page {
        position: relative;
        min-height: 100vh;
        height: auto;
    }
    
    /* Hide our header on mobile - cleaner like YouTube app */
    .settv-live-header {
        display: none;
    }
    
    .settv-live-header__left {
        gap: 0.5rem;
        flex: 1;
        min-width: 0; /* Allow text truncation */
    }
    
    .settv-live-header__back {
        padding: 8px;
        margin: -8px;
        flex-shrink: 0;
    }
    
    .settv-live-header__back span {
        display: none;
    }
    
    .settv-live-header__artist {
        display: flex;
        flex: 1;
        min-width: 0; /* Allow text truncation */
    }
    
    .settv-live-header__avatar {
        width: 32px;
        height: 32px;
        flex-shrink: 0;
    }
    
    .settv-live-header__name {
        font-size: 0.9375rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        min-width: 0;
        max-width: none; /* Let it use available space */
    }
    
    .settv-live-header__right {
        gap: 0.5rem;
        flex-shrink: 0;
    }
    
    .settv-live-header__viewers {
        font-size: 0.75rem;
    }
    
    .settv-live-badge__text {
        font-size: 10px;
    }
    
    .settv-live-titlebar {
        padding: 0.625rem 0.75rem;
    }
    
    /* Hide titlebar on mobile - YouTube shows title in player */
    .settv-live-titlebar {
        display: none;
    }
    
    .settv-live-container {
        display: flex;
        flex-direction: column;
        height: 100vh; /* Full viewport - no header */
        min-height: 100vh;
        overflow: hidden;
    }
    
    /* Hide site header on mobile live page */
    body.settv-live-page #beeteam368-site-header,
    body.settv-live-page .beeteam368-site-header,
    body.settv-live-page header.site-header {
        display: none !important;
    }
    
    .settv-live-video {
        aspect-ratio: 16 / 9;
        flex-shrink: 0;
        width: 100%;
    }
    
    /* Chat inline on mobile (not hidden) */
    .settv-live-chat {
        position: relative;
        transform: none;
        border-left: none;
        border-top: 1px solid var(--settv-live-border);
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0; /* Allow flex shrinking */
        margin-bottom: 16px;
    }
    
    .settv-live-chat__frame {
        flex: 1;
        position: relative;
        min-height: 0;
    }
    
    .settv-live-chat__frame iframe {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border: none;
    }
    
    .settv-live-chat__header {
        display: none; /* YouTube iframe has its own header */
    }
    
    .settv-live-chat__close {
        display: none;
    }
    
    /* Hide the FAB toggle since chat is inline */
    .settv-live-chat-toggle {
        display: none;
    }
    
    /* Mobile Exit Button */
    .settv-live-exit-btn {
        position: absolute;
        top: 12px;
        right: 12px;
        z-index: 100;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: rgba(0, 0, 0, 0.7);
        border-radius: 50%;
        color: #fff;
        text-decoration: none;
        transition: background 0.2s ease;
    }
    
    .settv-live-exit-btn:hover,
    .settv-live-exit-btn:active {
        background: rgba(0, 0, 0, 0.9);
        color: #fff;
    }
    
    .settv-live-video {
        position: relative; /* For exit button positioning */
    }
    
    /* Hide footer on mobile live page */
    body.settv-live-page #site-footer,
    body.settv-live-page .site-footer,
    body.settv-live-page .djset-footer-main,
    body.settv-live-page .djset-footer,
    body.settv-live-page .footer-copyright,
    body.settv-live-page footer {
        display: none !important;
    }
    
    .settv-live-offline {
        padding: 2rem 1.5rem;
        min-height: 60vh;
    }
    
    .settv-live-offline__icon svg {
        width: 64px;
        height: 64px;
    }
    
    .settv-live-offline__title {
        font-size: 1.5rem;
    }
    
    .settv-live-offline__text {
        font-size: 1rem;
    }
    
    .settv-live-offline__actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .settv-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .settv-live-header {
        padding: 0 0.5rem;
    }
    
    .settv-live-header__artist {
        display: flex;
        gap: 6px;
    }
    
    .settv-live-header__avatar {
        width: 28px;
        height: 28px;
    }
    
    .settv-live-header__name {
        font-size: 0.875rem;
        max-width: none; /* No limit - let flexbox handle it */
    }
    
    .settv-live-header__viewers svg {
        display: none;
    }
    
    .settv-live-badge {
        padding: 3px 6px;
    }
    
    .settv-live-badge__text {
        font-size: 9px;
    }
    
    .settv-live-titlebar__title {
        font-size: 0.8125rem;
    }
    
    /* Hide footer on mobile live page */
    body.settv-live-page #site-footer,
    body.settv-live-page .site-footer,
    body.settv-live-page .djset-footer-main,
    body.settv-live-page .djset-footer,
    body.settv-live-page .footer-copyright,
    body.settv-live-page footer {
        display: none !important;
    }
}

/* ============================================
   Picture-in-Picture / Mini Player
   ============================================ */

/* PiP Button in header */
.settv-live-pip-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: var(--settv-live-text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.settv-live-pip-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--settv-live-text);
}

.settv-live-pip-btn.active {
    background: var(--settv-live-accent);
    color: #fff;
}

/* Mini Player */
.settv-mini-player {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 400px;
    background: var(--settv-live-surface);
    border-radius: var(--settv-live-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
}

.settv-mini-player.active {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.settv-mini-player__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.3);
    cursor: move;
    user-select: none;
}

.settv-mini-player__title {
    font-size: 12px;
    font-weight: 600;
    color: var(--settv-live-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 10px;
}

.settv-mini-player__controls {
    display: flex;
    gap: 4px;
}

.settv-mini-player__expand,
.settv-mini-player__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 6px;
    color: var(--settv-live-text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.settv-mini-player__expand:hover,
.settv-mini-player__close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--settv-live-text);
}

.settv-mini-player__close:hover {
    background: var(--settv-live-accent);
    color: #fff;
}

.settv-mini-player__video {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}

.settv-mini-player__video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Container state when minimized */
.settv-live-container--minimized {
    opacity: 0.3;
    pointer-events: none;
}

.settv-live-container--minimized::after {
    content: 'Playing in mini-player';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 16px 24px;
    background: var(--settv-live-surface);
    border-radius: var(--settv-live-radius);
    color: var(--settv-live-text);
    font-size: 14px;
    font-weight: 500;
}

/* Mobile: smaller mini-player */
@media (max-width: 480px) {
    .settv-mini-player {
        width: calc(100% - 32px);
        right: 16px;
        bottom: 16px;
    }
}

/* Hide PiP button on very small screens */
@media (max-width: 360px) {
    .settv-live-pip-btn {
        display: none;
    }
}