/* BlueBook Feed Sync Frontend */

.bbfsync-feed {
    --bbfsync-bg-posts: #ffffff;
    --bbfsync-bg-elements: #f0f2f5;
    --bbfsync-text-primary: #1c1e21;
    --bbfsync-text-secondary: #65676b;
    --bbfsync-link-color: #1877F2;
    --bbfsync-date-color: var(--bbfsync-text-secondary);
    --bbfsync-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    position: relative;
}

.bbfsync-feed.bbfsync-scheme-inherit {
    --bbfsync-bg-posts: inherit;
    --bbfsync-bg-elements: inherit;
    --bbfsync-text-primary: inherit;
    --bbfsync-text-secondary: inherit;
    --bbfsync-link-color: inherit;
}

.bbfsync-error {
    padding: 16px;
    background: #fef0f0;
    border: 1px solid #f5c6cb;
    border-radius: var(--bbfsync-radius);
    color: #842029;
}

/* Header */
.bbfsync-header {
    margin-bottom: 20px;
    background: var(--bbfsync-bg-elements);
    border-radius: var(--bbfsync-radius);
    overflow: hidden;
}

.bbfsync-header-text-mode {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
}

/* Transparent text header - no background box */
.bbfsync-header.bbfsync-header-transparent {
    background: transparent;
    border-radius: 0;
}
.bbfsync-header.bbfsync-header-transparent .bbfsync-header-text-mode {
    padding: 8px 4px 16px;
}

.bbfsync-header-icon svg { display: block; }

.bbfsync-header-custom-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--bbfsync-text-primary);
}

.bbfsync-header-text-bio {
    font-size: 13px;
    color: var(--bbfsync-text-secondary);
    margin: 0;
    padding: 0 20px 12px;
}
.bbfsync-header-transparent .bbfsync-header-text-bio {
    padding: 0 4px 12px;
}

/* Text header info block (page name + bio) */
.bbfsync-header-text-info {
    padding: 0 20px 14px;
}
.bbfsync-header-text-info-flat {
    padding: 0 4px 14px;
}
.bbfsync-header-text-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--bbfsync-text-primary);
    margin: 0 0 2px;
}
.bbfsync-header-text-info .bbfsync-header-text-bio {
    padding: 0;
}

.bbfsync-header-cover {
    width: 100%;
    max-height: 250px;
    overflow: hidden;
}

.bbfsync-header-cover img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.bbfsync-header-info { padding: 16px 20px; }

.bbfsync-header-identity {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.bbfsync-header-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Only overlap avatar on cover when cover is present */
.bbfsync-header-cover + .bbfsync-header-info .bbfsync-header-avatar {
    margin-top: -35px;
}

.bbfsync-header-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--bbfsync-text-primary);
    margin: 0 0 4px;
}

.bbfsync-header-bio {
    font-size: 14px;
    color: var(--bbfsync-text-secondary);
    margin: 0 0 8px;
}

.bbfsync-header-fans {
    font-size: 13px;
    color: var(--bbfsync-text-secondary);
}

/* Banner Style - cover with overlay */
.bbfsync-header-banner {
    position: relative;
    min-height: 180px;
    overflow: hidden;
}
.bbfsync-header-banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0; left: 0;
}
.bbfsync-header-banner-overlay {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 32px 24px;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.2) 100%);
    min-height: 180px;
}
.bbfsync-header-banner .bbfsync-header-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.9);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    margin-top: 0;
    flex-shrink: 0;
}
.bbfsync-header-banner-text {
    flex: 1;
}

/* Compact Style - inline row */
.bbfsync-header-compact {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
}
.bbfsync-header-compact-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.bbfsync-header-compact-info {
    flex: 1;
    min-width: 0;
}
.bbfsync-header-compact .bbfsync-header-title {
    font-size: 18px;
    margin: 0 0 2px;
}
.bbfsync-header-compact-meta {
    font-size: 13px;
    color: var(--bbfsync-text-secondary);
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0 6px;
}

/* Clean Style - centered, no cover */
.bbfsync-header-clean {
    text-align: center;
    padding: 24px 20px;
}
.bbfsync-header-clean-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0 auto 12px;
    display: block;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.bbfsync-header-clean .bbfsync-header-title {
    font-size: 24px;
    margin: 0 0 6px;
}
.bbfsync-header-clean .bbfsync-header-bio {
    max-width: 500px;
    margin: 0 auto 8px;
}

/* List Layout */
.bbfsync-posts-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bbfsync-posts-list .bbfsync-post {
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
}

/* Masonry Layout */
.bbfsync-posts-masonry {
    column-count: var(--bbfsync-columns, 3);
    column-gap: 16px;
}

.bbfsync-posts-masonry .bbfsync-post {
    break-inside: avoid;
    margin-bottom: 16px;
}

/* Boxed Layout */
.bbfsync-posts-boxed {
    display: grid;
    grid-template-columns: repeat(var(--bbfsync-columns, 3), 1fr);
    gap: 20px;
}

.bbfsync-posts-boxed .bbfsync-post {
    display: flex;
    flex-direction: column;
}

.bbfsync-posts-boxed .bbfsync-post-engagement {
    margin-top: auto;
}

@media (max-width: 1024px) {
    .bbfsync-posts-boxed {
        grid-template-columns: repeat(var(--bbfsync-columns-tablet, 2), 1fr);
    }
}

@media (max-width: 768px) {
    .bbfsync-posts-boxed {
        grid-template-columns: repeat(var(--bbfsync-columns-mobile, 1), 1fr);
    }
}

/* Vis flere / See more */
.bbfsync-see-more {
    color: var(--bbfsync-see-more-color, var(--bbfsync-link-color));
    font-weight: 500;
    text-decoration: none;
    font-size: inherit;
}

.bbfsync-see-more:hover {
    text-decoration: underline;
}

/* Carousel Layout */
.bbfsync-carousel-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 32px;
}

.bbfsync-carousel-viewport {
    flex: 1;
    overflow: hidden;
}

