/* Dynamic News Grid - Same Structure as News Page */

/* News section container */
.section-news {
    background: #ffffff;/*#f8f9fa*/
}

.section-news .heading-section {
    margin-bottom: 50px;
    position: relative;
}

.section-news .heading-section::after {
    content: '';
    width: 80px;
    height: 3px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 2px;
}

.dynamic-news-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-between;
    align-items: stretch;
    padding: 20px 0;
}

/* 4 columns layout for dynamic news */
.dynamic-news-grid .post.post-loop.col-md-3 {
    flex: 1 1 calc(25% - 15px);
    min-width: 250px;
    max-width: 300px;
    margin-top: 40px;
    margin-bottom: 30px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* Post hover effect */
.dynamic-news-grid .post.post-loop.col-md-3:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* Post thumbs styling */
.dynamic-news-grid .post-thumbs {
    position: relative;
    overflow: hidden;
    border-radius: 0;
    margin-bottom: 0;
    flex-shrink: 0;
    width: 100%;
    height: 200px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dynamic-news-grid .post-thumbs img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    transition: transform 0.3s ease;
    display: block;
    border: none;
    outline: none;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.dynamic-news-grid .post-thumbs:hover img {
    transform: scale(1.08);
}

/* Fallback for images that don't load */
.dynamic-news-grid .post-thumbs::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #FFFFFF;/*linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%)*/
    z-index: -1;
}

/* Loading placeholder for images - only show when no image */
.dynamic-news-grid .post-thumbs::after {
    content: '\f03e';
    font-family: FontAwesome;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: #ccc;
    z-index: -1;
    opacity: 0;
}

/* Post entry styling */
.dynamic-news-grid .post-entry {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.dynamic-news-grid .post-meta {
    margin-bottom: 10px;
}

.dynamic-news-grid .post-meta .pub-date {
    color: #666;
    font-size: 14px;
}

.dynamic-news-grid .post-meta .fa-calendar {
    margin-right: 5px;
    color: #007bff;
}

.dynamic-news-grid h2 {
    font-size: 18px;
    line-height: 1.4;
    margin-bottom: 12px;
    font-weight: 600;
    flex-grow: 1;
}

.dynamic-news-grid h2 a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dynamic-news-grid h2 a:hover {
    color: #007bff;
}

.dynamic-news-grid p {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.dynamic-news-grid .btn-alt {
    background: #007bff;
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    display: inline-block;
    margin-top: auto;
    transition: all 0.3s ease;
    border: 2px solid #007bff;
}

.dynamic-news-grid .btn-alt:hover {
    background: #0056b3;
    color: white;
    border-color: #0056b3;
    transform: translateY(-2px);
}

/* Image aspect ratio optimization */
.dynamic-news-grid .post-thumbs img[src*=".jpg"],
.dynamic-news-grid .post-thumbs img[src*=".jpeg"], 
.dynamic-news-grid .post-thumbs img[src*=".png"],
.dynamic-news-grid .post-thumbs img[src*=".webp"] {
    object-fit: cover;
    object-position: center center;
}

/* For landscape images */
.dynamic-news-grid .post-thumbs img[width][height] {
    object-position: center top;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .dynamic-news-grid .post.post-loop.col-md-3 {
        flex: 1 1 calc(33.333% - 14px);
        max-width: none;
        margin-top: 40px;
    }
    
    .dynamic-news-grid .post-thumbs {
        height: 190px;
    }
}

@media (max-width: 768px) {
    .dynamic-news-grid {
        gap: 15px;
        justify-content: center;
    }
    
    .dynamic-news-grid .post.post-loop.col-md-3 {
        flex: 1 1 calc(50% - 8px);
        min-width: 280px;
        max-width: 350px;
        margin-top: 30px;
    }
    
    .dynamic-news-grid .post-thumbs {
        height: 180px;
    }
    
    .dynamic-news-grid .post-entry {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .dynamic-news-grid {
        gap: 15px;
        justify-content: center;
    }
    
    .dynamic-news-grid .post.post-loop.col-md-3 {
        flex: 1 1 100%;
        min-width: auto;
        max-width: 400px;
        margin-top: 25px;
    }
    
    .dynamic-news-grid .post-thumbs {
        height: 160px;
    }
    
    .dynamic-news-grid .post-thumbs img {
        object-fit: cover;
        object-position: center top;
    }
    
    .dynamic-news-grid h2 {
        font-size: 16px;
    }
}

/* No news available styling */
.dynamic-news-grid .no-news-available {
    flex: 1 1 100%;
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px dashed #ddd;
}

.dynamic-news-grid .no-news-available .fa-newspaper-o {
    display: block;
    margin-bottom: 20px;
}