/* Toolbar for view toggles */
.charity-posts-toolbar {
    margin-bottom: var(--wp--preset--spacing--30); /* 20px */
    text-align: right; /* Adjust as needed */
}

.charity-posts-toolbar .view-toggle {
    background-color: var(--wp--preset--color--base); /* #FFFFFF */
    border: 1px solid var(--wp--preset--color--accent-4); /* #606e73 (for #ccc) */
    /* Adjusted padding for icon-only buttons */
    padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--20); /* 10px 10px (for 8px 10px) */
    cursor: pointer;
    margin-left: 5px; /* No direct variable */
    border-radius: 4px;
    font-size: var(--wp--preset--font-size--small); /* 0.875rem (for 14px) */
    display: inline-flex;
    align-items: center;
    justify-content: center; /* Center icon horizontally */
    gap: 0; /* No gap needed if no text */
    /* Added transition for smooth effects */
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

.charity-posts-toolbar .view-toggle .dashicons {
    /* Ensures Dashicons are sized correctly */
    font-size: 20px; /* Slightly larger icon, no variable match */
    width: 20px;
    height: 20px;
    line-height: 1;
}

.charity-posts-toolbar .view-toggle.active {
    background-color: var(--wp--preset--color--accent-1); /* #2566eb (for #0073aa) */
    color: var(--wp--preset--color--base); /* #FFFFFF */
    border-color: var(--wp--preset--color--accent-1); /* #2566eb (for #0073aa) */
    /* Optional: subtle scale on active */
    transform: scale(1.05);
}

.charity-posts-toolbar .view-toggle:hover:not(.active) {
    background-color: var(--wp--preset--color--accent-4); /* #606e73 (for #e0e0e0) */
    transform: translateY(-2px); /* Subtle lift on hover */
}

/* Base styling for individual post items */
.charity-post-item {
    background-color: var(--wp--preset--color--accent-5); /* #FFFFFF */
    text-decoration: none;
    height: 100%;
    border: 2px solid var(--wp--preset--color--base);
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-color: #fff;
}

.charity-post-thumbnail {
    margin-bottom: var(--wp--preset--spacing--20); /* 10px (for 15px) */
    overflow: hidden; /* Contain the image within the rounded corners */
    border-radius: 6px 6px 0 0; /* Match parent's radius, adjusted for border */
}

.charity-post-thumbnail img {
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
    margin: auto;
    height: 150px; /* Fixed height for grid images, no variable match */
    width: 250px; /* Fixed width for list view thumbnail, no variable match */
}

/* Placeholder for images if ID not found */
.charity-post-image-placeholder {
    width: 100%;
    height: 200px; /* Consistent height with grid view images, no variable match */
    background-color: var(--wp--preset--color--contrast); /* #FFFFFF (for #f0f0f0) */
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wp--preset--color--accent-4); /* #606e73 (for #aaa) */
    font-size: var(--wp--preset--font-size--medium); /* clamp(1rem...) (for 1.2em) */
    border-radius: 10px 10px 0 0; /* Match article border radius */
    overflow: hidden; /* Ensure rounded corners for placeholder itself */
}

.charity-post-content {
    padding: var(--wp--preset--spacing--20); /* 10px (for 15px) */
}

.charity-post-title {
    font-size: var(--wp--preset--font-size--large); /* clamp(1.125rem...) (for 1.4em) */
    margin-top: 0;
    margin-bottom: var(--wp--preset--spacing--20); /* 10px */
}

.charity-post-title a {
    text-decoration: none;
    color: var(--wp--preset--color--contrast); /* #0a1439 (for #333) */
}

.charity-post-title a:hover {
    color: var(--wp--preset--color--accent-1); /* #2566eb (for #0073aa) */
}

.charity-post-excerpt {
    font-size: var(--wp--preset--font-size--small); /* 0.875rem (for 0.9em) */
    color: var(--wp--preset--color--accent-3); /* #3a4260 (for #666) */
    line-height: 1.5;
}

/* Grid View Specific Styles */
.charity-posts-container.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); /* No direct variable for minmax */
    gap: var(--wp--preset--spacing--40); /* 30px */
}

.charity-posts-container.grid-view .charity-post-item {
    display: flex;
    flex-direction: column;
    height: 100%; /* Ensures all cards are same height in a row */
}


.charity-posts-container.grid-view .charity-post-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.charity-posts-container.grid-view .charity-post-thumbnail img {
    height: 150px; /* Fixed height for grid images, no variable match */
    width: 250px; /* Fixed width for list view thumbnail, no variable match */
}

/* List View Specific Styles */
.charity-posts-container.list-view .charity-post-item {
    display: flex;
    align-items: flex-start; /* Align content to the top */
    gap: var(--wp--preset--spacing--10); /* 20px */
    margin-bottom: 0; /* Remove margin from list items as border handles spacing */
    box-shadow: none; /* Remove shadow for list items */
    background: var(--wp--preset--color--accent-5);
    border-radius: 10px;
}

.charity-posts-container.list-view .charity-post-item:last-child {
    border-bottom: none;
}

.charity-posts-container.list-view .charity-post-thumbnail {
    flex-shrink: 0; /* Prevent thumbnail from shrinking */
    margin-bottom: 0; /* Remove margin */
    margin-right: var(--wp--preset--spacing--40); /* 10px (for 15px) */
}

.charity-posts-container.list-view .charity-post-thumbnail img {
    height: 100px; /* Fixed height for grid images, no variable match */
    width: 150px; /* Fixed width for list view thumbnail, no variable match */
    border-radius: 4px;
}

.charity-posts-container.list-view .charity-post-image-placeholder {
    width: 150px; /* No variable match */
    height: 100px; /* Match list view image height, no variable match */
    border-radius: 4px;
}

.charity-posts-container.list-view .charity-post-content {
    padding: 0; /* No extra padding for content in list view */
    flex-grow: 1;
    padding: 0.8rem 0.2rem;
}

.charity-posts-container.list-view .charity-post-title,
.charity-posts-container.list-view .charity-indicators {
    display:inline-block; /* Ensure title and indicators are inline */
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .charity-posts-container.grid-view {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); /* No direct variable for minmax */
    }

    .charity-posts-container.list-view .charity-post-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .charity-posts-container.list-view .charity-post-thumbnail {
        width: 100%;
        max-width: 200px; /* Limit thumbnail width on small screens, no variable match */
    }
    .charity-posts-container.list-view .charity-post-image-placeholder {
        max-width: 200px; /* Match responsive thumbnail width, no variable match */
    }
}