.bbfsync-carousel-track {
    display: flex;
    transition: transform 0.25s ease-out;
    -webkit-user-select: none;
    user-select: none;
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.bbfsync-posts-carousel .bbfsync-post {
    flex: 0 0 calc(100% / 3);
    max-width: calc(100% / 3);
    box-sizing: border-box;
    padding: 0 8px;
    display: flex;
}

.bbfsync-posts-carousel .bbfsync-post .bbfsync-post-inner {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Carousel card: fixed height for image-only posts */
.bbfsync-posts-carousel .bbfsync-post .bbfsync-post-inner .bbfsync-post-media {
    flex-shrink: 0;
    max-height: 220px;
    overflow: hidden;
}

.bbfsync-posts-carousel .bbfsync-post .bbfsync-post-inner .bbfsync-post-media img {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

/* Carousel: videos and galleries show at natural height, no cropping */
.bbfsync-posts-carousel .bbfsync-media-video,
.bbfsync-posts-carousel .bbfsync-youtube-media,
.bbfsync-posts-carousel .bbfsync-post-media:has(.bbfsync-gallery) {
    max-height: none !important;
    overflow: visible !important;
}

.bbfsync-posts-carousel .bbfsync-media-video img,
.bbfsync-posts-carousel .bbfsync-youtube-media img {
    height: auto !important;
    object-fit: contain !important;
}

.bbfsync-posts-carousel .bbfsync-fb-video-wrap .bbfsync-fb-play-btn {
    width: 48px;
    height: 48px;
}

.bbfsync-posts-carousel .bbfsync-fb-video-wrap .bbfsync-fb-play-btn::after {
    border-width: 10px 0 10px 16px;
    margin-left: 3px;
}

.bbfsync-posts-carousel .bbfsync-gallery { grid-auto-rows: 100px; }

.bbfsync-posts-carousel .bbfsync-post .bbfsync-post-inner .bbfsync-post-message {
    flex: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    max-height: 96px;
}

/* Carousel Arrows */
.bbfsync-carousel-arrow {
    flex-shrink: 0;
    background: #fff;
    color: #555;
    border: 1px solid #ddd;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.bbfsync-carousel-arrow:hover {
    background: #f5f5f5;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.bbfsync-carousel-arrow:disabled {
    opacity: 0.25;
    cursor: default;
    box-shadow: none;
}

/* Carousel Dots */
.bbfsync-carousel-dots {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 6px;
    padding-top: 12px;
}

/* Load More inside carousel - sits below dots */
.bbfsync-load-more-carousel {
    position: absolute;
    bottom: 0;
    right: 16px;
    padding: 0;
    text-align: right;
}
.bbfsync-load-more-carousel .bbfsync-load-more {
    font-size: 12px;
    padding: 5px 16px;
    border-radius: 4px;
}

.bbfsync-carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bbfsync-text-secondary);
    opacity: 0.3;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
}

.bbfsync-carousel-dot:hover {
    opacity: 0.6;
}

.bbfsync-carousel-dot.active {
    opacity: 1;
    background: var(--bbfsync-link-color);
    transform: scale(1.2);
}

/* Carousel scrollbar hidden */
.bbfsync-posts-carousel::-webkit-scrollbar { display: none; }
.bbfsync-posts-carousel { -ms-overflow-style: none; scrollbar-width: none; }

/* Post Card */
.bbfsync-post {
    background: var(--bbfsync-bg-posts);
    border-radius: var(--bbfsync-radius);
    border: 1px solid var(--bbfsync-border-color, #e0e0e0);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.bbfsync-post:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

.bbfsync-post-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px 8px;
}

.bbfsync-post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

.bbfsync-post-author-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

a.bbfsync-post-author {
    font-weight: 600;
    font-size: 14px;
    color: var(--bbfsync-author-color, var(--bbfsync-link-color));
    text-decoration: none;
    line-height: 1.3;
}

a.bbfsync-post-author:hover { text-decoration: underline; }

.bbfsync-post-story {
    font-size: 13px;
    color: var(--bbfsync-text-primary);
    line-height: 1.3;
}

.bbfsync-post-date {
    font-size: 12px;
    color: var(--bbfsync-date-color);
    line-height: 1.3;
}

.bbfsync-post-message {
    padding: 4px 16px 12px;
    font-size: 15px;
    color: var(--bbfsync-text-primary);
    word-wrap: break-word;
    line-height: 1.5;
    white-space: pre-line;
}

/* Clamp long text in multi-column layouts to keep cards compact.
   Full text is always available in the lightbox sidebar.
   --bbfsync-text-lines-grid is set per-feed via inline CSS (default: 14, 'none' = unlimited). */
.bbfsync-posts-masonry .bbfsync-post-message,
.bbfsync-posts-boxed .bbfsync-post-message,
.bbfsync-posts-carousel .bbfsync-post-message {
    display: -webkit-box;
    -webkit-line-clamp: var(--bbfsync-text-lines-grid, 14);
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
}

/* Hide the inline "See more" in clamped layouts — lightbox handles full text.
   When text_lines_grid is 0 (none), clamping is off so "See more" stays visible. */
.bbfsync-posts-masonry .bbfsync-see-more,
.bbfsync-posts-boxed .bbfsync-see-more,
.bbfsync-posts-carousel .bbfsync-see-more {
    display: none;
}
.bbfsync-text-clamp-off .bbfsync-posts-masonry .bbfsync-see-more,
.bbfsync-text-clamp-off .bbfsync-posts-boxed .bbfsync-see-more,
.bbfsync-text-clamp-off .bbfsync-posts-carousel .bbfsync-see-more {
    display: inline;
}

/* Expand indicator — thin line with centered down-caret.
   Hidden by default, shown only in clamped grid layouts. */
.bbfsync-text-expand {
    display: none;
    align-items: center;
    gap: 0;
    width: 100%;
    height: 28px;
    margin: 4px 0 0;
    padding: 0 16px;
    border: none;
    background: none;
    color: var(--bbfsync-text-secondary, #999);
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.2s;
    box-sizing: border-box;
}
.bbfsync-text-expand:hover {
    opacity: 0.9;
}
.bbfsync-expand-line {
    flex: 1;
    height: 1px;
    background: currentColor;
}
.bbfsync-expand-caret {
    font-size: 20px;
    line-height: 1;
    padding: 0 8px;
    position: relative;
    top: -2px;
}
/* Only show when JS detects actual text overflow */
.bbfsync-text-expand.bbfsync-expand-visible {
    display: flex;
}
/* Hide when clamp is off */
.bbfsync-text-clamp-off .bbfsync-text-expand {
    display: none !important;
}

.bbfsync-post-message a {
    color: var(--bbfsync-link-color);
    text-decoration: none;
}

.bbfsync-post-message a:hover { text-decoration: underline; }

.bbfsync-post-media {
    position: relative;
    width: 100%;
    line-height: 0;
}

.bbfsync-post-media img {
    width: 100%;
    height: auto;
    display: block;
}

/* Video wrapper images must fill the container, not auto-height */
.bbfsync-fb-video-wrap img,
.bbfsync-youtube-wrap img {
    width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
}

/* ===========================
   Image Gallery — 6-column adaptive grid (Facebook pattern)
   =========================== */

/* Base gallery: 6-column grid for flexible sub-spans */
.bbfsync-gallery {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-auto-rows: 160px;
    gap: 2px;
    border-radius: 4px;
    overflow: hidden;
}

/* All gallery images: fill cell, center-crop */
.bbfsync-gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bbfsync-gallery .bbfsync-gallery-item {
    overflow: hidden;
}

.bbfsync-gallery a {
    display: block;
    position: relative;
    overflow: hidden;
    line-height: 0;
    width: 100%;
    height: 100%;
}

/* Subtle inset border on each image cell (Facebook-style) */
.bbfsync-gallery .bbfsync-gallery-item a::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
    pointer-events: none;
    z-index: 1;
}

/* 2 images: side by side, each 3 cols, 2 rows tall */
.bbfsync-gallery-2 .bbfsync-gallery-item {
    grid-column: span 3;
    grid-row: span 2;
}

/* 3 images: main left 4 cols / 2 rows, 2 right stacked 2 cols / 1 row each */
.bbfsync-gallery-3 .bbfsync-gallery-item:nth-child(1) {
    grid-column: span 4;
    grid-row: span 2;
}

.bbfsync-gallery-3 .bbfsync-gallery-item:nth-child(2),
.bbfsync-gallery-3 .bbfsync-gallery-item:nth-child(3) {
    grid-column: span 2;
    grid-row: span 1;
}

/* 4 images: 2×2, each 3 cols / 1 row */
.bbfsync-gallery-4 .bbfsync-gallery-item {
    grid-column: span 3;
    grid-row: span 1;
}

/* 5+ images: 2 top (3 cols each, 2 rows) + 3 bottom (2 cols each, 1 row) */
.bbfsync-gallery-5 .bbfsync-gallery-item:nth-child(1),
.bbfsync-gallery-5 .bbfsync-gallery-item:nth-child(2) {
    grid-column: span 3;
    grid-row: span 2;
}

.bbfsync-gallery-5 .bbfsync-gallery-item:nth-child(3),
.bbfsync-gallery-5 .bbfsync-gallery-item:nth-child(4),
.bbfsync-gallery-5 .bbfsync-gallery-item:nth-child(5) {
    grid-column: span 2;
    grid-row: span 1;
}

/* +N overlay on last visible image */
.bbfsync-gallery-more {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    letter-spacing: 1px;
}

/* Mobile: smaller rows */
@media (max-width: 600px) {
    .bbfsync-gallery {
        grid-auto-rows: 110px;
    }
}

/* YouTube Responsive Embed */
.bbfsync-youtube-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}

.bbfsync-youtube-wrap iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    z-index: 3;
}

