/**
 * BuddyBoss Instagram Reels Embed - Frontend Styles
 * Version: 1.0.0
 */

/* Container */
.bbir-embed-container {
    width: 100%;
    margin: 15px auto;
    clear: both;
}

/* Wrapper for responsive aspect ratio */
.bbir-embed-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 177.78%; /* 9:16 aspect ratio for reels */
    height: 0;
    overflow: hidden;
    background: #fafafa;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Iframe styling */
.bbir-instagram-embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

/* Loading state */
.bbir-embed-wrapper::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #dbdbdb;
    border-top-color: #8e44ad;
    border-radius: 50%;
    animation: bbir-spin 1s linear infinite;
    z-index: 1;
}

.bbir-embed-wrapper.loaded::before {
    display: none;
}

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

/* Error message */
.bbir-error {
    padding: 15px 20px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    color: #856404;
    font-size: 14px;
    text-align: center;
    margin: 15px 0;
}

/* BuddyBoss Activity Feed Specific */
.activity-inner .bbir-embed-container,
.activity-content .bbir-embed-container {
    margin: 10px 0;
    max-width: 100%;
}

.activity-inner .bbir-embed-wrapper,
.activity-content .bbir-embed-wrapper {
    max-width: 400px;
}

/* Activity Comments */
.acomment-content .bbir-embed-container {
    margin: 8px 0;
}

.acomment-content .bbir-embed-wrapper {
    max-width: 320px;
}

/* BuddyBoss Forum Topics & Replies */
.bbp-reply-content .bbir-embed-container,
.bbp-topic-content .bbir-embed-container {
    margin: 15px 0;
}

/* Post Content */
.entry-content .bbir-embed-container,
.post-content .bbir-embed-container {
    margin: 20px auto;
}

/* Widget */
.widget .bbir-embed-container {
    margin: 10px 0;
}

.widget .bbir-embed-wrapper {
    max-width: 100%;
}

/* Comments */
.comment-content .bbir-embed-container {
    margin: 10px 0;
}

.comment-content .bbir-embed-wrapper {
    max-width: 360px;
}

/* BuddyBoss Messages */
.message-content .bbir-embed-container {
    margin: 8px 0;
}

.message-content .bbir-embed-wrapper {
    max-width: 300px;
}

/* Mobile Responsive */
@media screen and (max-width: 768px) {
    .bbir-embed-container {
        margin: 10px 0;
    }
    
    .bbir-embed-wrapper {
        max-width: 100% !important;
    }
    
    .activity-inner .bbir-embed-wrapper,
    .activity-content .bbir-embed-wrapper,
    .acomment-content .bbir-embed-wrapper,
    .comment-content .bbir-embed-wrapper {
        max-width: 100% !important;
    }
}

@media screen and (max-width: 480px) {
    .bbir-embed-container {
        margin: 8px 0;
    }
    
    .bbir-embed-wrapper {
        border-radius: 4px;
    }
    
    .bbir-instagram-embed {
        border-radius: 4px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .bbir-embed-wrapper {
        background: #262626;
    }
    
    .bbir-error {
        background: #3d3200;
        border-color: #6b5a00;
        color: #ffc107;
    }
}

/* BuddyBoss Dark Mode */
body.bb-dark-theme .bbir-embed-wrapper,
.bb-dark-theme .bbir-embed-wrapper {
    background: #262626;
}

body.bb-dark-theme .bbir-error,
.bb-dark-theme .bbir-error {
    background: #3d3200;
    border-color: #6b5a00;
    color: #ffc107;
}

/* Gutenberg Block Editor Preview */
.wp-block .bbir-embed-container {
    margin: 20px 0;
}

/* Centered alignment */
.aligncenter .bbir-embed-container,
.has-text-align-center .bbir-embed-container {
    margin-left: auto;
    margin-right: auto;
}

/* Print styles - hide embeds */
@media print {
    .bbir-embed-container {
        display: none;
    }
}

/* Animation for embed load */
.bbir-embed-container {
    animation: bbir-fadeIn 0.3s ease-in-out;
}

@keyframes bbir-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Square posts (regular Instagram posts) */
.bbir-embed-container[data-type="post"] .bbir-embed-wrapper {
    padding-bottom: 100%; /* 1:1 aspect ratio */
}

/* Hover effect */
.bbir-embed-wrapper:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.2s ease;
}
