/* Instagram-Style Reels CSS - Premium Dark Theme */

.reel-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100dvh;
    background-color: #000;
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    overscroll-behavior: none;
}

.reel-container {
    width: 100%;
    max-width: 450px;
    height: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    position: relative;
    background: #000;
    overscroll-behavior: contain;
}

.reel-container::-webkit-scrollbar {
    display: none;
}

.reel-item {
    width: 100%;
    height: 100dvh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
}

.reel-content-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #000;
    overflow: hidden;
}

.reel-video-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.reel-video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Maintain ratio on desktop */
}

/* Base Gradient for text legibility */
.reel-video-wrapper::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    pointer-events: none;
    z-index: 2;
}

/* Sidebar Actions - Glassmorphism & Contrast */
.reel-sidebar {
    position: absolute;
    right: 16px;
    bottom: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    z-index: 10;
}

.reel-action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #fff;
    cursor: pointer;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s ease;
}

.reel-action-item i {
    font-size: 23px;
    margin-bottom: 2px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.reel-action-count {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

.heart-active {
    color: #ff3040 !important;
}

.bookmark-active {
    color: #ffd700 !important;
}

/* Info Footer - Immersive Overlay */
.reel-info-footer {
    position: absolute;
    bottom: 74px;
    /* Increased from 30px */
    left: 25px;
    right: 75px;
    /* Space for sidebar */
    color: #fff;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reel-author {
    display: flex;
    align-items: center;
    gap: 10px;
}

.reel-author img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.reel-author-name {
    font-weight: 700;
    font-size: 15px;
    color: #fff;
}

.reel-follow-btn {
    background: transparent;
    border: 1px solid #fff;
    color: #fff;
    border-radius: 6px;
    padding: 3px 12px;
    font-size: 11px;
    font-weight: 700;
    height: 26px;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.reel-follow-btn:active {
    background: rgba(255, 255, 255, 0.2);
}

.reel-caption {
    font-size: 14px;
    line-height: 1.4;
    color: #eee;
    font-weight: 400;
    max-height: 120px;
    overflow-y: auto;
    scrollbar-width: none;
    transition: max-height 0.3s ease, background 0.3s ease;
}

.reel-caption.is-expanded {
    max-height: 450px;
    background: rgba(0, 0, 0, 0.4);
    padding: 8px;
    border-radius: 8px;
    margin-left: -8px;
    margin-right: -8px;
    width: calc(100% + 16px);
}

/* Central Indicator Overlay */
.reel-playback-control {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 80px;
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 5;
}

.reel-playback-control.visible {
    opacity: 1;
}

/* Top Controls */
.reel-controls-bar {
    position: absolute;
    top: 20px;
    left: 35px;
    display: flex;
    gap: 18px;
    z-index: 100;
}

.reel-mini-btn {
    background: rgba(0, 0, 0, 0.3);
    border: none;
    color: #fff;
    font-size: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.reel-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    color: #fff;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    cursor: pointer;
}

/* Mobile Adjustments */
@media (max-width: 576px) {
    .reel-caption {
        font-size: 14px;
        line-height: 1.4;
        color: #eee;
        font-weight: 400;
        max-height: 120px;
        overflow-y: auto;
        scrollbar-width: none;
        transition: max-height 0.3s ease, background 0.3s ease;
    }

    .reel-sidebar {
        position: absolute;
        right: 12px;
        bottom: 120px;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 20px;
        z-index: 10;
    }

    .reel-container {
        max-width: 100%;
        background: #000;
    }

    .reel-video-wrapper video {
        object-fit: contain;
        /* Fill screen on mobile for total immersion */
    }

    .reel-info-footer {
        position: absolute;
        bottom: 74px;
        left: 28px;
        right: 75px;
        color: #fff;
        z-index: 10;
        display: flex;
        flex-direction: column;
        gap: 8px;
        /* Higher safe area for mobile navigation bars */
    }

    .reel-sidebar {
        margin-right: 10px;
        bottom: 110px;
        /* Aligned with footer height */
    }
}

/* Animations */
@keyframes heartPop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.4);
    }

    100% {
        transform: scale(1.1);
    }
}

.heart-pop {
    animation: heartPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Premium Reel Comment Bottom-Sheet */
.reel-comment-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1100;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    backdrop-filter: blur(2px);
    transition: opacity 0.3s ease;
}

.reel-comment-sheet {
    width: 100%;
    max-width: 450px;
    height: 70vh;
    background: rgba(18, 18, 18, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px 20px 0 0;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    color: #fff;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.reel-comment-header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.reel-comment-header h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.reel-comment-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.reel-comment-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.reel-comment-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scrollbar-width: none;
}

.reel-comment-body::-webkit-scrollbar {
    display: none;
}

/* Comment Item Styling */
.reel-comment-item {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.reel-comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.reel-comment-content {
    flex: 1;
}

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

.reel-comment-text {
    font-size: 14px;
    line-height: 1.4;
    color: #eee;
    margin-bottom: 4px;
}

.reel-comment-date {
    font-size: 11px;
    color: #888;
}

/* Footer & Input */
.reel-comment-footer {
    padding: 15px 20px;
    padding-bottom: calc(15px + env(safe-area-inset-bottom, 0px));
    background: rgba(30, 30, 30, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.reel-comment-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.08);
    padding: 8px 16px;
    border-radius: 25px;
    transition: background 0.2s;
}

.reel-comment-input-wrap:focus-within {
    background: rgba(255, 255, 255, 0.12);
}

.reel-comment-input {
    background: transparent;
    border: none;
    color: #fff;
    flex: 1;
    font-size: 14px;
    outline: none;
}

.reel-comment-input::placeholder {
    color: #888;
}

.reel-comment-post-btn {
    background: transparent;
    border: none;
    color: #0095f6;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    transition: opacity 0.2s;
}

.reel-comment-post-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.reel-comment-empty {
    text-align: center;
    padding: 40px 20px;
    color: #888;
}

.reel-comment-empty i {
    font-size: 40px;
    display: block;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Dark mode overrides for category indicators in comments if needed */
.reel-comment-body .bg-light {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: #fff !important;
}

/* ── Infinite-Scroll Loader Sentinel ── */
/* Sits BELOW all snap-items so it's always reachable and visible */
.reel-loader-sentinel {
    /* No scroll-snap — intentionally omitted so it doesn't snap */
    width: 100%;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #000;
    padding: 24px 0 32px;
    color: #fff;
}