.bbfsync-youtube-wrap .bbfsync-yt-placeholder {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 1;
    text-decoration: none;
}

.bbfsync-youtube-wrap .bbfsync-yt-placeholder img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bbfsync-youtube-wrap .bbfsync-yt-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 68px;
    height: 48px;
    background: rgba(255, 0, 0, 0.85);
    color: #fff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 2;
    pointer-events: none;
}

.bbfsync-youtube-wrap .bbfsync-yt-play-btn::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 0 10px 18px;
    border-color: transparent transparent transparent #fff;
    margin-left: 3px;
}

.bbfsync-youtube-wrap .bbfsync-yt-placeholder:hover .bbfsync-yt-play-btn {
    background: rgba(255, 0, 0, 1);
}

/* Facebook Video Click-to-Play */
.bbfsync-fb-video-wrap {
    position: relative;
    width: 100%;
    background: #000;
}

/* Portrait video: capped at 4:5 ratio like Facebook feed */
.bbfsync-fb-video-wrap.bbfsync-portrait-video {
    /* Natural height from thumbnail, no forced aspect ratio */
}

.bbfsync-fb-video-wrap iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    z-index: 3;
}

.bbfsync-fb-video-wrap .bbfsync-fb-video-placeholder {
    display: block;
    position: relative;
    width: 100%;
    cursor: pointer;
    z-index: 1;
    text-decoration: none;
}

.bbfsync-fb-video-wrap .bbfsync-fb-video-placeholder img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.bbfsync-fb-video-wrap .bbfsync-fb-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 2;
    pointer-events: none;
}

.bbfsync-fb-video-wrap .bbfsync-fb-play-btn::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 12px 0 12px 20px;
    border-color: transparent transparent transparent #fff;
    margin-left: 4px;
}

.bbfsync-fb-video-wrap .bbfsync-fb-video-placeholder:hover .bbfsync-fb-play-btn {
    background: rgba(0, 0, 0, 0.8);
}

/* Fallback link for copyright-blocked Facebook videos */
.bbfsync-fb-video-fallback {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff !important;
    font-size: 13px;
    border-radius: 20px;
    text-decoration: none;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

/* Show fallback when iframe is loaded (embed error visible) */
.bbfsync-fb-video-wrap:hover .bbfsync-fb-video-fallback,
.bbfsync-lightbox-fb-embed .bbfsync-fb-video-fallback {
    opacity: 1;
    pointer-events: auto;
}

/* Hide fallback link in lightbox — not needed, iframe has its own controls */
.bbfsync-lightbox-fb-embed .bbfsync-fb-video-fallback {
    display: none;
}

/* Fullscreen expand button (shown on playing videos) */
.bbfsync-video-fullscreen-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    width: 36px;
    height: 36px;
    background: rgba(0,0,0,0.6);
    border: none;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background 0.2s;
    padding: 0;
}

