 /* =============================================
   REELS / VIDEOS PAGE — TikTok Full-Screen Layout
   All zones use absolute positioning for reliability
   ============================================= */

/* ── 1. Body in reels mode: no scroll, no margin/padding ── */
body.reels-page {
    background: #f0f2f5 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

/* ── 2. Hide ALL site chrome in reels mode (mobile) ── */
body.reels-page .th_left,
body.reels-page .th_right,
body.reels-page .rightSticky,
body.reels-page header,
body.reels-page .header,
body.reels-page .tt-header,
body.reels-page #tt-header,
body.reels-page .tt-bottom-nav,
body.reels-page nav.tt-bottom-nav,
body.reels-page #tt-bottom-nav,
body.reels-page .mobile-bottom-menu,
body.reels-page .greetalert {
    display: none !important;
}

/* Show mobile footer on mobile devices */
@media (max-width: 768px) {
    body.reels-page .mobile_footer_fixed_menu_container {
        display: flex !important;
        visibility: visible !important;
        z-index: 1000 !important;
    }
}

/* Custom bottom navigation for reels on mobile ONLY */
.reels-bottom-nav {
    display: none !important;
}

@media (max-width: 768px) {
    .reels-bottom-nav {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 60px !important;
        background: #fff !important;
        border-top: 1px solid #e1e8ed !important;
        display: flex !important;
        justify-content: space-around !important;
        align-items: center !important;
        z-index: 999 !important;
    }
    
    .reels-bottom-nav a {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 4px !important;
        text-decoration: none !important;
        color: #65676b !important;
        font-size: 12px !important;
        flex: 1 !important;
        height: 100% !important;
        transition: all 0.2s !important;
    }
    
    .reels-bottom-nav a:hover,
    .reels-bottom-nav a.active {
        color: #000 !important;
    }
    
    .reels-bottom-nav svg {
        width: 24px !important;
        height: 24px !important;
    }
}

/* Extra specificity for mobile nav */
body.reels-page nav[role="navigation"] {
    display: none !important;
}

/* CRITICAL FIX: Don't hide .wrapper — collapse it to 0 so the fixed reels-container can still escape */
body.reels-page .wrapper {
    height: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
}

body.reels-page .leftSticky {
    display: none !important;
}

body.reels-page .th_middle,
body.reels-page .pageMiddle {
    height: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
}

/* ── 3. Reels outer container: fixed full-screen, centered layout ── */
.reels-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: #000 !important;
    z-index: 9999 !important;
    overflow: visible !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
}

/* ── 4. Each reel slide ── */
.reel-item {
    position: relative !important;
    width: 100% !important;
    height: 100vh !important;
    background: #000 !important;
    overflow: visible !important;
    display: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Show only the active reel */
.reel-item.active {
    display: block !important;
    width: 100% !important;
    max-width: 360px !important;
    height: 640px !important;
    border-radius: 20px !important;
    box-shadow: 0 8px 40px rgba(0,0,0,0.3) !important;
}

/* ── 5. Video element: fills slide ── */
.reel-video {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    z-index: 1 !important;
    cursor: pointer !important;
    display: block !important;
    border-radius: 20px !important;
}

/* ── 6. TOP BAR (absolute) ── */
.reel-top-bar {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 20 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 10px 12px !important;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 100%) !important;
}

.reel-back-btn {
    display: none !important;
}

.reel-title-wrap {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    pointer-events: none !important;
}

.reel-title {
    color: #fff !important;
    font-size: 15px !important;
    font-weight: 700 !important;
}

.reel-sound-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    background: rgba(0,0,0,0.4) !important;
    border: none !important;
    border-radius: 50% !important;
    color: #fff !important;
    cursor: pointer !important;
    padding: 0 !important;
    z-index: 21 !important;
}

.reel-sound-btn svg {
    width: 16px !important;
    height: 16px !important;
    stroke: #fff !important;
    fill: none !important;
    display: block !important;
}

.reel-sound-btn .unmuted-icon { display: none !important; }
.reel-sound-btn.unmuted .muted-icon { display: none !important; }
.reel-sound-btn.unmuted .unmuted-icon { display: block !important; }

/* ── 8. ACTION BUTTONS INSIDE REEL (hide them - we'll create new ones outside) ── */
.reel-actions {
    display: none !important;
}

/* ── EXTERNAL ACTION BUTTONS (created in htmlPosts.php, positioned outside) ── */
.reel-actions-external {
    position: fixed !important;
    right: 16px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 100 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 12px !important;
    pointer-events: auto !important;
}

