/**
 * FB Feeds for Elementor - Frontend Styles
 */

/* ==========================================================================
   Base Styles
   ========================================================================== */

.fbfe-facebook-feed {
    width: 100%;
}

.fbfe-notice,
.fbfe-error,
.fbfe-empty-state {
    padding: 20px;
    text-align: center;
    background: #f8f9fa;
    border: 1px dashed #ddd;
    border-radius: 8px;
    color: #666;
}

.fbfe-error {
    background: #fff5f5;
    border-color: #fed7d7;
    color: #c53030;
}

/* ==========================================================================
   Header Styles
   ========================================================================== */

.fbfe-feed-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    margin-bottom: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.fbfe-page-picture {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.fbfe-page-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a1a1a;
}

/* ==========================================================================
   Grid Layout
   ========================================================================== */

.fbfe-feed-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.fbfe-layout-list .fbfe-feed-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.fbfe-layout-list .fbfe-post-card {
    display: flex;
    flex-direction: row;
}

.fbfe-layout-list .fbfe-post-image {
    width: 300px;
    min-width: 300px;
    height: auto;
}

.fbfe-layout-list .fbfe-post-content {
    flex: 1;
}

/* ==========================================================================
   Post Card
   ========================================================================== */

.fbfe-post-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* Hover Animations */
.fbfe-hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.fbfe-hover-scale:hover {
    transform: scale(1.02);
}

.fbfe-hover-shadow:hover {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.fbfe-hover-border:hover {
    border-color: #1877f2;
}

/* ==========================================================================
   Post Image
   ========================================================================== */

.fbfe-post-image {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.fbfe-post-image a {
    display: block;
    width: 100%;
    height: 100%;
}

.fbfe-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.fbfe-post-card:hover .fbfe-post-image img {
    transform: scale(1.05);
}

/* Image Overlay */
.fbfe-has-overlay .fbfe-post-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0);
    transition: background-color 0.3s ease;
    pointer-events: none;
}

.fbfe-has-overlay:hover .fbfe-post-image::after {
    background-color: rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   Post Content
   ========================================================================== */

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

.fbfe-post-message {
    font-size: 14px;
    line-height: 1.6;
    color: #444;
    margin-bottom: 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

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

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

.fbfe-read-more {
    display: inline-block;
    margin-left: 5px;
    color: #1877f2;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
}

.fbfe-read-more:hover {
    color: #0d5db8;
    text-decoration: underline;
}

/* ==========================================================================
   Post Meta
   ========================================================================== */

.fbfe-post-meta {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.fbfe-post-date {
    font-size: 12px;
    color: #888;
}

.fbfe-post-engagement {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 13px;
    color: #666;
}

.fbfe-post-engagement > span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.fbfe-icon {
    font-size: 14px;
}

.fbfe-count {
    font-weight: 500;
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.fbfe-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.fbfe-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #1877f2;
    border-radius: 50%;
    animation: fbfe-spin 1s linear infinite;
}

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

/* ==========================================================================
   Masonry Layout
   ========================================================================== */

.fbfe-layout-masonry .fbfe-feed-grid {
    display: block;
    column-count: 3;
    column-gap: 20px;
}

.fbfe-layout-masonry .fbfe-post-card {
    break-inside: avoid;
    margin-bottom: 20px;
}

.fbfe-layout-masonry .fbfe-post-image {
    height: auto;
}

/* ==========================================================================
   Carousel Layout
   ========================================================================== */

.fbfe-layout-carousel .fbfe-feed-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 20px;
    padding-bottom: 15px;
    -webkit-overflow-scrolling: touch;
}

.fbfe-layout-carousel .fbfe-post-card {
    flex: 0 0 300px;
    scroll-snap-align: start;
}

.fbfe-layout-carousel .fbfe-feed-grid::-webkit-scrollbar {
    height: 8px;
}

.fbfe-layout-carousel .fbfe-feed-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.fbfe-layout-carousel .fbfe-feed-grid::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.fbfe-layout-carousel .fbfe-feed-grid::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* ==========================================================================
   Editor Placeholders
   ========================================================================== */

.fbfe-placeholder {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: fbfe-shimmer 1.5s infinite;
}

.fbfe-placeholder-image {
    background: linear-gradient(90deg, #e8e8e8 25%, #d8d8d8 50%, #e8e8e8 75%);
    background-size: 200% 100%;
    animation: fbfe-shimmer 1.5s infinite;
    height: 200px;
}

@keyframes fbfe-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

@media (max-width: 1024px) {
    .fbfe-feed-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .fbfe-layout-masonry .fbfe-feed-grid {
        column-count: 2;
    }
    
    .fbfe-layout-list .fbfe-post-image {
        width: 250px;
        min-width: 250px;
    }
}

@media (max-width: 768px) {
    .fbfe-feed-grid {
        grid-template-columns: 1fr;
    }
    
    .fbfe-layout-masonry .fbfe-feed-grid {
        column-count: 1;
    }
    
    .fbfe-layout-list .fbfe-post-card {
        flex-direction: column;
    }
    
    .fbfe-layout-list .fbfe-post-image {
        width: 100%;
        min-width: auto;
        height: 200px;
    }
    
    .fbfe-layout-carousel .fbfe-post-card {
        flex: 0 0 280px;
    }
    
    .fbfe-feed-header {
        flex-direction: column;
        text-align: center;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .fbfe-post-card {
        background: #242526;
    }
    
    .fbfe-post-message {
        color: #e4e6eb;
    }
    
    .fbfe-post-date,
    .fbfe-post-engagement {
        color: #b0b3b8;
    }
    
    .fbfe-post-meta {
        border-top-color: #3e4042;
    }
    
    .fbfe-feed-header {
        background: #242526;
    }
    
    .fbfe-page-name {
        color: #e4e6eb;
    }
    
    .fbfe-notice,
    .fbfe-empty-state {
        background: #242526;
        border-color: #3e4042;
        color: #b0b3b8;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .fbfe-post-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .fbfe-post-image img {
        max-height: 200px;
    }
    
    .fbfe-layout-carousel .fbfe-feed-grid {
        flex-wrap: wrap;
        overflow: visible;
    }
}