.bbfsync-video-fullscreen-btn:hover {
    background: rgba(0,0,0,0.85);
}

/* Mute/Unmute Button */
.bbfsync-video-mute-btn {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 10;
    width: 36px;
    height: 36px;
    background: rgba(0,0,0,0.6);
    border: none;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, opacity 0.2s;
    padding: 0;
    opacity: 0.85;
}

.bbfsync-video-mute-btn:hover {
    background: rgba(0,0,0,0.85);
    opacity: 1;
}

.bbfsync-video-mute-btn svg {
    display: block;
}

/* ===== MOBILE FAKE-FULLSCREEN =====
   iOS Safari doesn't support requestFullscreen() on divs/iframes.
   On touch devices we use a CSS-based fullscreen that covers the viewport. */
.bbfsync-video-fake-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
    background: #000 !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    aspect-ratio: auto !important;
}

.bbfsync-video-fake-fullscreen iframe {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

.bbfsync-video-fake-fullscreen .bbfsync-video-fullscreen-btn {
    position: fixed !important;
    top: 12px !important;
    right: 12px !important;
    z-index: 1000000 !important;
    width: 40px !important;
    height: 40px !important;
    font-size: 20px !important;
    display: flex !important;
}

.bbfsync-video-fake-fullscreen .bbfsync-video-mute-btn {
    position: fixed !important;
    bottom: 12px !important;
    left: 12px !important;
    z-index: 1000000 !important;
    width: 40px !important;
    height: 40px !important;
}

/* Lightbox fake-fullscreen: hide the lightbox UI behind the video */
.bbfsync-lightbox-fake-fullscreen .bbfsync-lightbox-fb-embed,
.bbfsync-lightbox-fake-fullscreen .bbfsync-lightbox-yt-embed {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
}

.bbfsync-lightbox-fake-fullscreen .bbfsync-lightbox-fb-embed iframe,
.bbfsync-lightbox-fake-fullscreen .bbfsync-lightbox-yt-embed iframe {
    width: 100% !important;
    height: 100% !important;
}

/* Close button for lightbox fake-fullscreen */
.bbfsync-fake-fs-close {
    position: fixed !important;
    top: 12px;
    right: 12px;
    z-index: 1000000;
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,0.6);
    border: none;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

/* Lock body scroll when in fake fullscreen */
body.bbfsync-fs-active {
    overflow: hidden !important;
}

/* Legacy gallery classes removed — replaced by grid-based gallery above */
.bbfsync-post-media a:not(.bbfsync-fb-video-placeholder):not(.bbfsync-yt-placeholder) {
    display: block;
    position: relative;
}

/* Fullscreen mode for video wrappers */
.bbfsync-fb-video-wrap:fullscreen,
.bbfsync-youtube-wrap:fullscreen {
    aspect-ratio: auto;
    height: 100%;
    width: 100%;
    background: #000;
}

.bbfsync-fb-video-wrap:fullscreen iframe,
.bbfsync-youtube-wrap:fullscreen iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.bbfsync-fb-video-wrap:fullscreen .bbfsync-video-fullscreen-btn,
.bbfsync-youtube-wrap:fullscreen .bbfsync-video-fullscreen-btn,
.bbfsync-fb-video-wrap:fullscreen .bbfsync-video-mute-btn,
.bbfsync-youtube-wrap:fullscreen .bbfsync-video-mute-btn {
    display: none;
}

/* Webkit fullscreen */
.bbfsync-fb-video-wrap:-webkit-full-screen,
.bbfsync-youtube-wrap:-webkit-full-screen {
    aspect-ratio: auto;
    height: 100%;
    width: 100%;
}

/* Iframe fullscreen (mobile - we fullscreen the iframe directly) */
.bbfsync-fb-video-wrap iframe:fullscreen,
.bbfsync-youtube-wrap iframe:fullscreen {
    width: 100%;
    height: 100%;
}

.bbfsync-fb-video-wrap iframe:-webkit-full-screen,
.bbfsync-youtube-wrap iframe:-webkit-full-screen {
    width: 100%;
    height: 100%;
}

.bbfsync-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0,0,0,0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    pointer-events: none;
}

.bbfsync-video-wrap {
    width: 100%;
    line-height: 0;
}

.bbfsync-video-wrap .fb-video {
    width: 100%;
}

.bbfsync-video-wrap .fb-video span,
.bbfsync-video-wrap .fb-video iframe {
    width: 100% !important;
}

.bbfsync-video-fallback {
    position: relative;
}

.bbfsync-video-fallback img {
    width: 100%;
    height: auto;
    display: block;
}

.bbfsync-video-fallback a {
    display: block;
    position: relative;
}

.bbfsync-post-engagement {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid #e8e8e8;
    font-size: 13px;
    color: var(--bbfsync-text-secondary);
    flex-wrap: wrap;
    gap: 8px;
}

.bbfsync-engagement-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bbfsync-engagement-left span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.bbfsync-engagement-left .bbfsync-likes svg {
    margin-right: -4px;
}

.bbfsync-engagement-left svg { opacity: 0.6; }

.bbfsync-engagement-right {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.bbfsync-view-on-fb,
.bbfsync-share-link {
    color: var(--bbfsync-link-color);
    text-decoration: none;
    font-weight: 500;
}

.bbfsync-view-on-fb:hover,
.bbfsync-share-link:hover { text-decoration: underline; }

.bbfsync-sep {
    color: var(--bbfsync-text-secondary);
}

/* Like Box — custom follow card */
.bbfsync-likebox {
    margin: 16px 0;
    text-align: center;
}

.bbfsync-likebox-card {
    margin: 0 auto;
    border-radius: 12px;
    background: var(--bbfsync-bg-posts, #fff);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.bbfsync-likebox-cover {
    width: 100%;
    max-height: 130px;
    overflow: hidden;
}
.bbfsync-likebox-cover img {
    width: 100%;
    height: 130px;
    display: block;
    object-fit: cover;
}

.bbfsync-likebox-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
}

.bbfsync-likebox-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.bbfsync-likebox-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.bbfsync-likebox-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--bbfsync-text-primary, #1c1e21);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bbfsync-likebox-name:hover {
    text-decoration: underline;
}

