/* ============================================================
   LIVE VIDEO - FULL SCREEN IMMERSIVE UI
   Overrides Sngine's style.min.css completely
   ============================================================ */

:root {
    --live-bg: #0a0a0a;
    --live-glass: rgba(255, 255, 255, 0.1);
    --live-glass-border: rgba(255, 255, 255, 0.15);
    --live-red: #ff3b30;
    --live-green: #34c759;
}

/* ============================================================
   WRAPPER - True full-screen fixed overlay
   style.css sets: padding:20px/50px, border-radius:16px, bg:#323232
   We must kill ALL of that.
   ============================================================ */
.live-stream-wrapper {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: var(--live-bg) !important;
    overflow: hidden !important;
    z-index: 999999 !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    display: block !important;
}

body.night-mode .live-stream-wrapper {
    background: var(--live-bg) !important;
}

/* Kill the desktop padding media query from style.css */
@media (min-width: 992px) {
    .live-stream-wrapper {
        padding: 0 !important;
    }
}

/* ============================================================
   VIDEO CONTAINER
   style.css sets: height: 500px (the root cause of tiny video!)
   ============================================================ */
.live-stream-video {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: #000 !important;
    z-index: 1 !important;
}

/* ============================================================
   VIDEO PLAYER
   style.css sets: border-radius:16px, height:auto!important on video
   ============================================================ */
.live-stream-video .live-video-player {
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    background: #000 !important;
    border-radius: 0 !important;
}

.live-stream-video .live-video-player div {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
}

.live-stream-video .live-video-player video {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
    border-radius: 0 !important;
    background: #000 !important;
    transform: none !important;
}

/* ============================================================
   TITLE BAR - Close | Live label (left) ... Action buttons (right)
   style.css sets: font-size:34px, line-height:50px, margin-bottom:10px
   ============================================================ */
.live-stream-title {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 50 !important;
    color: white !important;
    font-size: 15px !important;
    line-height: normal !important;
    margin: 0 !important;
    padding: 12px 16px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.3) 70%, transparent 100%) !important;
    width: auto !important;
    border: none !important;
}

/* Left group: Close + Live label */
.live-title-left {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

/* Close / Back button */
.btn-live-close {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.15) !important;
    color: white !important;
    text-decoration: none !important;
    font-size: 16px !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    transition: all 0.2s !important;
}

.btn-live-close:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    color: white !important;
    transform: scale(1.05) !important;
}

/* Live label text */
.live-label {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: white !important;
    letter-spacing: 0.5px !important;
}

/* Right group: Action buttons */
.live-title-right {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
}

.live-stream-title .main-icon {
    display: none !important;
}

/* Style the toggle buttons (Enable Tips, Subscribers Only, etc.) */
.live-stream-title .btn-check + .btn-outline-info {
    font-size: 11px !important;
    padding: 5px 12px !important;
    border-radius: 20px !important;
    backdrop-filter: blur(10px) !important;
    background: rgba(255,255,255,0.12) !important;
    border-color: rgba(255,255,255,0.25) !important;
    color: white !important;
    white-space: nowrap !important;
}

.live-stream-title .btn-check:checked + .btn-outline-info {
    background: rgba(13, 202, 240, 0.3) !important;
    border-color: rgba(13, 202, 240, 0.6) !important;
    color: white !important;
}

/* Go Live button */
.btn-live-start {
    background: var(--live-green) !important;
    color: white !important;
    border: none !important;
    font-size: 14px !important;
    padding: 8px 20px !important;
    border-radius: 25px !important;
    font-weight: 600 !important;
}

.btn-live-start:hover {
    background: #2db84e !important;
    box-shadow: 0 0 20px rgba(52, 199, 89, 0.4) !important;
}

/* End button */
.btn-live-end {
    background: var(--live-red) !important;
    color: white !important;
    border: none !important;
    font-size: 14px !important;
    padding: 8px 20px !important;
    border-radius: 25px !important;
    font-weight: 600 !important;
}

.btn-live-end:hover {
    background: #e8352b !important;
    box-shadow: 0 0 20px rgba(255, 59, 48, 0.4) !important;
}

/* ============================================================
   COUNTER (ONLINE/OFFLINE badge + viewer count)
   style.css sets: compound .live-stream-video .live-counter
   ============================================================ */
.live-stream-video .live-counter {
    position: absolute !important;
    top: 65px !important;
    left: 20px !important;
    z-index: 50 !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    background: rgba(0,0,0,0.5) !important;
    padding: 5px 12px !important;
    border-radius: 20px !important;
    backdrop-filter: blur(10px) !important;
}