/* Desktop: move buttons to the right side, away from navigation */
@media (min-width: 1024px) {
    .reel-actions-external {
        right: 180px !important;
        top: 50% !important;
        left: auto !important;
        bottom: auto !important;
        transform: translateY(-50%) !important;
        flex-direction: column !important;
        gap: 16px !important;
        background: transparent !important;
        padding: 0 !important;
        border-radius: 0 !important;
        width: auto !important;
    }
}

.reel-action-btn {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 4px !important;
    background: none !important;
    border: none !important;
    color: #fff !important;
    cursor: pointer !important;
    padding: 6px !important;
    min-width: 48px !important;
    text-align: center !important;
    -webkit-tap-highlight-color: transparent !important;
    z-index: 21 !important;
}

.reel-action-btn svg {
    width: 28px !important;
    height: 28px !important;
    fill: #fff !important;
    color: #fff !important;
    display: block !important;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)) !important;
}

.reel-action-btn .action-count {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #fff !important;
    line-height: 1 !important;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5) !important;
}

/* Liked state */
.reel-action-btn.liked svg {
    fill: #ff4060 !important;
    color: #ff4060 !important;
}

.reel-action-btn.liked .action-count {
    color: #ff4060 !important;
}

/* ── 9. BOTTOM INFO (absolute) ── */
.reel-bottom-info {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 20 !important;
    padding: 12px 12px 14px !important;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent 100%) !important;
    max-height: 100px !important;
}

.reel-bottom-info.expanded {
    max-height: none !important;
}

.reel-description {
    font-size: 12px !important;
    color: #fff !important;
    line-height: 1.3 !important;
    margin-bottom: 6px !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 1 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    cursor: pointer !important;
    word-break: break-word !important;
}

.reel-description.expanded {
    display: block !important;
    -webkit-line-clamp: unset !important;
}

.reel-description::after {
    content: " ...see more" !important;
    color: #aaa !important;
    font-weight: 600 !important;
}

.reel-description.expanded::after {
    content: " ...see less" !important;
}

/* ── 10. Progress bar ── */
.reel-progress-wrap {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.reel-progress-bar-bg {
    flex: 1 !important;
    height: 2px !important;
    background: rgba(255,255,255,0.3) !important;
    border-radius: 2px !important;
    overflow: hidden !important;
    cursor: pointer !important;
}

.reel-progress-bar-fill {
    height: 100% !important;
    background: #ff4060 !important;
    border-radius: 2px !important;
    width: 0% !important;
    transition: width 0.1s linear !important;
}

.reel-time {
    font-size: 10px !important;
    color: rgba(255,255,255,0.7) !important;
    white-space: nowrap !important;
}

/* ── 11. Tap-to-play icon ── */
.reel-play-pulse {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) scale(0) !important;
    width: 60px !important;
    height: 60px !important;
    background: rgba(0,0,0,0.4) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 5 !important;
    pointer-events: none !important;
    opacity: 0 !important;
    transition: opacity 0.2s, transform 0.2s !important;
}

.reel-play-pulse.show {
    opacity: 1 !important;
    transform: translate(-50%, -50%) scale(1) !important;
}

.reel-play-pulse svg { width: 28px !important; height: 28px !important; fill: #fff !important; }

/* ── 12. Tap-to-play hint ── */
.reel-tap-hint {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 8px !important;
    z-index: 50 !important;
    pointer-events: none !important;
    color: #fff !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8) !important;
}

.reel-tap-hint svg {
    width: 48px !important;
    height: 48px !important;
    fill: #fff !important;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6)) !important;
}

/* ── COMMENTS SIDEBAR ── */
/* ── COMMENTS SIDEBAR (disabled) ── */
.reel-comments-sidebar {
    display: none !important;
}

.reel-comments-sidebar.open {
    transform: translateX(0) !important;
}

/* Comment sheet overlay */
.reel-comment-sheet-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: transparent !important;
    z-index: 9999 !important;
    opacity: 0 !important;
    transition: opacity 0.3s !important;
    pointer-events: none !important;
}

.reel-comment-sheet-overlay.visible {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Comment sheet */
.reel-comment-sheet {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: #1a1a1a !important;
    z-index: 10000 !important;
    border-radius: 16px 16px 0 0 !important;
    display: flex !important;
    flex-direction: column !important;
    height: 80vh !important;
    max-height: 80vh !important;
    transform: translateY(100%) !important;
    transition: transform 0.3s ease !important;
}

.reel-comment-sheet.open {
    transform: translateY(0) !important;
}

.reel-comments-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 14px 16px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    flex-shrink: 0 !important;
}

.reel-comments-title {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #fff !important;
}

.reel-comments-list {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 12px 12px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
}

.reel-comments-list::-webkit-scrollbar {
    width: 4px !important;
}

