/**
 * Facebook Feeds Embedder - Frontend Stylesheet
 * Custom responsive styling for embedded feeds and lightbox popups.
 * Designed by Sadam Hussain Brohi (SRSO-IT).
 */

.fb-feed-embed-container {
    position: relative;
    display: block;
    margin-bottom: 25px;
    width: 100%;
    transition: all 0.3s ease;
}

.fb-feed-embed-container iframe {
    display: block;
    max-width: 100%;
    margin: 0;
    transition: box-shadow 0.3s ease, border-radius 0.3s ease;
}

/* Alignment Classes */
.fb-feed-embed-container.fb-align-center {
    margin-left: auto !important;
    margin-right: auto !important;
}

.fb-feed-embed-container.fb-align-right {
    margin-left: auto !important;
    margin-right: 0 !important;
}

.fb-feed-embed-container.fb-align-left {
    margin-left: 0 !important;
    margin-right: auto !important;
}

/* Video Placeholder / Custom Cover Card Styling */
.fb-video-placeholder {
    cursor: pointer;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: #0f172a;
}

/* Fallback card if no cover image is uploaded */
.fb-video-placeholder.fb-no-cover {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.fb-video-placeholder-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    transition: background 0.3s ease;
    padding: 20px;
}

.fb-video-placeholder:hover .fb-video-placeholder-inner {
    background: rgba(15, 23, 42, 0.6);
}

/* Glowing Pulse Play Button */
.fb-play-overlay {
    margin-bottom: 15px;
    z-index: 2;
}

.fb-play-btn-glowing {
    width: 76px;
    height: 76px;
    background: #1877f2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 0 rgba(24, 119, 242, 0.6);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: fb-pulse-glow 2s infinite;
}

.fb-play-btn-glowing span.dashicons-controls-play {
    font-size: 36px;
    width: 36px;
    height: 36px;
    color: #ffffff;
    margin-left: 4px; /* Align play triangle visually */
}

.fb-video-placeholder:hover .fb-play-btn-glowing {
    transform: scale(1.15);
    background: #0056c6;
    box-shadow: 0 0 0 15px rgba(24, 119, 242, 0);
    animation: none;
}

@keyframes fb-pulse-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(24, 119, 242, 0.6);
    }
    70% {
        box-shadow: 0 0 0 16px rgba(24, 119, 242, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(24, 119, 242, 0);
    }
}

.fb-video-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    opacity: 0.85;
    transition: opacity 0.3s ease;
}

.fb-video-placeholder:hover .fb-video-card-meta {
    opacity: 1;
}

.fb-card-logo {
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: #1877f2;
}

/* Lightbox Modal CSS Overlay */
.fb-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.95);
    z-index: 99999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.fb-lightbox-overlay.fb-active {
    opacity: 1;
    visibility: visible;
}

/* Prevent body scrolling when active */
body.fb-lightbox-active {
    overflow: hidden !important;
}

.fb-lightbox-container {
    position: relative;
    width: 90%;
    max-width: 960px;
    aspect-ratio: 16 / 9;
    transform: scale(0.9);
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fb-lightbox-overlay.fb-active .fb-lightbox-container {
    transform: scale(1);
}

/* Close Button */
.fb-lightbox-close {
    position: absolute;
    top: -45px;
    right: 0;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 40px;
    cursor: pointer;
    line-height: 1;
    opacity: 0.7;
    transition: all 0.2s ease;
    padding: 5px;
}

.fb-lightbox-close:hover {
    opacity: 1;
    transform: scale(1.15);
}

.fb-lightbox-iframe-wrapper {
    width: 100%;
    height: 100%;
    background: #000000;
    overflow: hidden;
    position: relative;
}

/* Lightbox Loading Spinner */
.fb-lightbox-spinner-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.fb-spinner-light {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #1877f2;
    border-radius: 50%;
    animation: fb-spin-light 1s linear infinite;
}

@keyframes fb-spin-light {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .fb-feed-embed-container {
        width: 100% !important;
        max-width: 100% !important;
    }

    .fb-feed-embed-container.fb-type-video.fb-aspect-ratio-applied {
        height: auto !important;
        aspect-ratio: var(--fb-aspect-ratio, 16/9) !important;
    }
    
    .fb-feed-embed-container iframe,
    .fb-feed-embed-container .fb-video-placeholder {
        width: 100% !important;
        height: 100% !important;
    }

    .fb-lightbox-close {
        top: -40px;
        right: 10px;
        font-size: 34px;
    }
}
