/* Grid container */
.custom-post-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    margin: 0;
    padding: 0;
    width: 100%;
}

/* Clearfix */
.custom-post-grid-clearfix {
    clear: both;
}

/* Grid row */
.grid-row {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

/* Post item */
.custom-post-grid .post-item {
    box-sizing: border-box;
    margin: 0;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 4px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.custom-post-grid .post-item:hover {
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Grid layout */
.custom-post-grid.grid .post-item {
    width: calc(33.3333% - 30px);
    margin: 0 15px 15px;
}

.custom-post-grid.grid .post-content {
    padding: 10px;
}

/* List layout */
.custom-post-grid.list {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin: 0;
    padding: 0;
}

.custom-post-grid.list .post-item {
    width: 100%;
    display: block;
    margin: 0 0 10px 0;
    padding: 10px 0;
    border-left: 4px solid #0073aa;
    background: #f9f9f9;
    box-sizing: border-box;
}

.custom-post-grid.list .post-content {
    width: 100%;
    padding: 0 15px;
}

.custom-post-grid.list .post-content h3 {
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
    font-weight: 500;
    color: #333;
}

.custom-post-grid.list .post-content h3 a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.custom-post-grid.list .post-content h3 a:hover {
    color: #0073aa;
}

/* Flashcard-specific styles */
.custom-post-grid.post-type-flashcard.list .post-item {
    border-left-color: #0073aa;
}

.custom-post-grid.post-type-flashcard.list .post-content h3 {
    font-size: 18px;
    font-weight: 600;
}

/* Thumbnail styles (for grid view only) */
.custom-post-grid.grid .post-thumbnail {
    overflow: hidden;
}

.custom-post-grid.grid .post-thumbnail-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* Column variations (for grid view) */
.custom-post-grid.columns-1 .post-item { width: calc(100% - 30px); }
.custom-post-grid.columns-2 .post-item { width: calc(50% - 30px); }
.custom-post-grid.columns-3 .post-item { width: calc(33.3333% - 30px); }
.custom-post-grid.columns-4 .post-item { width: calc(25% - 30px); }

/* Responsive adjustments */
@media (max-width: 991px) {
    .custom-post-grid.grid .post-item {
        width: calc(50% - 30px);
    }
}

@media (max-width: 767px) {
    .custom-post-grid.grid .post-item {
        width: calc(100% - 30px);
    }
    
    .custom-post-grid.list .post-item {
        padding: 8px 0;
    }
    
    .custom-post-grid.list .post-content h3 {
        font-size: 14px;
    }
    
    .custom-post-grid.post-type-flashcard.list .post-content h3 {
        font-size: 16px;
    }
}