.bbfsync-likebox-fans {
    font-size: 12px;
    color: var(--bbfsync-text-secondary, #65676b);
    margin-top: 1px;
}

.bbfsync-likebox-action {
    flex-shrink: 0;
}

.bbfsync-likebox-follow {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    background: #1877F2;
    color: #fff;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
    white-space: nowrap;
}
.bbfsync-likebox-follow:hover {
    background: #166FE5;
    color: #fff;
    text-decoration: none;
}
.bbfsync-likebox-follow svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Large card: cover on top, info below */
.bbfsync-likebox-large .bbfsync-likebox-info {
    padding: 12px 16px 14px;
}

/* Like Box - Scroll reveal mode */
.bbfsync-likebox-hidden {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none;
}
.bbfsync-likebox-hidden.bbfsync-likebox-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}


/* Feed Footer - sticky bar for load more button only */
.bbfsync-feed-footer {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: var(--bbfsync-bg-posts, #fff);
    border-top: 1px solid var(--bbfsync-border-color, #e0e0e0);
    padding: 14px 20px;
    text-align: center;
    margin-top: 8px;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
}

.bbfsync-feed-footer .bbfsync-load-more-wrap {
    padding: 0;
}

/* Load More */
.bbfsync-load-more-wrap {
    text-align: center;
    padding: 20px 0;
}

.bbfsync-load-more {
    display: inline-block;
    min-height: 44px;
    padding: 12px 32px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
}

.bbfsync-load-more:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.16);
}
.bbfsync-load-more:active { transform: translateY(0); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.bbfsync-load-more.loading {
    opacity: 0.7;
    cursor: wait;
}

/* Mobile */
@media (max-width: 480px) {
    .bbfsync-feed-footer {
        padding: 12px 10px;
    }
    .bbfsync-load-more {
        padding: 12px 24px;
        font-size: 14px;
    }
}

/* Lightbox - Split Layout */
.bbfsync-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bbfsync-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.88);
    cursor: pointer;
}

.bbfsync-lightbox-container {
    position: relative;
    z-index: 2;
    width: 94vw;
    max-width: 1200px;
    height: 88vh;
    display: flex;
    flex-direction: column;
}

.bbfsync-lightbox-split {
    display: flex;
    flex: 1;
    min-height: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    position: relative;
}

/* Left side - Image */
.bbfsync-lightbox-media {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    min-width: 0;
    overflow: hidden;
    touch-action: pan-y pinch-zoom;
    -webkit-user-select: none;
    user-select: none;
    cursor: pointer; /* indicate clickable to close */
}

.bbfsync-lightbox-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.15s ease-out;
    cursor: default;
}

/* Video/YT embed fills entire media area */
.bbfsync-lightbox-yt-embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.bbfsync-lightbox-yt-embed iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Facebook video in lightbox: centered 16:9 frame */
.bbfsync-lightbox-fb-embed {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    aspect-ratio: 16 / 9;
    max-height: 90%;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
}

.bbfsync-lightbox-fb-embed iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Portrait video in lightbox: narrower, taller frame */
.bbfsync-lightbox-fb-embed.bbfsync-lightbox-fb-portrait {
    aspect-ratio: 9 / 16;
    width: auto;
    height: 90%;
    max-width: 90%;
}

/* Mute button in lightbox */
.bbfsync-lightbox-media .bbfsync-video-mute-btn {
    bottom: 12px;
    left: 12px;
    z-index: 6;
}

.bbfsync-lightbox-fake-fullscreen .bbfsync-video-mute-btn {
    position: fixed !important;
    bottom: 12px !important;
    left: 12px !important;
    z-index: 1000000 !important;
}

/* Right side - Post content */
.bbfsync-lightbox-sidebar {
    width: 340px;
    flex-shrink: 0;
    background: var(--bbfsync-bg-posts, #fff);
    overflow-y: auto;
    border-left: 1px solid var(--bbfsync-border-color, #e0e0e0);
}

.bbfsync-lightbox-sidebar .bbfsync-post-header {
    padding: 16px 16px 8px;
}

.bbfsync-lightbox-sidebar .bbfsync-post-message {
    padding: 4px 16px 16px;
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-line;
}

/* Text-only posts — full-width single column */
.bbfsync-lb-no-media {
    background: transparent;
}
.bbfsync-lb-no-media .bbfsync-lightbox-media {
    display: none;
}
.bbfsync-lightbox-container:has(.bbfsync-lb-no-media) {
    height: auto;
    max-height: 88vh;
}
.bbfsync-lb-no-media .bbfsync-lightbox-sidebar {
    flex: 1 1 100%;
    width: 100%;
    max-width: 780px;
    margin: 0 auto;
    border-left: none;
    border-radius: 8px;
}
.bbfsync-lb-no-media .bbfsync-lightbox-sidebar .bbfsync-post-header {
    padding: 28px 28px 12px;
}
.bbfsync-lb-no-media .bbfsync-lightbox-sidebar .bbfsync-post-message {
    padding: 8px 28px 28px;
    font-size: 16px;
    line-height: 1.7;
}
.bbfsync-lb-no-media .bbfsync-lightbox-sidebar .bbfsync-post-engagement {
    padding: 12px 28px;
}

/* Thumbnail strip */
.bbfsync-lightbox-thumbs {
    display: flex;
    gap: 4px;
    padding: 8px 0;
    overflow-x: auto;
    justify-content: center;
}

.bbfsync-lightbox-thumbs img {
    width: 64px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s, outline 0.2s;
    border: 2px solid transparent;
}

.bbfsync-lightbox-thumbs img:hover {
    opacity: 0.8;
}

.bbfsync-lightbox-thumbs img.active {
    opacity: 1;
    border-color: #fff;
}

/* Image counter (e.g. "2 / 5") */
.bbfsync-lightbox-counter {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 12px;
    z-index: 4;
    pointer-events: none;
    letter-spacing: 0.5px;
}

/* Keyboard navigation hint */
.bbfsync-lightbox-nav-hint {
    display: none;
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: #fff;
    background: rgba(40, 40, 40, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 6px 16px;
    border-radius: 14px;
    letter-spacing: 0.3px;
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
    z-index: 5;
    opacity: 1;
    transition: opacity 0.6s ease;
}
.bbfsync-lightbox-nav-hint.bbfsync-hint-fade {
    opacity: 0;
}
/* Hide keyboard hint on devices without a fine pointer (phones/tablets) */
@media (hover: none) and (pointer: coarse) {
    .bbfsync-lightbox-nav-hint { display: none !important; }
}

/* Arrows inside media area */
.bbfsync-lightbox-prev,
.bbfsync-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: #fff;
    font-size: 28px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
    z-index: 3;
}

.bbfsync-lightbox-prev:hover,
.bbfsync-lightbox-next:hover { background: rgba(0, 0, 0, 0.8); }

.bbfsync-lightbox-prev { left: 12px; }
.bbfsync-lightbox-next { right: 12px; }

/* Close button */
.bbfsync-lightbox-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    opacity: 0.85;
    transition: opacity 0.2s, background 0.2s;
}

.bbfsync-lightbox-close:hover { opacity: 1; background: rgba(0, 0, 0, 0.85); }

/* Lightbox auto-load spinner */
.bbfsync-lb-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: #1877F2;
    border-radius: 50%;
    animation: bbfsync-lb-spin 0.6s linear infinite;
    z-index: 10;
    pointer-events: none;
}