.live-stream-video .live-counter .status {
    background: var(--live-red) !important;
    color: white !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    padding: 3px 10px !important;
    border-radius: 12px !important;
    text-transform: uppercase !important;
}

.live-stream-video .live-counter .status.offline {
    background: rgba(100,100,100,0.8) !important;
}

.live-stream-video .live-counter .number {
    color: white !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    display: flex !important;
    align-items: center !important;
    background: transparent !important;
    padding: 0 !important;
    margin-left: 4px !important;
    border-radius: 0 !important;
}

/* ============================================================
   STATUS MESSAGE (the blue/green/red notification box)
   style.css uses: .live-stream-video .live-status (MORE specific)
   This is the huge blue "You are ready to Go Live now" box
   ============================================================ */
.live-stream-video .live-status {
    position: absolute !important;
    top: 50% !important;
    bottom: auto !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    padding: 12px 24px !important;
    background: rgba(0,0,0,0.7) !important;
    color: white !important;
    text-align: center !important;
    border-radius: 30px !important;
    z-index: 50 !important;
    backdrop-filter: blur(15px) !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    width: auto !important;
    max-width: 85% !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
}

.live-stream-video .live-status.info {
    background: rgba(17, 113, 239, 0.6) !important;
    border-color: rgba(17, 113, 239, 0.3) !important;
}

.live-stream-video .live-status.success {
    background: rgba(40, 167, 69, 0.6) !important;
    border-color: rgba(40, 167, 69, 0.3) !important;
}

.live-stream-video .live-status.error {
    background: rgba(220, 53, 69, 0.6) !important;
    border-color: rgba(220, 53, 69, 0.3) !important;
}

/* ============================================================
   RECORDING BADGE
   style.css uses: .live-stream-video .live-recording
   ============================================================ */
.live-stream-video .live-recording {
    position: absolute !important;
    top: 65px !important;
    right: 20px !important;
    left: auto !important;
    z-index: 50 !important;
    background: rgba(255, 0, 0, 0.2) !important;
    color: #ff4444 !important;
    padding: 5px 12px !important;
    border-radius: 20px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 0, 0, 0.3) !important;
}

/* ============================================================
   COMMENTS OVERLAY
   style.css uses: .live-stream-video .live-comments
   ============================================================ */
.live-stream-video .live-comments {
    position: absolute !important;
    bottom: 120px !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 280px !important;
    padding: 20px !important;
    z-index: 40 !important;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent) !important;
    background-image: none !important;
    border-radius: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 20%, black 100%);
    mask-image: linear-gradient(to bottom, transparent 0%, black 20%, black 100%);
}

.live-stream-video .live-comments ul {
    height: 100% !important;
    overflow-y: auto !important;
    pointer-events: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
}

@keyframes liveCommentFadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.live-stream-video .live-comments li {
    margin-bottom: 8px !important;
    animation: liveCommentFadeInUp 0.3s ease-out forwards;
}

.live-stream-video .live-comments .comment {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}

.live-stream-video .live-comments .comment-data {
    display: inline-block !important;
    background: rgba(0,0,0,0.35) !important;
    padding: 5px 12px !important;
    border-radius: 16px !important;
    backdrop-filter: blur(4px) !important;
}

.live-stream-video .live-comments .comment-text {
    color: white !important;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8) !important;
    font-size: 14px !important;
}

.live-stream-video .live-comments .comment-author {
    color: rgba(255,255,255,0.9) !important;
    font-weight: 600 !important;
}

.live-stream-video .live-comments .comment-actions,
.live-stream-video .live-comments .comment-replies {
    display: none !important;
}

/* ============================================================
   CONTROL BUTTONS BAR
   style.css sets: display:none, text-align:center, margin-top:20px
   ============================================================ */
.live-stream-buttons {
    position: absolute !important;
    bottom: 50px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    display: flex !important;
    gap: 12px !important;
    z-index: 50 !important;
    background: var(--live-glass) !important;
    padding: 10px 20px !important;
    border-radius: 40px !important;
    backdrop-filter: blur(15px) !important;
    border: 1px solid var(--live-glass-border) !important;
    margin: 0 !important;
    text-align: center !important;
}

.live-stream-buttons button,
.live-stream-buttons .btn {
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(255,255,255,0.15) !important;
    color: white !important;
    border: none !important;
    transition: all 0.2s !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 16px !important;
}

.live-stream-buttons button:hover,
.live-stream-buttons .btn:hover {
    background: rgba(255,255,255,0.3) !important;
    transform: scale(1.1) !important;
}

