/* ── Category Header Section ── */
.category-header-section {
    margin-bottom: 40px;
    padding: 40px 35px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 24px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.03),
                0 1px 3px rgba(0, 0, 0, 0.01);
    text-align: right;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

.category-header-section::after {
    content: "";
    position: absolute;
    top: -50%;
    left: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.06) 0%, rgba(255, 255, 255, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
}

.category-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    min-width: 0;
}

.category-header-text {
    min-width: 0;
    min-height: 0;
    flex: 1 1 0%;
}

.category-title-main {
    font-size: 2rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 12px 0;
    padding-right: 20px;
    position: relative;
    letter-spacing: -0.5px;
    line-height: 1.3;
    overflow-wrap: break-word;
}

.category-title-main::before {
    content: "";
    position: absolute;
    right: 0;
    top: 6px;
    width: 8px;
    height: 30px;
    background: linear-gradient(to bottom, #3b82f6, #1d4ed8);
    border-radius: 6px;
}

.category-desc {
    color: #475569;
    font-size: 1rem;
    line-height: 1.6;
    margin: 0;
    overflow-wrap: break-word;
}

.category-count-badge {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    padding: 8px 18px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 800;
    border: 1px solid rgba(59, 130, 246, 0.15);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(4px);
    z-index: 2;
    flex-shrink: 0;
    white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════
   Category Posts Grid — 4-column Shop-style Layout
   ══════════════════════════════════════════════════════════ */
.category-posts-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 50px;
    animation: dzFadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Each card wrapper (div) stretches to fill the grid cell */
.category-card-wrapper {
    display: flex;
    min-width: 0;
}

/* The card fills the wrapper entirely */
.category-card-wrapper .post-card {
    width: 100%;
    min-width: 0;
    height: auto;
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--dz-border, #e2e8f0);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.category-card-wrapper .post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 35px -10px rgba(0, 0, 0, 0.1);
    border-color: var(--dz-primary, #3b82f6);
}

/* Image — fixed height, fills width */
.category-card-wrapper .card-img-wrapper {
    height: 200px;
    width: 100%;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.category-card-wrapper .card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.category-card-wrapper .post-card:hover .card-img {
    transform: scale(1.08);
}

/* Badge */
.category-card-wrapper .card-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    padding: 5px 12px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--dz-text-heading, #0f172a);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Content area — grows to fill remaining space */
.category-card-wrapper .card-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.category-card-wrapper .card-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--dz-text-heading, #0f172a);
    margin: 0 0 10px 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.category-card-wrapper .card-excerpt {
    font-size: 0.88rem;
    color: #64748b;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Footer pinned to bottom */
.category-card-wrapper .card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid var(--dz-border, #e2e8f0);
    font-size: 0.85rem;
    color: #94a3b8;
    margin-top: auto;
}

/* Empty state */
.category-empty-state {
    grid-column: 1 / -1;
    padding: 40px;
    text-align: center;
    color: #94a3b8;
    font-size: 1.1rem;
    background: #fff;
    border-radius: 20px;
    border: 1px solid var(--dz-border, #e2e8f0);
}

@keyframes dzFadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Back to Home Button ── */
.back-to-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 30px;
    color: #475569;
    font-size: 0.95rem;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}

.back-to-home-btn:hover {
    border-color: var(--dz-primary, #3b82f6);
    color: var(--dz-primary, #3b82f6);
    box-shadow: 0 12px 25px -5px rgba(59, 130, 246, 0.12);
    transform: translateY(-3px);
}

/* ══════════════════════════════════════════════════════════
   Responsive Breakpoints
   ══════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
    .category-posts-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

@media (max-width: 900px) {
    .category-header-section {
        padding: 25px 20px;
        margin-bottom: 30px;
    }
    .category-title-main {
        font-size: 1.6rem;
    }
    .category-posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }
}

@media (max-width: 576px) {
    .category-header-section {
        padding: 20px;
    }
    .category-posts-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .category-header-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .category-header-text {
        align-self: stretch;
    }
}

/* ── Pagination ── */
.category-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 40px 0 20px;
    direction: rtl;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #ffffff;
    border: 1.5px solid rgba(226, 232, 240, 0.9);
    border-radius: 50px;
    color: #475569;
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.page-btn:hover {
    border-color: var(--dz-primary, #3b82f6);
    color: var(--dz-primary, #3b82f6);
    box-shadow: 0 8px 20px -4px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

.page-btn-next {
    background: var(--dz-primary, #3b82f6);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 6px 16px -4px rgba(59, 130, 246, 0.4);
}

.page-btn-next:hover {
    background: #2563eb;
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 10px 22px -4px rgba(59, 130, 246, 0.45);
}

.page-info {
    font-size: 0.9rem;
    color: #94a3b8;
    font-weight: 600;
    padding: 10px 18px;
    background: #f8fafc;
    border-radius: 30px;
    border: 1px solid var(--dz-border, #e2e8f0);
}
