/* ─────────────────────────────────────────────────────────────
   assets/css/feed.css (WORKING VERSION + NAV ARROWS)
   ───────────────────────────────────────────────────────────── */

/* ── VIEWPORT: full-screen snap scroller ── */
/* ── VIEWPORT: full-screen snap scroller ── */
.feed-v2-viewport {
    position: fixed;
    width: 100%;
    height: 100%; /* Fills the flex-1 parent exactly */
    overflow-y: scroll;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    background: #000;
}

@media (min-width: 768px) {
    
.feed-v2-viewport {
    position: fixed;
    width: 100%;
    max-width: 670px;
    height: 100%;
    min-height: 100vh;
    overflow-y: scroll;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    background: #000;
    font-family: inherit;
}
} /* Ensure slides use exact dynamic viewport height */
.feed-v2-viewport > .feed-v2-slides > .feed-slide {
    height: 100dvh;
    min-height: 100dvh;
    width: 100%;
    flex-shrink: 0;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    overflow: hidden;
    background: #000;
}

/* Top UI (Online, Live, Menu) pinned below the header and subnav */
.feed-top-ui {
    position: absolute;
    top: calc(var(--feed-header-h, 64px) + var(--feed-subnav-h, 48px) + 20px);
    top: 55px;
    left: 0;
    right: 0;
    z-index: 30;
    display: flex;
    justify-content: space-between;
    padding: 0 16px;
    pointer-events: none;
}
.feed-top-ui > * {
    pointer-events: auto;
}

/* Bottom Panel clear of the mobile bottom nav + safe area */
.feed-bottom-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    padding-bottom: calc(env(safe-area-inset-bottom) + 165px); /* 80px clears the app bottom nav */
}

.feed-media {
    bottom: 20%;
}

/* Video controls UI */
.feed-video-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255,255,255,0.2);
    cursor: pointer;
    z-index: 25;
}
.feed-video-progress-bar {
    height: 100%;
    background: #fff;
    width: 0%;
    transition: width 0.1s linear;
}

/* ── VIDEO CONTROLS (Right-aligned) ── */
.feed-video-time {
    position: absolute;
    right: 16px;
    bottom: 120px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 25;
    pointer-events: none;
}

.feed-video-duration-wrap {
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    backdrop-filter: blur(4px);
}

.feed-video-progress {
    width: 80px; /* Fixed width for the progress bar */
    height: 3px;
    background: rgba(255,255,255,0.3);
    cursor: pointer;
    pointer-events: auto;
    border-radius: 2px;
}

.feed-video-progress-bar {
    height: 100%;
    background: #fff;
    width: 0%;
    border-radius: 2px;
}

/* ── ACTION BUTTONS (Right Side Stack) ── */
.feed-action-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    position: absolute;
    right: 12px;
    bottom: 120px; /* Above the bottom panel */
    z-index: 30;
}

.feed-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: white;
    transition: transform 0.15s ease;
}

.feed-action-btn:active {
    transform: scale(0.9);
}

