/* Base card styles — shared by all three layouts, overridden per-layout below */

.news-agent-match {
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    position: relative;
}

.news-agent-match__hide {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    width: 22px;
    height: 22px;
    line-height: 20px;
    text-align: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    z-index: 2;
}

.news-agent-match__hide:hover {
    background: rgba(179, 45, 46, 0.9); /* matches the admin error red used elsewhere in the plugin */
}

.news-agent-match__image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}

.news-agent-match__body {
    padding: 0.75rem 0.9rem 0.9rem;
}

.news-agent-match__category {
    margin: 0 0 0.25rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.news-agent-match__category a {
    text-decoration: none;
    color: #2271b1;
}

.news-agent-match__title {
    font-size: 1.1rem;
    margin: 0 0 0.25rem;
}

.news-agent-match__title a {
    text-decoration: none;
}

.news-agent-match__date {
    margin: 0;
    font-size: 0.75rem;
    color: #888;
}

.news-agent-match__phrase {
    margin: 0.4rem 0 0;
    font-size: 0.8rem;
    color: #666;
}

.news-agent-match__summary {
    margin: 0.5rem 0 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.news-agent-match__tags {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.6rem 0 0;
    padding: 0;
}

.news-agent-match__tags li {
    background: #f1f1f1;
    border-radius: 999px;
    padding: 0.15rem 0.6rem;
    font-size: 0.75rem;
    color: #444;
}

.news-agent-match__tags li a {
    color: inherit;
    text-decoration: none;
}

.news-agent-match__tags li a:hover {
    text-decoration: underline;
}

/* --- Layout: cards (default) — even grid, uniform card heights --- */

.news-agent-matches--cards {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* --- Layout: masonry — CSS-columns based, natural (uneven) heights.
   A true JS masonry (packed grid) isn't worth the dependency here;
   CSS columns give the same "brick wall" visual with zero JS. --- */

.news-agent-matches--masonry {
    columns: 280px 3; /* responsive column count, ~280px minimum width */
    column-gap: 1.5rem;
}

.news-agent-matches--masonry .news-agent-match {
    break-inside: avoid; /* keeps a single card from splitting across columns */
    margin-bottom: 1.5rem;
    display: inline-block;
    width: 100%;
}

/* --- Layout: list — compact single column, small thumbnail beside text --- */

.news-agent-matches--list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.news-agent-matches--list .news-agent-match {
    display: flex;
    flex-direction: row;
    align-items: stretch;
}

.news-agent-matches--list .news-agent-match__image {
    width: 140px;
    height: auto;
    min-height: 100%;
    flex-shrink: 0;
}

.news-agent-matches--list .news-agent-match__body {
    flex: 1;
    min-width: 0; /* allows text truncation/wrapping instead of overflowing the flex row */
}

.news-agent-matches--list .news-agent-match__summary {
    /* Lists are meant to be scannable — trim long summaries rather than
       stretching every row to the tallest one's height. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 480px) {
    .news-agent-matches--list .news-agent-match {
        flex-direction: column;
    }
    .news-agent-matches--list .news-agent-match__image {
        width: 100%;
        height: 160px;
    }
}

/* --- Filter notice (shown when a category badge filter is active) --- */

.news-agent-active-filter {
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.news-agent-active-filter a {
    margin-left: 0.5rem;
}

/* --- Pagination --- */

.news-agent-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

.news-agent-pagination__prev,
.news-agent-pagination__next {
    text-decoration: none;
}

.news-agent-pagination__status {
    color: #666;
}
