.popular-categories-section {
    background: #f4f7fb;
    padding: clamp(2rem, 4vw, 3rem) 0;
}

.popular-categories-section .container {
    width: 90%;
    max-width: 90%;
}

.popular-categories-grid {
    --bs-gutter-x: 1rem;
}

@media (min-width: 992px) {
    .popular-categories-grid > [class*='col-'] {
        flex: 0 0 auto;
        width: 33.33333333%;
    }
}

.popular-categories-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.popular-categories-title {
    margin: 0;
    font-size: clamp(1.35rem, 2.4vw, 1.75rem);
    font-weight: 800;
    color: #111827;
    letter-spacing: -0.02em;
}

.popular-categories-view-all {
    color: #111827;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.popular-categories-view-all:hover {
    color: var(--brand-primary-dark, #026aaa);
}

.popular-category-card {
    position: relative;
    background: #ffffff;
    border: 1px solid #e8edf2;
    border-radius: 2px;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 1rem 1rem 0.9rem;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.popular-category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--brand-primary, #0379c3);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.popular-category-card:hover {
    border-color: #d7dee8;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.popular-category-card:hover::before {
    opacity: 1;
}

.popular-category-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.popular-category-card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
}

.popular-category-card-title a {
    color: #111827;
    text-decoration: none;
}

.popular-category-card-title a:hover {
    color: var(--brand-primary, #0379c3);
}

.popular-category-card-count {
    flex-shrink: 0;
    font-size: 0.78rem;
    color: #4b5563;
    line-height: 1.35;
    white-space: nowrap;
}

.popular-category-card-divider {
    height: 1px;
    background: #e8edf2;
    margin: 0.85rem 0 0.95rem;
}

.popular-category-card-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(5.5rem, 42%);
    gap: 0.75rem;
    align-items: center;
    flex: 1;
    min-height: 8.5rem;
}

.popular-category-card-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
}

.popular-category-card-list a {
    color: #4b5563;
    font-size: 0.82rem;
    line-height: 1.45;
    text-decoration: none;
    transition: color 0.15s ease;
}

.popular-category-card-list a:hover {
    color: var(--brand-primary, #0379c3);
}

.popular-category-card-empty {
    margin: 0;
    color: #6b7280;
    font-size: 0.82rem;
    line-height: 1.5;
}

.popular-category-card-media {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 6.5rem;
}

.popular-category-card-media img {
    width: 100%;
    height: 7.5rem;
    max-height: 7.5rem;
    object-fit: contain;
}

.popular-category-card-media-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 50%;
    background: #f3f4f6;
    color: #cbd5e1;
    font-size: 1.75rem;
}

.popular-category-card-link {
    margin-top: 0.85rem;
    color: #111827;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 0.15em;
    align-self: flex-start;
}

.popular-category-card-link:hover {
    color: var(--brand-primary, #0379c3);
}

@media (max-width: 1199.98px) {
    .popular-category-card-body {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .popular-category-card-media {
        justify-content: flex-start;
        min-height: 0;
    }
}

@media (max-width: 575.98px) {
    .popular-category-card-body {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .popular-category-card-media {
        justify-content: flex-start;
        min-height: 5rem;
    }

    .popular-category-card-media img {
        height: 5.5rem;
        max-height: 5.5rem;
        max-width: 8rem;
    }
}