@keyframes bbfsync-lb-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Play overlay for video in lightbox */
.bbfsync-lightbox-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 72px;
    height: 72px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 5;
    padding-left: 6px;
}

.bbfsync-lightbox-play:hover { background: rgba(0, 0, 0, 0.85); }

/* YouTube video box in lightbox */
/* YouTube video box in lightbox — full overlay with centered play button */
.bbfsync-yt-video-box {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    touch-action: manipulation;
}

.bbfsync-yt-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 68px;
    height: 48px;
    background: rgba(255, 0, 0, 0.85);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.bbfsync-yt-play-icon::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 0 10px 18px;
    border-color: transparent transparent transparent #fff;
    margin-left: 3px;
}

.bbfsync-yt-video-box:hover .bbfsync-yt-play-icon {
    background: rgba(255, 0, 0, 1);
}

/* Facebook video box in lightbox — full overlay with centered play button */
.bbfsync-fb-video-box {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    touch-action: manipulation;
}

.bbfsync-fb-play-icon {
    width: 72px;
    height: 72px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    pointer-events: none;
}

.bbfsync-fb-play-icon::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 14px 0 14px 24px;
    border-color: transparent transparent transparent #fff;
    margin-left: 5px;
}

.bbfsync-fb-video-box:hover .bbfsync-fb-play-icon {
    background: rgba(0, 0, 0, 0.75);
}

/* Hint text below play button for Safari/WebKit direct-open */
.bbfsync-fb-direct-hint {
    position: absolute;
    top: calc(50% + 52px);
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.6);
    padding: 6px 16px;
    border-radius: 12px;
    pointer-events: none;
    letter-spacing: 0.3px;
    text-align: center;
    line-height: 1.5;
    max-width: 90%;
}

@media (max-width: 768px) {
    .bbfsync-fb-play-icon {
        width: 56px;
        height: 56px;
        font-size: 18px;
    }
    .bbfsync-yt-play-icon {
        width: 56px;
        height: 40px;
    }
}

