/**
 * Facebook Group Posts Display - Frontend Styles
 */

/* Container */
.fbgp-container {
    margin: 20px 0;
}

/* Error and no posts messages */
.fbgp-error,
.fbgp-no-posts {
    padding: 20px;
    background: #f8f8f8;
    border-left: 4px solid #dc3545;
    margin: 20px 0;
    color: #333;
}

.fbgp-no-posts {
    border-left-color: #6c757d;
}

/* List Layout */
.fbgp-layout-list .fbgp-post {
    display: flex;
    flex-direction: row;
    gap: 20px;
    padding: 25px;
    margin-bottom: 20px;
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s ease;
}

.fbgp-layout-list .fbgp-post:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.fbgp-layout-list .fbgp-post-image {
    flex: 0 0 200px;
    max-width: 200px;
}

.fbgp-layout-list .fbgp-post-content {
    flex: 1;
    min-width: 0;
}

/* Grid Layout */
.fbgp-layout-grid {
    display: grid;
    gap: 20px;
}

.fbgp-columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.fbgp-columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.fbgp-columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.fbgp-layout-grid .fbgp-post {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.fbgp-layout-grid .fbgp-post:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.fbgp-layout-grid .fbgp-post-image {
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.fbgp-layout-grid .fbgp-post-content {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Post Image */
.fbgp-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 6px;
}

.fbgp-layout-grid .fbgp-post-image img {
    border-radius: 0;
}

/* Post Author */
.fbgp-post-author {
    margin-bottom: 8px;
}

.fbgp-author-name {
    font-weight: 600;
    color: #1877f2;
    font-size: 0.95em;
}

/* Post Date */
.fbgp-post-date {
    font-size: 0.85em;
    color: #65676b;
    margin-bottom: 12px;
}

/* Post Message */
.fbgp-post-message {
    font-size: 1em;
    line-height: 1.6;
    color: #1c1e21;
    margin-bottom: 15px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.fbgp-post-message a {
    color: #1877f2;
    text-decoration: none;
}

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

/* Post Story (for activity posts without message) */
.fbgp-post-story {
    font-size: 0.95em;
    color: #65676b;
    font-style: italic;
    margin-bottom: 15px;
}

/* View on Facebook Link */
.fbgp-post-link {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #f0f2f5;
}

.fbgp-post-link a {
    display: inline-flex;
    align-items: center;
    color: #1877f2;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    transition: color 0.2s ease;
}

.fbgp-post-link a:hover {
    color: #166fe5;
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 992px) {
    .fbgp-columns-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .fbgp-columns-3,
    .fbgp-columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .fbgp-layout-list .fbgp-post {
        flex-direction: column;
    }
    
    .fbgp-layout-list .fbgp-post-image {
        flex: none;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .fbgp-columns-2,
    .fbgp-columns-3,
    .fbgp-columns-4 {
        grid-template-columns: 1fr;
    }
    
    .fbgp-layout-list .fbgp-post,
    .fbgp-layout-grid .fbgp-post-content {
        padding: 15px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .fbgp-post {
        background: #242526;
        border-color: #3e4042;
    }
    
    .fbgp-post-message {
        color: #e4e6eb;
    }
    
    .fbgp-post-date,
    .fbgp-post-story {
        color: #b0b3b8;
    }
    
    .fbgp-post-link {
        border-top-color: #3e4042;
    }
    
    .fbgp-error,
    .fbgp-no-posts {
        background: #3a3b3c;
        color: #e4e6eb;
    }
}

/* Facebook Brand Colors (optional class modifiers) */
.fbgp-facebook-themed .fbgp-post {
    border-top: 3px solid #1877f2;
}

.fbgp-facebook-themed .fbgp-post-link a::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 6px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%231877f2'%3E%3Cpath d='M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

/* Animation for loading state */
.fbgp-loading {
    text-align: center;
    padding: 40px;
}

.fbgp-loading::after {
    content: '';
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #1877f2;
    border-radius: 50%;
    animation: fbgp-spin 1s linear infinite;
}

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