/* ============================================================
   PiP MODE
   ============================================================ */
.live-stream-wrapper.pip-mode {
    width: 160px !important;
    height: 240px !important;
    bottom: 20px !important;
    right: 20px !important;
    top: auto !important;
    left: auto !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5) !important;
    cursor: move !important;
}

.live-stream-wrapper.pip-mode .live-comments,
.live-stream-wrapper.pip-mode .live-stream-title,
.live-stream-wrapper.pip-mode .live-stream-buttons,
.live-stream-wrapper.pip-mode .live-status,
.live-stream-wrapper.pip-mode .live-counter,
.live-stream-wrapper.pip-mode .live-recording {
    display: none !important;
}

/* ============================================================
   TIPS WRAPPER
   ============================================================ */
.live-stream-tips-wrapper {
    background: rgba(0,0,0,0.5) !important;
    padding: 8px 14px !important;
    border-radius: 20px !important;
    margin-top: 6px !important;
    font-size: 12px !important;
    color: white !important;
    backdrop-filter: blur(10px) !important;
}

/* ============================================================
   MOBILE RESPONSIVE OVERRIDES
   ============================================================ */
@media (max-width: 768px) {
    .live-stream-title {
        padding: 10px 10px !important;
        font-size: 13px !important;
    }

    .live-title-left {
        gap: 8px !important;
    }

    .btn-live-close {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
    }

    .live-label {
        font-size: 14px !important;
    }

    .live-title-right {
        gap: 5px !important;
    }

    .btn-live-start,
    .btn-live-end {
        font-size: 11px !important;
        padding: 5px 12px !important;
    }

    .live-stream-title .btn-check + .btn-outline-info {
        font-size: 9px !important;
        padding: 3px 8px !important;
    }

    .live-stream-video .live-counter {
        top: 50px !important;
        left: 10px !important;
    }

    .live-stream-video .live-counter .status {
        font-size: 9px !important;
        padding: 2px 7px !important;
    }

    .live-stream-video .live-counter .number {
        font-size: 11px !important;
    }

    .live-stream-video .live-recording {
        top: 50px !important;
        right: 10px !important;
        font-size: 10px !important;
    }

    .live-stream-video .live-comments {
        bottom: 100px !important;
        height: 180px !important;
        padding: 10px !important;
    }

    .live-stream-buttons {
        bottom: 35px !important;
        padding: 8px 12px !important;
        gap: 6px !important;
    }

    .live-stream-buttons button,
    .live-stream-buttons .btn {
        width: 36px !important;
        height: 36px !important;
        font-size: 13px !important;
    }

    .live-stream-video .live-status {
        font-size: 13px !important;
        padding: 10px 18px !important;
        max-width: 90% !important;
    }
}

/* ============================================================
   HIDE SITE CHROME WHEN LIVE IS ACTIVE
   The JS in live.tpl moves .live-stream-wrapper to body,
   but we also need to make sure nothing peeks through.
   ============================================================ */
body:has(.live-stream-wrapper) .main-header,
body:has(.live-stream-wrapper) .main-footer,
body:has(.live-stream-wrapper) .bottom-navbar {
    z-index: 1 !important;
}

/* ============================================================
   STORIES & HOMEPAGE FEED OPTIMIZATIONS (non-live pages)
   ============================================================ */
.stories-wrapper {
    padding: 10px 5px !important;
}

#stories .story, #stories .add-story {
    transform: scale(0.9);
    transform-origin: left center;
    margin-right: -8px !important;
}

@media (max-width: 768px) {
    .sg-offcanvas-mainbar .card {
        margin-bottom: 12px;
        border-radius: 12px !important;
    }

    .sg-offcanvas-mainbar .card-header {
        padding: 12px 15px !important;
    }

    .sg-offcanvas-mainbar .card-body {
        padding: 12px 15px !important;
    }

    .pro-box-wrapper .user-box {
        width: 75px !important;
        margin-right: 10px !important;
    }
    .pro-box-wrapper .user-box img {
        width: 50px !important;
        height: 50px !important;
    }
    .pro-box-wrapper .user-box .name {
        font-size: 0.8rem !important;
    }
}

/* ============================================================
   LIVE VIEWER (Watcher) - Full Screen Immersive
   This targets the lightbox-live template in _js_templates.tpl
   ============================================================ */

/* Override the default lightbox to be full-screen for live */
.live-viewer-lightbox {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
    background: #000 !important;
    display: flex !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
}

/* Remove default lightbox container styling */
.live-viewer-lightbox .lightbox-container,
.live-viewer-wrapper {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #000 !important;
    position: relative !important;
}