/* Tablet/Mobile lightbox - stack vertically */
@media (max-width: 1024px) {
    .bbfsync-posts-carousel .bbfsync-post {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .bbfsync-lightbox-split {
        flex-direction: column;
    }
    .bbfsync-lightbox-sidebar {
        width: 100%;
        max-height: 45%;
        border-left: none;
        border-top: 1px solid rgba(0,0,0,0.1);
    }
    .bbfsync-lightbox-media {
        min-height: 40%;
        max-height: 55%;
    }
    .bbfsync-lightbox-container { width: 96vw; height: 90vh; }
    .bbfsync-lightbox-container:has(.bbfsync-lb-no-media) { height: auto; max-height: 90vh; }

    /* Sidebar engagement at bottom */
    .bbfsync-lightbox-sidebar .bbfsync-post-engagement {
        padding: 8px 16px;
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    /* === MOBILE LIGHTBOX FULLSCREEN === */

    /* Fullscreen container with safe areas — border-box so padding is inside 100dvh */
    .bbfsync-lightbox-container {
        width: 100% !important;
        max-width: 100% !important;
        height: 100dvh !important;
        box-sizing: border-box !important;
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .bbfsync-lightbox-split {
        border-radius: 0 !important;
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
    }

    /* Close button: 44px tap target, safe area offset, z-index above FB iframe */
    .bbfsync-lightbox-close {
        top: calc(env(safe-area-inset-top, 0px) + 8px) !important;
        right: 8px !important;
        width: 44px !important;
        height: 44px !important;
        font-size: 30px !important;
        background: rgba(0, 0, 0, 0.7) !important;
        opacity: 1 !important;
        z-index: 99999 !important;
        pointer-events: auto !important;
    }

    /* When video embed is active, move close button left to avoid FB's fullscreen icon */
    .bbfsync-video-embed-active .bbfsync-lightbox-close,
    .bbfsync-lightbox-container:has(.bbfsync-lightbox-fb-embed) .bbfsync-lightbox-close {
        right: auto !important;
        left: 8px !important;
    }

    /* ── MEDIA AREA: positioning context for absolute children ── */
    .bbfsync-lightbox-media {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        overflow: hidden !important;
        position: relative !important;
        background: #000 !important;
        height: 55dvh !important;
        max-height: none !important;
        min-height: auto !important;
        flex: 0 0 auto !important;
    }

    /* Portrait video: taller media area */
    .bbfsync-lightbox-media.bbfsync-lb-video.bbfsync-portrait-video {
        height: 70dvh !important;
    }

    /* ── IMAGE: normal flow, fill height ── */
    .bbfsync-lightbox-img {
        width: 100% !important;
        height: 55dvh !important;
        max-height: 55dvh !important;
        max-width: 100% !important;
        object-fit: contain !important;
        object-position: center center !important;
        flex: 0 0 auto !important;
        background: #000 !important;
        position: relative !important;
    }

    /* Hidden image (video posts): collapse */
    .bbfsync-lightbox-img[style*="display: none"],
    .bbfsync-lightbox-img[style*="display:none"] {
        height: 0 !important;
        flex: 0 0 0 !important;
    }

    /* ── VIDEO THUMBNAIL: absolutely centered in media area ── */
    .bbfsync-lb-video .bbfsync-lightbox-img {
        position: absolute !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 100% !important;
        height: auto !important;
        max-height: 55dvh !important;
        max-width: 100% !important;
        object-fit: contain !important;
        background: transparent !important;
    }

    /* Portrait video thumbnail: can be taller */
    .bbfsync-lb-video.bbfsync-portrait-video .bbfsync-lightbox-img {
        max-height: 70dvh !important;
    }

    /* ── FB EMBED on mobile ── */
    .bbfsync-lightbox-fb-embed {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 70dvh !important;
        max-height: 70dvh !important;
        margin: 0 auto !important;
        border-radius: 0 !important;
        overflow: hidden !important;
        background: #000 !important;
    }

    .bbfsync-lightbox-fb-embed.bbfsync-lightbox-fb-portrait {
        aspect-ratio: 9 / 16 !important;
        width: auto !important;
        height: 70dvh !important;
    }

    .bbfsync-lightbox-fb-embed iframe {
        width: 100% !important;
        height: 100% !important;
        border: none !important;
    }

    /* YouTube embed — 70dvh */
    .bbfsync-lightbox-yt-embed {
        position: relative !important;
        width: 100% !important;
        height: 70dvh !important;
        max-height: 70dvh !important;
        flex: 0 0 auto !important;
    }

    /* Video play overlays — above absolute image */
    .bbfsync-yt-video-box,
    .bbfsync-fb-video-box {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        z-index: 5 !important;
    }

    /* ── P2: COUNTER — small pill overlay on media, not a bar ── */
    .bbfsync-lightbox-counter {
        position: absolute !important;
        top: 10px !important;
        left: 50% !important;
        bottom: auto !important;
        transform: translateX(-50%) !important;
        display: inline-block !important;
        background: rgba(0, 0, 0, 0.55) !important;
        color: #fff !important;
        padding: 3px 12px !important;
        border-radius: 12px !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        z-index: 10 !important;
        pointer-events: none !important;
        margin: 0 !important;
    }

    /* ── P6: DIVIDER between media and content ── */
    /* ── P1/P4: SIDEBAR fills remaining space ── */
    .bbfsync-lightbox-sidebar {
        flex: 1 1 0 !important;
        max-height: none !important;
        min-height: 0 !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        border-top: 1px solid #e0e0e0 !important;
    }

    /* Post content: flex column fills sidebar */
    .bbfsync-lightbox-sidebar .bbfsync-lightbox-post-content {
        flex: 1 1 0 !important;
        display: flex !important;
        flex-direction: column !important;
        min-height: 0 !important;
    }

    /* Header: pinned at top */
    .bbfsync-lightbox-sidebar .bbfsync-post-header {
        flex-shrink: 0 !important;
    }

    /* Message: scrollable, fills space between header and engagement */
    .bbfsync-lightbox-sidebar .bbfsync-post-message {
        -webkit-line-clamp: unset !important;
        max-height: none !important;
        flex: 1 1 0 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        min-height: 0 !important;
    }

    /* ── P4: REACTIONS anchored to bottom ── */
    .bbfsync-lightbox-sidebar .bbfsync-post-engagement {
        flex-shrink: 0 !important;
        padding: 10px 16px !important;
        border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
        margin-top: auto !important;
    }

    /* ── P5: TEXT-ONLY posts — no media, sidebar fills screen ── */
    .bbfsync-lb-no-media .bbfsync-lightbox-media {
        display: none !important;
    }
    .bbfsync-lb-no-media .bbfsync-lightbox-sidebar {
        flex: 1 1 100% !important;
        border-top: none !important;
        overflow-y: auto !important;
    }

    /* ── ARROWS ── */
    .bbfsync-lightbox-prev,
    .bbfsync-lightbox-next {
        width: 44px !important;
        height: 44px !important;
        font-size: 22px !important;
        background: rgba(0, 0, 0, 0.5) !important;
        opacity: 0.5 !important;
    }

    .bbfsync-lightbox-prev:active,
    .bbfsync-lightbox-next:active {
        opacity: 0.85 !important;
    }

    .bbfsync-lightbox-prev { left: 8px !important; }
    .bbfsync-lightbox-next { right: 8px !important; }

    /* ── DIM arrows when video embed is playing (JS class fallback + :has) ── */
    .bbfsync-lightbox-split:has(.bbfsync-lightbox-media.bbfsync-video-active) > .bbfsync-lightbox-prev,
    .bbfsync-lightbox-split:has(.bbfsync-lightbox-media.bbfsync-video-active) > .bbfsync-lightbox-next,
    .bbfsync-lightbox-split:has(.bbfsync-lightbox-fb-embed) > .bbfsync-lightbox-prev,
    .bbfsync-lightbox-split:has(.bbfsync-lightbox-fb-embed) > .bbfsync-lightbox-next,
    .bbfsync-lightbox-split:has(.bbfsync-lightbox-yt-embed) > .bbfsync-lightbox-prev,
    .bbfsync-lightbox-split:has(.bbfsync-lightbox-yt-embed) > .bbfsync-lightbox-next {
        opacity: 0.2 !important;
    }

    /* Hide thumbnail strip on mobile */
    .bbfsync-lightbox-thumbs {
        display: none !important;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .bbfsync-posts-masonry {
        column-count: var(--bbfsync-columns-tablet, 2);
    }
}

@media (max-width: 768px) {
    .bbfsync-posts-masonry {
        column-count: var(--bbfsync-columns-mobile, 1);
    }

    /* Hide arrows on mobile - swipe is the primary interaction */
    .bbfsync-carousel-arrow {
        display: none;
    }

    /* Remove gap left by hidden arrows */
    .bbfsync-carousel-wrapper {
        gap: 0;
    }

    .bbfsync-posts-carousel .bbfsync-post {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Let images breathe on mobile - no fixed height cap */
    .bbfsync-posts-carousel .bbfsync-post .bbfsync-post-inner .bbfsync-post-media {
        max-height: none;
    }
    .bbfsync-posts-carousel .bbfsync-post .bbfsync-post-inner .bbfsync-post-media img {
        height: auto;
        max-height: 50vh;
    }

    /* Lift text clamp on mobile single-column — more room to read */
    .bbfsync-posts-masonry .bbfsync-post-message,
    .bbfsync-posts-boxed .bbfsync-post-message {
        -webkit-line-clamp: unset;
        display: block;
        overflow: visible;
        white-space: pre-line;
    }
    .bbfsync-posts-masonry .bbfsync-see-more,
    .bbfsync-posts-boxed .bbfsync-see-more {
        display: inline;
    }
    /* Allow more text on mobile single-card view */
    .bbfsync-posts-carousel .bbfsync-post .bbfsync-post-inner .bbfsync-post-message {
        -webkit-line-clamp: 6;
        max-height: none;
    }

    .bbfsync-header-cover { max-height: 150px; }

    .bbfsync-video-lightbox-content {
        width: 95% !important;
        max-width: 95% !important;
    }

    .bbfsync-video-mute-btn {
        width: 32px;
        height: 32px;
        bottom: 8px;
        left: 8px;
    }

    .bbfsync-video-mute-btn svg {
        width: 16px;
        height: 16px;
    }
}

/* Video Lightbox */
.bbfsync-video-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bbfsync-video-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
}

.bbfsync-video-lightbox-content {
    position: relative;
    z-index: 2;
    width: 80%;
    max-width: 900px;
}

.bbfsync-video-lightbox-player {
    width: 100%;
    line-height: 0;
}

.bbfsync-video-lightbox-player .fb-video,
.bbfsync-video-lightbox-player .fb-video span,
.bbfsync-video-lightbox-player .fb-video iframe {
    width: 100% !important;
}

.bbfsync-video-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    padding: 5px 10px;
    line-height: 1;
}

.bbfsync-video-lightbox-close:hover {
    color: #ccc;
}

.bbfsync-video-trigger {
    display: block;
    position: relative;
    cursor: pointer;
}

.bbfsync-video-trigger img {
    width: 100%;
    height: auto;
    display: block;
}

/* Carousel post click cursor */
.bbfsync-post-clickable {
    cursor: pointer;
}

/* ========================
   DARK SCHEME (static rules)
   ======================== */
.bbfsync-feed.bbfsync-scheme-dark .bbfsync-post {
    box-shadow: 0 1px 3px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.03);
}
.bbfsync-feed.bbfsync-scheme-dark .bbfsync-post:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.06);
}
.bbfsync-feed.bbfsync-scheme-dark .bbfsync-header {
    background: linear-gradient(135deg, #121212 0%, #1a1a1a 100%);
    border-color: #2a2a2a;
}
.bbfsync-feed.bbfsync-scheme-dark .bbfsync-header-cover { opacity: 0.85; }
.bbfsync-feed.bbfsync-scheme-dark .bbfsync-post-engagement {
    border-top-color: #2a2a2a;
}
.bbfsync-feed.bbfsync-scheme-dark .bbfsync-view-on-fb,
.bbfsync-feed.bbfsync-scheme-dark .bbfsync-share-link {
    color: #589BFF;
}
.bbfsync-feed.bbfsync-scheme-dark .bbfsync-feed-footer {
    background: #121212;
    border-top-color: #2a2a2a;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.3);
}
.bbfsync-feed.bbfsync-scheme-dark .bbfsync-carousel-arrow {
    background: #2a2a2a; color: #e4e6eb; border-color: #333333;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.bbfsync-feed.bbfsync-scheme-dark .bbfsync-carousel-arrow:hover {
    background: #333333;
}
.bbfsync-feed.bbfsync-scheme-dark .bbfsync-posts-carousel .bbfsync-post-media img {
    background: #0a0a0a;
}
.bbfsync-lightbox.bbfsync-scheme-dark .bbfsync-lightbox-container {
    background: #121212;
}
.bbfsync-lightbox.bbfsync-scheme-dark .bbfsync-lightbox-sidebar {
    background: #121212; color: #e4e6eb; border-color: #2a2a2a;
}
.bbfsync-lightbox.bbfsync-scheme-dark .bbfsync-lightbox-close {
    color: #e4e6eb;
}
.bbfsync-lightbox.bbfsync-scheme-dark .bbfsync-lightbox-nav {
    color: #e4e6eb;
}
.bbfsync-lightbox.bbfsync-scheme-dark .bbfsync-yt-video-box,
.bbfsync-lightbox.bbfsync-scheme-dark .bbfsync-fb-video-box {
    background: #0a0a0a;
}
.bbfsync-feed.bbfsync-scheme-dark .bbfsync-load-more {
    background: #589BFF !important; color: #fff !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.bbfsync-feed.bbfsync-scheme-dark .bbfsync-load-more:hover {
    background: #4A8AF0 !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}
.bbfsync-feed.bbfsync-scheme-dark .bbfsync-error {
    background: #2a1215;
    border-color: #5c2b2e;
    color: #f5a3a8;
}

/* ========================
   LIGHT SCHEME (static rules)
   ======================== */
.bbfsync-feed.bbfsync-scheme-light {
    --bbfsync-bg-posts: #ffffff;
    --bbfsync-bg-elements: #ffffff;
    --bbfsync-text-primary: #1c1e21;
    --bbfsync-text-secondary: #65676b;
    --bbfsync-link-color: #1877F2;
}
