/* Remove the old .ddd-top-posts class as it's conflicting */
.ddd-top-posts {
    display: none;
}

/* Minimal Display Styles */
.ddd-top-posts-minimal {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ddd-top-posts-minimal li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.ddd-top-posts-minimal li:last-child {
    border-bottom: none;
}

.ddd-top-posts-minimal .post-views {
    color: #666;
    font-size: 0.9em;
}

/* Full Display Styles */
.ddd-top-post {
    margin-bottom: 0; /* Remove margin as grid gap handles spacing */
    padding-bottom: 0;
    border-bottom: none; /* Remove border as grid layout provides visual separation */
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.ddd-top-post:hover {
    transform: translateY(-5px);
}

.ddd-top-post .post-thumbnail {
    margin-bottom: 1em;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

.ddd-top-post .post-thumbnail img {
    max-width: 100%;
    height: auto;
    display: block;
}

.ddd-top-post .post-content {
    padding: 1em;
}

.ddd-top-post h3 {
    margin: 0 0 0.5em 0;
    font-size: 1.2em;
}

.ddd-top-post h3 a {
    text-decoration: none;
    color: #333;
}

.ddd-top-post h3 a:hover {
    color: #0073aa;
}

.ddd-top-post .post-excerpt {
    margin-bottom: 1em;
    color: #666;
    line-height: 1.6;
}

.ddd-top-post .post-views {
    font-size: 0.9em;
    color: #666;
    font-style: italic;
}

/* Tablet Layout (768px and up) */
@media screen and (min-width: 768px) {
    .ddd-top-posts {
        grid-template-columns: repeat(2, 1fr); /* 2 columns */
    }
}

/* Desktop Layout (1024px and up) */
@media screen and (min-width: 1024px) {
    .ddd-top-posts {
        grid-template-columns: repeat(3, 1fr); /* 3 columns */
    }
}

/* Grid Container */
.ddd-top-posts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin: 2rem 0;
    padding: 0 1rem;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

/* Post Card Styling */
.ddd-top-post {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Thumbnail */
.ddd-post-thumbnail {
    position: relative;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
}

.ddd-post-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Content Area */
.ddd-post-content {
    padding: 1.5rem;
}

.ddd-post-content h3 {
    margin: 0 0 1rem;
    font-size: 1.2rem;
    line-height: 1.4;
}

.ddd-post-content h3 a {
    color: #333;
    text-decoration: none;
}

.ddd-post-content h3 a:hover {
    color: #0073aa;
}

.ddd-post-excerpt {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.ddd-post-views {
    color: #666;
    font-size: 0.9rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

/* Responsive Grid */
@media screen and (min-width: 768px) {
    .ddd-top-posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
}

@media screen and (min-width: 1024px) {
    .ddd-top-posts-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
}