/* Unified "News & Events" search (/news) — task 13_0009.
   Self-contained layout + facet sidebar + results-card + modal styles. The public layout's
   Bootstrap grid is purged (no col-lg-9 / col-xl-4), so the page uses its own CSS grid/flex for
   the sidebar+results split and the card list, reusing only classes proven present on public
   pages (.card/.card-body/.badge-*/.form-check*/.form-control/.btn*/.sr-only/.mdi). */

.unified-search-lead {
    color: #495057;
    margin-bottom: 1.25rem;
}

/* ---- Page layout (sidebar + results) ------------------------------------------------ */
.unified-search-layout {
    display: grid;
    grid-template-columns: minmax(0, 270px) minmax(0, 1fr);
    gap: 1.75rem;
    align-items: start;
}

@media (max-width: 767px) {
    .unified-search-layout {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
}

/* ---- Facet sidebar ------------------------------------------------------------------ */
.unified-search-sidebar {
    font-size: 0.95rem;
}

fieldset.unified-facet {
    min-width: 0; /* stops a fieldset from refusing to shrink inside the grid track */
}

.unified-facet {
    border: 0;
    margin: 0 0 1.4rem;
    padding: 0;
}

.unified-facet-legend {
    display: block;
    width: 100%;
    float: none;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    padding: 0;
    color: #0b2e4f;
    border-bottom: 1px solid #e3e8ee;
    padding-bottom: 0.25rem;
}

.unified-facet-options {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    max-height: 16rem;
    overflow-y: auto;
}

.unified-facet .form-check {
    margin-bottom: 0;
}

.unified-facet-count {
    color: #6c757d;
    font-size: 0.85em;
}

.unified-facet-empty {
    color: #6c757d;
    font-size: 0.875rem;
    margin: 0;
}

.unified-facet-filter {
    margin-bottom: 0.5rem;
}

.unified-facet-actions {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
}

/* Tag "top-N + search": extras hidden until "Show all" or while filtering; non-matches hidden. */
.unified-tag-option.is-extra { display: none; }
#us-tag-options.show-all .unified-tag-option.is-extra,
#us-tag-options.is-filtering .unified-tag-option.is-extra { display: block; }
.unified-tag-option.is-hidden { display: none !important; }

/* ---- Selected-location pills -------------------------------------------------------- */
.unified-facet-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.unified-facet-pills:empty {
    margin-bottom: 0;
}

.unified-pill {
    display: inline-flex;
    align-items: center;
    background: #e9f2fb;
    border: 1px solid #b8d6f0;
    color: #0b2e4f;
    border-radius: 1rem;
    padding: 0.15rem 0.6rem;
    font-size: 0.85rem;
}

.unified-pill-remove {
    background: none;
    border: 0;
    color: #0b2e4f;
    font-size: 1.05rem;
    line-height: 1;
    margin-left: 0.3rem;
    padding: 0;
    cursor: pointer;
}

.unified-pill-remove:hover { color: #c0392b; }

/* ---- Date facet: stacked Year + Month dropdowns ------------------------------------- */
.unified-facet-date {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.unified-facet-date select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Plain text-button used for "Show all", "Clear all filters", "Cancel". */
.unified-link-btn {
    background: none;
    border: 0;
    color: #0066CC;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
}

.unified-link-btn:hover { color: #004a99; }

/* ---- Results region ----------------------------------------------------------------- */
.unified-search-count {
    font-weight: 600;
    margin: 0 0 1rem;
    color: #0b2e4f;
}

.unified-search-loading,
.unified-search-error,
.unified-search-empty {
    padding: 2.5rem 0;
    text-align: center;
    color: #6c757d;
}

.unified-search-error { color: #c0392b; }

.unified-search-feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.25rem;
}

.unified-search-card {
    height: 100%;
    overflow: hidden;
}

.unified-search-card-imagelink { display: block; }

.unified-search-card-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.unified-search-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.unified-search-card-title {
    font-size: 1.1rem;
    line-height: 1.3;
    margin: 0 0 0.35rem;
}

.unified-search-card-link { color: #0b2e4f; }
.unified-search-card-link:hover { color: #0066CC; }

.unified-search-card-date {
    color: #6c757d;
    font-size: 0.85rem;
    margin: 0 0 0.5rem;
}

.unified-search-card-summary {
    font-size: 0.9rem;
    color: #343a40;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- Location selector dialog ------------------------------------------------------- */
.usearch-modal[hidden] { display: none; }

.usearch-modal {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: 1080; /* above the fixed site header (z-index ~900) */
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.usearch-modal-backdrop {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(0, 0, 0, 0.5);
}

.usearch-modal-dialog {
    position: relative;
    background: #fff;
    border-radius: 6px;
    width: 100%;
    max-width: 560px;
    margin: 5vh 1rem;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.usearch-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    background: #0066CC;
    color: #fff;
    border-radius: 6px 6px 0 0;
}

.usearch-modal-title {
    font-size: 1.1rem;
    margin: 0;
    color: #fff;
}

.usearch-modal-close {
    background: none;
    border: 0;
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.9;
}

.usearch-modal-close:hover { opacity: 1; }

.usearch-modal-body {
    padding: 1rem;
    overflow: auto;
}

.usearch-modal-results {
    margin-top: 0.75rem;
    max-height: 45vh;
    overflow-y: auto;
    border: 1px solid #e3e8ee;
    border-radius: 4px;
}

.usearch-loc-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    margin: 0;
    cursor: pointer;
    border-bottom: 1px solid #f0f3f7;
}

.usearch-loc-option:last-child { border-bottom: 0; }
.usearch-loc-option:hover { background: #f5f9fd; }
.usearch-loc-option.is-hidden { display: none; }

.usearch-loc-name { flex: 1 1 auto; }

.usearch-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.9rem;
    padding: 0.85rem 1rem;
    border-top: 1px solid #e3e8ee;
}

body.usearch-modal-open { overflow: hidden; }
