/*
 * DT Blog Grid Block Styles (v5 - Fixed Badge & Bottom Alignment)
 */

/* 1. Main Wrapper & Widths */
.dtbg-wrapper {
    width: 100%;
    padding: 4rem 2rem;
    box-sizing: border-box;
}
.dtbg-container {
    margin-left: auto;
    margin-right: auto;
}
.dtbg-wrapper.dtbg-width-1100 .dtbg-container { max-width: 1100px; }
.dtbg-wrapper.dtbg-width-1400 .dtbg-container { max-width: 1400px; }
.dtbg-wrapper.dtbg-width-full .dtbg-container { max-width: 100%; }

/* 2. Main Headline */
.dtbg-main-headline {
    font-family: 'Fredoka', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 2.5rem 0;
    color: #111;
    text-align: center;
}

/* 3. Filter Bar */
.dtbg-filter-bar {
    background-color: #fff;
    padding: 1.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 2.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-end;
}
.dtbg-filter-bar .dtbg-search-field {
    flex: 2;
    min-width: 300px;
}
.dtbg-filter-bar .dtbg-category-field {
    flex: 1;
    min-width: 200px;
}
.dtbg-filter-bar .dtbg-search-field:only-child {
    flex-basis: 100%;
}
.dtbg-filter-bar label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.9em;
    color: #555;
    font-family: 'Poppins', sans-serif;
}
.dtbg-filter-bar input[type="text"],
.dtbg-filter-bar select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    box-sizing: border-box;
}

/* 4. Grid Layout */
.dtbg-grid {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}
.dtbg-wrapper.dtbg-cols-2 .dtbg-grid { grid-template-columns: repeat(2, 1fr); }
.dtbg-wrapper.dtbg-cols-3 .dtbg-grid { grid-template-columns: repeat(3, 1fr); }
.dtbg-wrapper.dtbg-cols-4 .dtbg-grid { grid-template-columns: repeat(4, 1fr); }

/* 5. Blog Card Styling */
.dtbg-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 5px 20px rgba(0,0,0,0.07);
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%; /* Ensures all cards in a row match height */
}
.dtbg-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

.dtbg-card-image {
    width: 100%;
    height: 220px;
    overflow: hidden;
    flex-shrink: 0;
}
.dtbg-card-image img,
.dtbg-placeholder-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.dtbg-placeholder-image {
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
}
.dtbg-placeholder-image::before {
    content: "No Featured Image";
}

.dtbg-card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Makes content fill the remaining height */
    align-items: flex-start; /* Ensures items align to left */
}

/* --- BADGE FIX: Inline-Block to hug text --- */
.dtbg-post-tag {
    display: inline-block; /* Changed from block/flex to inline-block */
    padding: 5px 12px;
    border-radius: 999px;
    background-color: #f0eaf5;
    color: #6a4c89;
    font-family: 'Poppins', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
    max-width: 100%; /* Prevents overflow */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dtbg-post-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
    color: #111;
    margin: 0 0 0.75rem 0;
    width: 100%;
}

.dtbg-post-excerpt {
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #333;
    margin: 0 0 1.5rem 0; /* Increased margin for better spacing */
    flex-grow: 1; /* --- ALIGNMENT FIX: Pushes meta to bottom --- */
    width: 100%;
}

/* --- NEW AUTHOR STYLES (Bottom Aligned) --- */
.dtbg-post-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: auto; /* --- ALIGNMENT FIX: Ensures it stays at bottom --- */
    width: 100%;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0; /* Optional: adds a subtle separator */
}

.dtbg-author-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.dtbg-meta-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.dtbg-author-name {
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    color: #333;
}

.dtbg-post-date {
    font-family: 'Poppins', sans-serif;
    font-size: 0.75rem;
    color: #888;
}

.dtbg-read-more {
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: #6a4c89;
    text-decoration: none;
    margin-left: auto; /* Pushes "Read More" to the far right */
    white-space: nowrap;
}

.dtbg-card:hover .dtbg-read-more {
    text-decoration: underline;
}

/* 6. Responsive */
@media (max-width: 900px) {
    .dtbg-wrapper.dtbg-cols-3 .dtbg-grid,
    .dtbg-wrapper.dtbg-cols-4 .dtbg-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 768px) {
    .dtbg-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .dtbg-filter-bar .dtbg-search-field,
    .dtbg-filter-bar .dtbg-category-field {
        min-width: 100%;
    }
}
@media (max-width: 600px) {
    .dtbg-wrapper.dtbg-cols-2 .dtbg-grid,
    .dtbg-wrapper.dtbg-cols-3 .dtbg-grid,
    .dtbg-wrapper.dtbg-cols-4 .dtbg-grid {
        grid-template-columns: 1fr;
    }
    .dtbg-card-image {
        height: 200px;
    }
    .dtbg-main-headline {
        font-size: 2rem;
    }
}