/* Full screen video for viewer */
.live-viewer-video {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: #000 !important;
    z-index: 1 !important;
}

/* Target ONLY the streaming provider's injected video divs, NOT our UI overlays */
.live-viewer-video > div:not(.live-viewer-close):not(.live-counter):not(.live-status):not(.live-viewer-comments) {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
}

.live-viewer-video > div:not(.live-viewer-close):not(.live-counter):not(.live-status):not(.live-viewer-comments) div {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
}

.live-viewer-video video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 0 !important;
}

/* Close button for viewer - top left */
.live-viewer-close {
    position: absolute !important;
    top: 15px !important;
    left: 15px !important;
    z-index: 100 !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    background: rgba(0, 0, 0, 0.5) !important;
    color: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 18px !important;
    cursor: pointer !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    transition: all 0.2s !important;
}

.live-viewer-close:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    transform: scale(1.1) !important;
}

/* Viewer counter - top right */
.live-viewer-video .live-counter {
    position: absolute !important;
    top: 15px !important;
    right: 15px !important;
    left: auto !important;
    z-index: 100 !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    background: rgba(0,0,0,0.5) !important;
    padding: 5px 12px !important;
    border-radius: 20px !important;
    backdrop-filter: blur(10px) !important;
}

/* Viewer status message */
.live-viewer-video .live-status {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    padding: 12px 24px !important;
    background: rgba(0,0,0,0.7) !important;
    color: white !important;
    text-align: center !important;
    border-radius: 30px !important;
    z-index: 100 !important;
    backdrop-filter: blur(15px) !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    width: auto !important;
    max-width: 85% !important;
    font-size: 14px !important;
}

/* Floating comments overlay at bottom */
.live-viewer-comments {
    position: absolute !important;
    bottom: 20px !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 50 !important;
    height: 50% !important;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 60%, transparent 100%) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
    padding: 15px !important;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 100%);
    mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 100%);
}

.live-viewer-post {
    max-height: 100% !important;
    overflow-y: auto !important;
}

/* Style comments inside viewer */
.live-viewer-comments .post,
.live-viewer-comments .card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.live-viewer-comments .post-header .name a,
.live-viewer-comments .post-header .name {
    color: white !important;
    font-weight: 600 !important;
}

.live-viewer-comments .post-header .info {
    color: rgba(255,255,255,0.6) !important;
}

.live-viewer-comments .post-text,
.live-viewer-comments .post-text p {
    color: rgba(255,255,255,0.9) !important;
}

.live-viewer-comments .comment {
    background: transparent !important;
    border: none !important;
}

.live-viewer-comments .comment-data {
    background: rgba(255,255,255,0.1) !important;
    border-radius: 16px !important;
    padding: 6px 12px !important;
}

.live-viewer-comments .comment-text {
    color: white !important;
}

.live-viewer-comments .comment-author a {
    color: rgba(255,255,255,0.9) !important;
    font-weight: 600 !important;
}

.live-viewer-comments .card-header,
.live-viewer-comments .card-footer {
    background: transparent !important;
    border-color: rgba(255,255,255,0.1) !important;
}

/* Comment input area styling */
.live-viewer-comments .comment-form,
.live-viewer-comments .write-comment {
    background: rgba(255,255,255,0.1) !important;
    border-radius: 25px !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
}

.live-viewer-comments .comment-form input,
.live-viewer-comments .comment-form textarea,
.live-viewer-comments [contenteditable] {
    color: white !important;
    background: transparent !important;
}

.live-viewer-comments .comment-form input::placeholder,
.live-viewer-comments .comment-form textarea::placeholder {
    color: rgba(255,255,255,0.5) !important;
}

/* Icons inside comment form */
.live-viewer-comments .comment-form .btn,
.live-viewer-comments .comment-form a,
.live-viewer-comments .comment-form i {
    color: rgba(255,255,255,0.7) !important;
}

/* Hide unnecessary elements in viewer */
.live-viewer-comments .post-actions,
.live-viewer-comments .post-stats,
.live-viewer-comments .reactions-wrapper {
    display: none !important;
}

/* Mobile responsive for viewer */
@media (max-width: 768px) {
    .live-viewer-close {
        top: 10px !important;
        left: 10px !important;
        width: 36px !important;
        height: 36px !important;
        font-size: 16px !important;
    }

    .live-viewer-video .live-counter {
        top: 10px !important;
        right: 10px !important;
    }

    .live-viewer-comments {
        bottom: 25px !important;
        height: 55% !important;
        padding: 10px !important;
    }
}
