/* Ensure all cards share same min-height and layout */
.modern-blog-card {
    display: flex;
    flex-direction: column;
    min-height: var(--card-min-height, 460px);
    transition: transform var(--transition-speed, 0.22s) ease, box-shadow var(--transition-speed, 0.22s) ease, border-color var(--transition-speed, 0.22s) ease;
    position: relative;
    border: 1px solid rgba(0,0,0,0.05) !important;
    cursor: pointer;
    box-shadow: 0 0.35rem 1rem rgba(15, 23, 42, 0.08) !important;
}

.modern-blog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 0.7rem 1.4rem rgba(15, 23, 42, 0.12) !important;
    border-color: var(--primary-color, #6366f1) !important;
}

/* تنسيق الصورة */
.card-image-wrapper {
    position: relative;
    min-height: 220px;
    height: auto;
    overflow: hidden;
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.card-image-wrapper.has-image {
    min-height: 0;
    align-items: flex-start;
    justify-content: flex-start;
}

.card-image-wrapper img {
    width: 100%;
    height: 100% !important;
    max-height: 320px;
    object-fit: cover;
    display: block;
    background: transparent;
    transition: transform 0.16s ease;
}

.modern-blog-card:hover .card-image-wrapper img {
    transform: scale(1.05);
}

/* التسمية العائمة (Glassmorphism) */
.floating-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    color: var(--primary-color, #6366f1);
    padding: 0.4rem 1rem;
    font-size: 0.75rem;
    z-index: 2;
}

.blog-title-link {
    transition: color 0.3s ease;
}

.modern-blog-card:hover .blog-title-link {
    color: var(--primary-color, #6366f1) !important;
}

.author-avatar {
    width: 35px;
    height: 35px;
    background: var(--primary-color, #6366f1);
    box-shadow: inset 0 0 0 9999px rgba(0, 0, 0, 0.16);
    font-size: 0.85rem;
}

.author-name-muted {
    color: #64748b;
    font-weight: 600;
    opacity: 0.88;
}

.author-label-muted {
    color: #94a3b8;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: capitalize; /* show labels with capitalized words */
    letter-spacing: 0.02em;
    opacity: 0.9;
}

/* Placeholder when no image: centered text with gradient background */
.card-image-placeholder {
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
    color: white;
    background: var(--primary-color, #6366f1);
    box-shadow: inset 0 0 0 9999px rgba(0, 0, 0, 0.18);
}

.card-image-placeholder .placeholder-text {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tag-pill-card {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.62rem;
    border-radius: 999px;
    border: 1px solid rgba(99, 102, 241, 0.18);
    background: rgba(99, 102, 241, 0.08);
    color: var(--primary-color, #6366f1);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
}

@media (max-width: 767.98px) {
    .card-image-wrapper {
        min-height: 220px;
        padding: 0;
    }

    .card-image-wrapper img {
        max-height: 320px;
    }

    .modern-blog-card:hover .card-image-wrapper img {
        transform: none;
    }
}