.feed-action-btn i {
    font-size: 26px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.feed-action-btn span {
    font-size: 11px;
    font-weight: 900;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

/* Gift button special styling */
.gift-btn i {
    color: #fbbf24; /* Amber/Gold */
    animation: pulse-gift 2s infinite;
}

@keyframes pulse-gift {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}


/* ── SLIDE VIDEO: contain default, letterbox rules ── */
.feed-video { position: absolute; inset: 0; width: 100%; height: 100%; background: transparent; z-index: 1; }
.feed-video[data-fit="contain"] { object-fit: contain; }
.feed-video[data-fit="cover"]   { object-fit: cover; }

/* Landscape-video blurred letterbox bg */
.video-letterbox-bg { z-index: 0; }
.video-letterbox-bg.is-canvas { /* populated by JS */ }

/* ── SWIPE CAROUSEL ── */
.feed-swipe-track {
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scroll-behavior: smooth;
}
.feed-swipe-track::-webkit-scrollbar { display: none; }
.feed-swipe-track > * {
    scroll-snap-align: center;
    scroll-snap-stop: always;
}
.scrollbar-hide { scrollbar-width: none; -ms-overflow-style: none; }
.scrollbar-hide::-webkit-scrollbar { display: none; }

/* ── CONDENSED HEADER ── */
.feed-v2-header {
    z-index: 40;
    pointer-events: none;
}
.feed-v2-header > * { pointer-events: auto; }

/* ── SAFE AREA HELPERS ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .feed-safe-b { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
    .feed-safe-t { padding-top: calc(72px + env(safe-area-inset-top)); }
}

/* ── SENTINEL + END MARKER ── */
.feed-v2-sentinel { opacity: 0; pointer-events: none; }
.feed-v2-end {
    position: relative;
    height: 100dvh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}
.feed-v2-end.hidden { display: none; }

/* ── REACTION-BUTTON HOVER (subtle, desktop) ── */
@media (hover: hover) {
    .feed-react-btn:hover i { transform: scale(1.12); transition: transform 0.15s ease; }
}

/* ── MUSIC BARS ── */
@keyframes music-bar {
    0%, 100% { transform: scaleY(0.35); }
    50%      { transform: scaleY(1); }
}
.music-bar-anim {
    animation: music-bar 0.9s ease-in-out infinite;
    transform-origin: bottom;
    height: 100%;
}

/* ── HEARTBEAT for love animation ── */
@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    25%      { transform: scale(1.25); }
    50%      { transform: scale(1); }
    75%      { transform: scale(1.15); }
}
.animate-heartbeat { animation: heartbeat 0.6s ease-in-out; }

/* ── DARK MODE ── */
.feed-v2-viewport,
.feed-v2-viewport * { color-scheme: dark; }

/* ── DESKTOP: keep sidebars visible 
@media (min-width: 768px) {
    .feed-v2-viewport { max-width: 100%; }
}── */

/* ── DESKTOP NAV ARROWS (TikTok style) ── */
.feed-nav-arrows {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    flex-direction: column;
    gap: 12px;
    z-index: 50;
}

@media (min-width: 768px) {
    .feed-nav-arrows {
        display: flex;
    }
}

.feed-nav-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.feed-nav-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.feed-nav-btn:active {
    transform: scale(0.95);
}


/* ─────────────────────────────────────────────────────────────
   STORIES BAR — HARD RESET
   Defensive scoping so no external CSS (story viewer, modals,
   global img rules) can stretch our avatars.
   ───────────────────────────────────────────────────────────── */

/* Kill all external img sizing inside the story bar */
#feedStoriesHost,
#feedStoriesHost * {
    box-sizing: border-box;
}

#feedStoriesHost img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    max-width: none !important;
    max-height: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transform: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
}

#feedStoriesTrack {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#feedStoriesTrack::-webkit-scrollbar {
    display: none;
}

.feed-story-item {
    transition: transform 0.15s ease;
    outline: none;
    user-select: none;
}

.feed-story-item:active {
    transform: scale(0.94);
}

.feed-story-item:hover {
    transform: scale(1.04);
}

/* Compact mobile — story bar shouldn't eat screen height */
@media (max-width: 640px) {
    #feedStoriesHost {
        max-height: 88px;
    }
    #feedStoriesTrack {
        padding: 6px 8px;
        gap: 10px;
    }
}

/* ─────────────────────────────────────────────────────────────
   STORY INJECTION SLIDE (grid)
   ───────────────────────────────────────────────────────────── */
.feed-slide-stories {
    color-scheme: dark;
}

.feed-story-cell {
    min-height: 120px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.feed-story-cell img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.feed-story-cell:active {
    transform: scale(0.95);
}

/* ─────────────────────────────────────────────────────────────
   WELCOME STORIES CARD (floating, once per day)
   ───────────────────────────────────────────────────────────── */
#welcomeStoriesCard {
    /* position, top set inline for safe-area */
}

#welcomeStoriesCard.hidden {
    display: none;
}

