/* 
   🎬 REELS PREMIUM DESIGN - FINAL STABLE
   Ultra-modern, Full-screen, Immersive experience
*/

/* 🛠️ Global Overrides for Reels Mode */
body.reels-mode {
    overflow: hidden !important;
}

body.reels-mode .main-content {
    margin-top: 0 !important;
    padding: 0 !important;
    margin-right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
}

body.reels-mode .top-navbar,
body.reels-mode #stories-container {
    display: none !important;
}

body:not(.reels-mode) #stories-container {
    display: flex !important;
}

#reels-section {
    padding: 0 !important;
    background: #000;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
}

.reels-container {
    width: 100vw;
    height: 100vh;
    margin: 0 auto;
    position: relative;
    background: #000;
    /* On desktop, add some space if needed for sidebar interaction, though sidebar is fixed */
}

@media (min-width: 769px) {
    .reels-container {
        padding-right: 100px;
        /* Space for the floating sidebar */
    }
}

.reels-header {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    padding: 15px 20px;
    z-index: 100;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reels-back-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.reels-header h2 {
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
}

.reels-search-bar {
    flex: 1;
    margin: 0 15px;
    position: relative;
}

.reels-search-bar input {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 8px 15px 8px 35px;
    color: white;
    outline: none;
}

.reels-upload-btn {
    background: var(--primary);
    border: none;
    color: #fff;
    padding: 6px 15px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
}

.reels-feed {
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
}

.reels-feed::-webkit-scrollbar {
    display: none;
}

.reel-item {
    width: 100vw;
    height: 100vh;
    scroll-snap-align: start;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #000;
}

/* Background Mirror Blur */
.reel-bg-blur {
    position: absolute;
    inset: -30px;
    width: calc(100% + 60px);
    height: calc(100% + 60px);
    object-fit: cover;
    filter: blur(50px) brightness(0.35);
    z-index: 1;
    opacity: 0.9;
}

.reel-video-container {
    height: 100vh;
    width: 100%;
    max-width: 500px;
    /* Constrain interactive area to phone size */
    margin: 0 auto;
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #000;
    overflow: hidden;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.8);
}

.reel-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Fit within screen, don't crop */
    cursor: pointer;
    background: transparent;
}

/* TikTok Style Right Actions Stack - Constrained to video width */
.reel-actions-stack {
    position: absolute;
    right: 15px;
    bottom: 120px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    z-index: 10;
}

.reel-profile-btn {
    position: relative;
    margin-bottom: 5px;
}

.reel-profile-btn img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid white;
    cursor: pointer;
}

.reel-profile-btn .plus-follow {
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    border: 2px solid #000;
}

.reel-action-item {
    background: none;
    border: none;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    outline: none !important;
    -webkit-tap-highlight-color: transparent;
}

.reel-action-item:focus,
.reel-action-item:active {
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

.reel-action-item i {
    font-size: 1.8rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8));
}

.reel-action-item span {
    font-size: 0.75rem;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Info Overlay (Left Bottom) inside video container */
.reel-info-bottom {
    position: absolute;
    left: 15px;
    bottom: 50px;
    right: 70px;
    /* Space for actions */
    color: white;
    z-index: 10;
    pointer-events: none;
    text-align: right;
}

.reel-info-bottom h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 5px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
    pointer-events: auto;
    cursor: pointer;
}

.reel-info-bottom .reel-caption {
    font-size: 0.85rem;
    line-height: 1.4;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
    pointer-events: auto;
}

/* Bottom Controls constrained to video width */
.reel-controls-bar {
    position: absolute;
    bottom: 5px;
    left: 10px;
    right: 10px;
    background: transparent;
    z-index: 15;
}

.reel-time-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 4px;
    font-family: 'Outfit', sans-serif;
    display: flex;
    justify-content: space-between;
}

/* 🚀 Premium Share Sheet (TikTok Style) */
.share-modal {
    position: fixed;
    bottom: -100%;
    left: 0;
    width: 100%;
    height: auto;
    background: rgba(15, 15, 15, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 30px 30px 0 0;
    z-index: 10000;
    transition: bottom 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    direction: rtl;
}

.share-modal.show {
    bottom: 0;
}

.share-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 5px 10px;
}

.share-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    text-align: center;
    flex-grow: 1;
}

.share-close,
.share-search {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: 0.2s;
}

.share-close:hover {
    background: rgba(255, 0, 0, 0.2);
}

/* Friends Row */
.share-friends-row {
    display: flex;
    overflow-x: auto;
    gap: 15px;
    padding-bottom: 15px;
    margin-bottom: 20px;
    scrollbar-width: none;
    /* Hide scrollbar Firefox */
}

.share-friends-row::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar Chrome/Safari */

.friend-share-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
    cursor: pointer;
    transition: transform 0.2s;
}

.friend-share-item:active {
    transform: scale(0.9);
}

.friend-share-item img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 8px;
    border: 2px solid transparent;
}

.friend-share-item.selected img {
    border-color: #ff2d55;
    box-shadow: 0 0 10px rgba(255, 45, 85, 0.5);
}

.friend-share-item span {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 75px;
}

/* Share Options Row */
.share-options-row {
    display: flex;
    overflow-x: auto;
    gap: 15px;
    padding: 15px 0;
    scrollbar-width: none;
}

.share-options-row::-webkit-scrollbar {
    display: none;
}

.option-share-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 70px;
    cursor: pointer;
}

.option-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    transition: transform 0.2s;
}

.option-share-item:active .option-icon {
    transform: scale(0.9);
}

.option-share-item span {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Colors based on your provided image */
.bg-republish {
    background: #fbbb00;
    color: #000;
}

.bg-copy {
    background: #0084ff;
    color: #fff;
}

.bg-whatsapp {
    background: #25d366;
    color: #fff;
}

.bg-embed {
    background: #00b0ff;
    color: #fff;
}

.bg-facebook {
    background: #1877f2;
    color: #fff;
}

.bg-telegram {
    background: #24a1de;
    color: #fff;
}

.bg-instagram {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: #fff;
}

/* Comment Area */
.share-comment-area {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 12px;
    margin-bottom: 20px;
    display: none;
    /* Shown when friend selected */
    animation: slideDown 0.3s ease-out;
}

.share-comment-area.active {
    display: block;
}

.share-comment-area input {
    width: 100%;
    background: transparent;
    border: none;
    color: #fff;
    padding: 8px;
    font-size: 0.9rem;
    outline: none;
}

.share-send-btn {
    background: #ff2d55;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    margin-top: 10px;
    width: 100%;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.share-send-btn:hover {
    background: #ff4d71;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Overlay for modal */
.share-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none;
}

.share-overlay.show {
    display: block;
}

.reel-seeker-bg {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    transition: height 0.2s;
}

.reel-seeker-bg:hover {
    height: 5px;
}

.reel-seeker-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    width: 0%;
}

/* Play/Pause Center Icon */
.reel-state-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    color: white;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 10;
}

.reel-state-icon.show {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1.2);
}

@media (max-width: 768px) {
    .reel-video-container {
        max-width: 100%;
    }
}

/* Reel Share Card in Chat */
.reel-share-card:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.reel-share-card:active {
    transform: scale(0.98);
}