.reel-comments-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2) !important;
    border-radius: 4px !important;
}

.reel-comments-loading {
    text-align: center !important;
    color: rgba(255, 255, 255, 0.5) !important;
    font-size: 13px !important;
    padding: 20px 0 !important;
}

.reel-comments-input-wrap {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 10px 12px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    flex-shrink: 0 !important;
}

.reel-comments-input {
    flex: 1 !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 18px !important;
    padding: 8px 12px !important;
    font-size: 12px !important;
    color: #fff !important;
    outline: none !important;
}

.reel-comments-input:focus {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
}

.reel-comments-input::placeholder {
    color: rgba(255, 255, 255, 0.4) !important;
}

.reel-comments-send {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    background: #ff4060 !important;
    border: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    transition: transform 0.15s !important;
}

.reel-comments-send:active {
    transform: scale(0.9) !important;
}

.reel-comments-send svg {
    width: 16px !important;
    height: 16px !important;
    fill: #fff !important;
}

/* Comment item styling */
.reel-comment-item {
    display: flex !important;
    gap: 8px !important;
    align-items: flex-start !important;
}

.reel-comment-avatar {
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    flex-shrink: 0 !important;
}

.reel-comment-bubble {
    background: rgba(255, 255, 255, 0.1) !important;
    border-radius: 10px !important;
    padding: 8px 10px !important;
    flex: 1 !important;
}

.reel-comment-user {
    font-size: 12px !important;
    font-weight: 700 !important;
    color: #fff !important;
    margin-bottom: 2px !important;
}

.reel-comment-text {
    font-size: 12px !important;
    color: #f0f0f0 !important;
    line-height: 1.4 !important;
}

.reel-server-comments {
    color: rgba(255, 255, 255, 0.9) !important;
}

.reel-server-comments .i_comment_box,
.reel-server-comments .comment_box {
    background: rgba(255, 255, 255, 0.08) !important;
    border-radius: 8px !important;
    margin-bottom: 8px !important;
    padding: 6px 10px !important;
    border: none !important;
    font-size: 12px !important;
}

.reel-server-comments .i_user_img,
.reel-server-comments .i_comment_avatar img {
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
}

.reel-server-comments .i_comment_options,
.reel-server-comments .comment_options {
    display: none !important;
}

/* Like button animation */
@keyframes reel-like-pop {
    0% { transform: scale(1); }
    40% { transform: scale(1.4); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

.reel-action-btn.like-pop svg {
    animation: reel-like-pop 0.35s ease-out !important;
}

/* ── DESKTOP LAYOUT: Show left sidebar menu ── */
@media (min-width: 1024px) {
    body.reels-page {
        background: #fff !important;
        display: flex !important;
    }

    /* Show the left menu */
    body.reels-page .th_left,
    body.reels-page .leftSticky {
        display: block !important;
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        width: 280px !important;
        height: 100vh !important;
        z-index: 9998 !important;
        overflow-y: auto !important;
        background: #fff !important;
        border-right: 1px solid #e1e8ed !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body.reels-page .leftSticky .sidebar_logo,
    body.reels-page .th_left .sidebar_logo {
        padding: 16px 20px !important;
        border-bottom: 1px solid #e1e8ed !important;
    }

    body.reels-page .leftSticky .sidebar_menu,
    body.reels-page .th_left .sidebar_menu {
        padding: 16px 0 !important;
    }

    body.reels-page .leftSticky .sidebar_menu a,
    body.reels-page .th_left .sidebar_menu a {
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
        padding: 12px 20px !important;
        color: #333 !important;
        text-decoration: none !important;
        transition: all 0.2s !important;
        font-size: 14px !important;
        font-weight: 500 !important;
    }

    body.reels-page .leftSticky .sidebar_menu a:hover,
    body.reels-page .th_left .sidebar_menu a:hover {
        background: #f0f2f5 !important;
        color: #000 !important;
    }

    body.reels-page .leftSticky .sidebar_menu a.active,
    body.reels-page .th_left .sidebar_menu a.active {
        color: #ff4060 !important;
        border-left: 4px solid #ff4060 !important;
        padding-left: 16px !important;
    }

    body.reels-page .leftSticky .sidebar_menu svg,
    body.reels-page .th_left .sidebar_menu svg {
        width: 20px !important;
        height: 20px !important;
        flex-shrink: 0 !important;
    }

    /* Reels container takes remaining space */
    .reels-container {
        position: fixed !important;
        left: 280px !important;
        top: 0 !important;
        width: calc(100vw - 280px) !important;
        height: 100vh !important;
        background: #000 !important;
        z-index: 9999 !important;
        overflow: hidden !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}