#welcomeStoriesCard.opacity-0 {
    opacity: 0;
    transform: translateY(16px);
    pointer-events: none;
}

#welcomeStoriesCard > div:first-child img {
    display: block;
    width: 36px;
    height: 36px;
    object-fit: cover;
}

@media (max-width: 640px) {
    #welcomeStoriesCard {
        max-width: calc(100% - 24px);
    }
}

/* ─────────────────────────────────────────────────────────────
   AD SLIDE
   ───────────────────────────────────────────────────────────── */
.feed-slide-ad {
    color-scheme: dark;
}

.feed-slide-ad video,
.feed-slide-ad img {
    pointer-events: none;
}

.feed-slide-ad .feed-ad-cta {
    transition: transform 0.15s ease, background-color 0.15s ease;
}

/* ─────────────────────────────────────────────────────────────
   WHO-TO-FOLLOW HERO SLIDE
   ───────────────────────────────────────────────────────────── */
.feed-slide-wtf {
    color-scheme: dark;
}

.feed-wtf-card {
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.feed-wtf-card:active {
    transform: scale(0.99);
}

.feed-wtf-follow {
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.feed-wtf-see-more {
    transition: background-color 0.15s ease, transform 0.15s ease;
}

/* ─────────────────────────────────────────────────────────────
   MOBILE ADJUSTMENTS — keep CTA above bottom tab bar
   ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .feed-slide-ad .feed-ad-cta,
    .feed-slide-wtf .feed-wtf-see-more {
        margin-bottom: calc(env(safe-area-inset-bottom) + 8px);
    }
}

/* ─────────────────────────────────────────────────────────────
   NEW POST PILL (real-time updates)
   ───────────────────────────────────────────────────────────── */
#feedNewPostPill {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 132px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 70;
    animation: pillFadeIn 0.3s ease-out;
}

@keyframes pillFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

#feedNewPostPill.hidden {
    display: none !important;
}

/* Make sure the pill doesn't stack under the video mute button or the ⋯ menu */
#feedNewPostPill {
    box-shadow: 0 8px 24px -4px rgba(2, 75, 214, 0.5);
}


/* ─────────────────────────────────────────────────────────────
   TEXT-ONLY PAGINATION — blinking arrows
   ───────────────────────────────────────────────────────────── */
@keyframes feed-blink-arrow {
    0%, 100% { opacity: 1;   transform: scale(1); }
    50%      { opacity: 0.35; transform: scale(0.92); }
}

.animate-blink-slow {
    animation: feed-blink-arrow 1.8s ease-in-out infinite;
}

.feed-text-track {
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}
.feed-text-track::-webkit-scrollbar { display: none; }

/* Prevent the arrow from being clipped on the right edge */
.feed-text-track > * {
    scroll-snap-align: center;
    scroll-snap-stop: always;
}

/* ─────────────────────────────────────────────────────────────
   DYNAMIC PILL — keep long labels from wrapping
   ───────────────────────────────────────────────────────────── */
.feed-top-ui > div > div {
    white-space: nowrap;
}

/* ─────────────────────────────────────────────────────────────
   DOWNLOAD BUTTON — align with bookmark
   ───────────────────────────────────────────────────────────── */
.feed-react-btn[download] i {
    transition: transform 0.15s ease;
}
.feed-react-btn[download]:hover i {
    transform: translateY(2px);
}



/* ─────────────────────────────────────────────────────────────
   FEED RESILIENCE BANNER
   Only shows when the feed is completely empty due to network failure.
   Does NOT interfere with the global bottom loader or toast system.
   ───────────────────────────────────────────────────────────── */
.feed-resilience-banner {
    /* Base styles set via inline style in JS for full control */
}

/* Desktop: pin closer to the bottom since no mobile tab bar */
@media (min-width: 768px) {
    #feedResilienceBanner {
        bottom: 20px !important;
    }
}

/* Light mode is not used by the feed (feed is dark-mode-only),
   but if the page loads in light mode the banner stays dark
   so it matches the feed content behind it. */