/**
 * Blog Posts Component Styles
 * 
 * Styles for the latest posts section on the home page
 * modified 20250602 1026
 */

/* Latest Posts Section */
.latest-posts-section {
    background-color: #f8f9fa;
}

.latest-posts-section h2 {
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 2rem;
}

/* Post Cards */
.post-card {
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    overflow: hidden;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    border-color: #007bff;
}

.post-card .card-title {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

.post-card .card-title a {
    color: var(--paynow-purple, #7d1979);
    text-decoration: none;
    transition: color 0.3s ease;
}

.post-card .card-title a:hover {
    color: var(--paynow-light-purple, #9e3c9a);
    text-decoration: none;
}

.post-card .card-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #6c757d;
}

.post-card .card-text.text-muted {
    font-size: 0.8rem;
    color: #868e96 !important;
}

.post-card .card-text.text-muted i {
    color: #007bff;
}

/* Category Badge */
.post-card .badge {
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
}

/* Card Footer */
.post-card .card-footer {
    padding: 1rem;
    background-color: transparent;
}

.post-card .btn-outline-primary {
    font-size: 0.85rem;
    padding: 0.375rem 0.75rem;
    border-width: 1px;
    transition: all 0.3s ease;
}

.post-card .btn-outline-primary:hover {
    transform: translateX(2px);
}

/* View All Posts Button */
.latest-posts-section .btn-primary {
    padding: 0.75rem 2rem;
    font-weight: 500;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
}

.latest-posts-section .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 123, 255, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .latest-posts-section {
        padding: 3rem 0;
    }
    
    .latest-posts-section h2 {
        font-size: 1.75rem;
        margin-bottom: 1.5rem;
    }
    
    .post-card .card-title {
        font-size: 1rem;
    }
    
    .post-card .card-text {
        font-size: 0.85rem;
    }
}

@media (max-width: 576px) {
    .post-card {
        margin-bottom: 1rem;
    }
    
    .post-card .card-body {
        padding: 1rem;
    }
    
    .post-card .card-footer {
        padding: 0.75rem 1rem;
    }
}

/* Loading State (for future enhancement) */
.post-card.loading {
    opacity: 0.6;
    pointer-events: none;
}

.post-card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error State */
.latest-posts-error {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
    font-style: italic;
}

.latest-posts-error i {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #dc3545;
}

/* No Posts State */
.no-posts-message {
    text-align: center;
    padding: 3rem 2rem;
    color: #6c757d;
}

.no-posts-message i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #007bff;
}

.no-posts-message h4 {
    color: #495057;
    margin-bottom: 1rem;
}
/* Post Thumbnail Styles */
.post-thumbnail-container {
    width: 100%;
    overflow: hidden;
    background-color: #f8f9fa; /* Light background for loading */
    position: relative;
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
}

/* Modern browsers: Use aspect-ratio */
@supports (aspect-ratio: 16 / 9) {
    .post-thumbnail-container {
        aspect-ratio: 16 / 9;
    }
}

/* Fallback for older browsers: Padding-bottom hack */
@supports not (aspect-ratio: 16 / 9) {
    .post-thumbnail-container {
        height: 0;
        padding-bottom: 56.25%; /* 9 / 16 * 100% */
    }
}

.post-thumbnail {
    display: block;
    object-fit: cover; /* Fill container, crop if necessary */
    object-position: center center; /* Center the image */
}

/* Ensure image fills container for both modern and fallback */
@supports (aspect-ratio: 16 / 9) {
    .post-thumbnail {
        width: 100%;
        height: 100%;
    }
}

@supports not (aspect-ratio: 16 / 9) {
    .post-thumbnail {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
}


/* Adjustments for post-card if thumbnail is present */
/* .post-card .card-body { */
    /* If thumbnails are always present or you want consistent padding */
    /* padding-top: 0; */ /* If thumbnail container is directly above */
/* } */