/**
 * Flatsome-like Blog Posts Shortcode Styling for Kadence Child
 */

:root {
    --fl-primary-color: #eeee22; /* Khớp với màu chủ đạo Kadence Child */
    --fl-bg-card: rgba(255, 255, 255, 0.05);
    --fl-border-card: rgba(255, 255, 255, 0.1);
    --fl-text-meta: rgba(255, 255, 255, 0.6);
    --fl-text-desc: rgba(255, 255, 255, 0.8);
    --fl-title-color: #f6e86a;
}

/* Container Wrapper */
.flatsome-blog-posts-wrapper {
    position: relative;
    width: 100%;
    margin: 2em 0;
}

/* Grid Layout */
.flatsome-blog-posts {
    --columns: 4;
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(var(--columns), 1fr);
    width: 100%;
}

/* Slider Layout (CSS Scroll Snap) */
.flatsome-blog-posts.layout-slider {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
    padding-bottom: 8px;
}

.flatsome-blog-posts.layout-slider::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.flatsome-blog-posts.layout-slider .fl-post-item-wrap {
    flex: 0 0 calc((100% - (var(--columns) - 1) * 24px) / var(--columns));
    scroll-snap-align: start;
    box-sizing: border-box;
}

/* Post Item Card */
.fl-post-item {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--fl-bg-card);
    border: 1px solid var(--fl-border-card);
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none !important;
    color: #ffffff !important;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                box-shadow 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                border-color 0.3s ease;
    box-sizing: border-box;
}

.fl-post-item:hover {
    border-color: var(--fl-primary-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Stretched Link Overlay */
.fl-stretched-link {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    overflow: hidden;
    text-indent: -9999px;
    white-space: nowrap;
}

/* Ensure nested links are clickable over the stretched link overlay */
.fl-post-meta a,
.fl-post-title a,
.fl-post-readmore {
    position: relative;
    z-index: 3;
}

/* Image Wrapper */
.fl-post-image {
    position: relative;
    width: 100%;
    overflow: hidden;
    background-color: #111;
}

.fl-post-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.fl-post-item:hover .fl-post-image img {
    transform: scale(1.06);
}

/* Flatsome Date Badge */
.fl-post-date-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    background-color: var(--fl-primary-color);
    color: #000000 !important;
    text-align: center;
    border-radius: 4px;
    font-weight: 800;
    min-width: 48px;
    padding: 6px 4px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    line-height: 1.1;
    pointer-events: none;
}


.fl-post-date-badge .fl-date-day {
    display: block;
    font-size: 18px;
    font-family: 'Outfit', 'Inter', -apple-system, sans-serif;
    letter-spacing: -0.5px;
}

.fl-post-date-badge .fl-date-month {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    opacity: 0.9;
}

/* Post Content Area */
.fl-post-content {
    display: flex;
    flex-direction: column;
    padding: 20px;
    flex-grow: 1;
}

.fl-post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--fl-text-meta);
    margin-bottom: 8px;
}

.fl-post-meta a {
    color: var(--fl-primary-color) !important;
    font-weight: 600;
    text-transform: uppercase;
    text-decoration: none !important;
}

.fl-post-meta a:hover {
    text-decoration: underline !important;
}

.fl-post-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--fl-title-color) !important;
    margin: 0 0 10px 0;
    transition: color 0.2s ease;
}

.fl-post-item:hover .fl-post-title {
    color: #ffffff !important;
}

.fl-post-excerpt {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--fl-text-desc);
    margin: 0 0 16px 0;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Read More Link */
.fl-post-readmore {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--fl-primary-color) !important;
    text-decoration: none !important;
    margin-top: auto;
    letter-spacing: 0.5px;
    transition: gap 0.2s ease;
}

.fl-post-readmore svg {
    fill: currentColor;
    transition: transform 0.2s ease;
}

.fl-post-item:hover .fl-post-readmore {
    gap: 10px;
}

/* ==========================================================================
   STYLE: Bounce
   ========================================================================== */
.style-bounce {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                box-shadow 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                border-color 0.3s ease;
}

.style-bounce:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: 0 15px 35px rgba(246, 232, 106, 0.15);
    border-color: var(--fl-primary-color);
}

/* ==========================================================================
   STYLE: Row (Horizontal Layout)
   ========================================================================== */
.style-row {
    flex-direction: row;
}

.style-row .fl-post-image {
    width: 40%;
    min-height: 100%;
}

.style-row .fl-post-content {
    width: 60%;
    justify-content: center;
}

/* ==========================================================================
   STYLE: Overlay & Shade
   ========================================================================== */
.style-overlay, .style-shade {
    position: relative;
    overflow: hidden;
}

.style-overlay .fl-post-image, .style-shade .fl-post-image {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100%;
}

.style-overlay .fl-post-content, .style-shade .fl-post-content {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    padding: 24px;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.6) 60%, transparent 100%);
    justify-content: flex-end;
}

.style-shade .fl-post-content {
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.4) 40%, transparent 100%);
}

.style-overlay:hover .fl-post-content {
    background: linear-gradient(to top, rgba(0,0,0,0.98) 0%, rgba(0,0,0,0.7) 70%, rgba(0,0,0,0.1) 100%);
}

.style-overlay .fl-post-title, .style-shade .fl-post-title {
    color: #ffffff !important;
}

.style-overlay:hover .fl-post-title, .style-shade:hover .fl-post-title {
    color: var(--fl-primary-color) !important;
}

.style-overlay .fl-post-excerpt, .style-shade .fl-post-excerpt {
    color: rgba(255, 255, 255, 0.85);
}

/* ==========================================================================
   RESPONSIVENESS (Responsive Layout)
   ========================================================================== */
@media (max-width: 1024px) {
    .flatsome-blog-posts {
        --columns: 3 !important;
    }
    .flatsome-blog-posts.layout-slider .fl-post-item-wrap {
        flex: 0 0 calc((100% - (3 - 1) * 24px) / 3);
    }
}

@media (max-width: 768px) {
    .flatsome-blog-posts {
        --columns: 2 !important;
        gap: 16px;
    }
    
    .flatsome-blog-posts.layout-slider {
        gap: 16px;
    }
    
    .flatsome-blog-posts.layout-slider .fl-post-item-wrap {
        flex: 0 0 calc((100% - 16px) / 1.5); /* Show 1.5 cards */
    }
    
    .style-row {
        flex-direction: column;
    }
    
    .style-row .fl-post-image {
        width: 100%;
        height: 200px;
    }
    
    .style-row .fl-post-content {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .flatsome-blog-posts {
        --columns: 1 !important;
    }
    
    .flatsome-blog-posts.layout-slider .fl-post-item-wrap {
        flex: 0 0 calc(100% - 32px); /* Show 1 card + bit of next */
    }
    
    .fl-post-title {
        font-size: 15px;
    }
}
