/* =========================================================
     Search results page
     ========================================================= */
.results-hero {
    padding: 56px 0 32px;
    background: linear-gradient(180deg, #fff 0%, var(--ink-50) 100%);
    border-bottom: 1px solid var(--ink-100);
}

.results-eyebrow {
    color: var(--blue-600);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    margin-bottom: 12px;
}

.results-title {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 36px;
    line-height: 1.15;
    letter-spacing: -0.02em;
    font-weight: 600;
    color: var(--ink-900);
    /* The sub-line beneath is hidden by JS, so the title itself owns the
       breathing room above the search bar. */
    margin-bottom: 28px;
}

.results-title em {
    font-style: italic;
    color: var(--blue-600);
    font-weight: 600;
}

.results-title span {
    color: var(--blue-600);
    font-style: normal;
}

.results-sub {
    font-size: 16px;
    color: var(--ink-500);
    margin-bottom: 32px;
}

/* Refinement search bar */
.results-search {
    display: flex;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--ink-200);
    border-radius: 10px;
    padding: 6px;
    width: 100%;
    margin-bottom: 28px;
    box-shadow: var(--shadow-sm);
}

.results-search-state {
    flex: 0 0 120px;
    display: flex;
}

.results-search-state select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 100%;
    background: var(--ink-50);
    border: 1px solid var(--ink-200);
    border-radius: 6px;
    padding: 10px 26px 10px 12px;
    font-size: 13px;
    font-family: inherit;
    color: var(--ink-800);
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    text-align-last: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    /* Chevron icon on the right */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 11px 11px;
}

.results-search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 14px;
    font-size: 15px;
    font-family: inherit;
    color: var(--ink-900);
    outline: none;
}

.results-search-submit {
    background: #fff;
    color: var(--blue-600);
    border: 1.5px solid var(--blue-600);
    border-radius: 6px;
    padding: 0 22px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.results-search-submit:hover {
    background: var(--blue-50);
    color: var(--blue-700);
    border-color: var(--blue-700);
}

/* Sign up CTA in nav: transparent secondary on the black header */
.nav-cta.btn-secondary {
    color: #fff;
    background: transparent;
    border-color: rgba(255, 255, 255, 0.35);
}

.nav-cta.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.6);
}

/* Centered primary CTA on its own line, vertically centered, wide button */
.results-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px 32px;
    background: var(--blue-50);
    border: 1px solid #dbe7fe;
    border-radius: var(--radius-md);
}

.results-cta .btn {
    padding: 12px 56px;
    font-size: 15px;
    min-width: 360px;
    justify-content: center;
}

.results-cta-aside {
    font-size: 11px;
    color: var(--ink-500);
    font-style: italic;
}

/* Filter + sort row, sits outside the hero, on plain background, no separator */
.results-filters-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.results-filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.results-filters-row select {
    appearance: none;
    background: #fff;
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-sm);
    padding: 8px 32px 8px 14px;
    font-size: 13px;
    font-family: inherit;
    color: var(--ink-700);
    font-weight: 500;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

/* View density toggle (Detailed / Compact) */
.view-toggle {
    display: inline-flex;
    background: #fff;
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-left: 8px;
}

.view-toggle-btn {
    background: transparent;
    border: none;
    padding: 8px 10px;
    font-family: inherit;
    color: var(--ink-500);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.view-toggle-btn:hover:not(.active) {
    background: var(--ink-50);
    color: var(--ink-700);
}

.view-toggle-btn.active {
    background: var(--blue-50);
    color: var(--blue-700);
}

.view-toggle-btn+.view-toggle-btn {
    border-left: 1px solid var(--ink-200);
}

/* Smooth fade when toggling between detailed and compact views */
.results-list {
    transition: opacity 0.18s ease;
}

.results-list.switching {
    opacity: 0;
    pointer-events: none;
}

/* Compact view: collapses each result card to a single horizontal row */
.results-list.compact {
    gap: 10px;
}

.results-list.compact .result-card {
    min-height: 0;
    padding: 18px 24px;
    grid-template-columns: auto 1fr auto;
    gap: 20px;
    align-items: center;
}

.results-list.compact .result-select {
    padding: 18px 0;
    margin: -18px 0;
    border-right: none;
}

/* Compact view keeps the smaller 18px checkbox; only expanded gets 22px */
.results-list.compact .result-checkbox {
    width: 18px;
    height: 18px;
}

.results-list.compact .result-name-row {
    margin-bottom: 0;
    align-items: center;
    gap: 12px;
}

/* Status pill sits inline next to the entity name in compact mode */
.results-list.compact .result-name-row .result-status-top {
    flex-shrink: 0;
}

.results-list.compact .result-name {
    font-size: 16px;
}

.results-list.compact .result-meta {
    font-size: 12px;
    margin-top: 3px;
}

.results-list.compact .result-fields {
    display: none;
}

/* Compact mode: status pill | report # | View Report button (left to right) */
.results-list.compact .result-actions {
    flex-direction: row;
    align-items: center;
    gap: 14px;
    min-height: 0;
}

.results-list.compact .result-actions .btn {
    margin: 0;
    padding: 8px 14px 8px 16px;
    font-size: 13px;
    line-height: 1;
    gap: 6px;
    order: 3;
}

.results-list.compact .result-actions .btn svg {
    margin-right: -2px;
}

.results-list.compact .result-status-top {
    padding: 3px 8px;
    font-size: 11px;
    order: 1;
}

.results-list.compact .result-id {
    font-size: 11px;
    order: 2;
}

/* On narrow widths, hide the report-id in compact mode so the row stays clean */
@media (max-width: 720px) {
    .results-list.compact .result-id {
        display: none;
    }
}

/* Results list */
.results-list-section {
    padding: 20px 0 80px;
    /* Keep footer below the fold even when filters narrow the result list to nothing */
    flex: 1 0 auto;
    min-height: calc(100vh - 280px);
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-card {
    background: #fff;
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-md);
    padding: 18px 28px 22px 28px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 18px;
    align-items: start;
    transition: all 0.15s;
    /* No fixed min-height — let the card hug the natural content height
       so the relevance + Report # row sits directly under the fields
       (aligned with "and X more officers" on multi-officer cards)
       instead of being pushed to a hardcoded card bottom. */
}

/* Per-row select checkbox. Vertically centered against the whole card.
     No divider line — the selected blue border around the entire card does
     the visual heavy lifting. Negative top/bottom margins extend the
     element through the card's vertical padding so center-alignment is
     against the full card height. */
.result-select {
    display: flex;
    align-items: center;
    align-self: stretch;
    cursor: pointer;
    padding: 18px 10px 22px 0;
    margin: -18px 0 -22px;
}

.result-checkbox {
    width: 22px;
    height: 22px;
    accent-color: var(--blue-600);
    cursor: pointer;
    margin: 0;
}

.result-card {
    cursor: pointer;
}

.result-card a.btn,
.result-card .result-select {
    cursor: pointer;
}

/* Selected state: blue border + soft glow so it reads as "in the cart" */
.result-card:has(.result-checkbox:checked) {
    border-color: var(--blue-600);
    box-shadow: 0 0 0 1px var(--blue-600);
}

/* Unlock-all CTA in its secondary (zero-selected) state: blue text + blue
     border on white, NOT the default grey-bordered secondary. Still reads
     as a primary brand-color CTA, just less visually dominant. */
#unlock-all.btn-secondary {
    background: #fff;
    color: var(--blue-600);
    border: 1px solid var(--blue-600);
}

#unlock-all.btn-secondary:hover {
    background: var(--blue-50);
    border-color: var(--blue-700);
    color: var(--blue-700);
}

#unlock-all.btn-secondary svg {
    color: var(--blue-600);
}

.result-card:has(.result-checkbox:checked):hover {
    border-color: var(--blue-700);
    box-shadow: 0 0 0 1px var(--blue-700), var(--shadow-md);
}

.result-card:hover {
    border-color: var(--blue-500);
    box-shadow: var(--shadow-md);
}

.result-main {
    min-width: 0;
}

.result-name-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.result-name-text {
    flex: 1;
    min-width: 0;
}

.result-name {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--ink-900);
    line-height: 1.2;
}

.result-meta {
    font-size: 13px;
    color: var(--ink-500);
    margin-top: 2px;
}

.result-fields {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* Relevance indicator. In detailed view it lives INSIDE the location
     field cell (first .result-field) and gets pushed to the bottom of
     that cell — since the cells in the fields grid stretch to the
     tallest cell's height, this makes its baseline line up with the
     bottom of "and X more officers" on multi-officer cards. In compact
     view (where .result-fields is hidden) it sits in .result-main
     after the name row instead — see the JS placeRelevance for the
     mode-aware insertion. */
.result-relevance {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-500);
}

.result-relevance-dots {
    display: inline-flex;
    gap: 3px;
}

.result-relevance-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ink-200);
}

.result-relevance-dot.filled {
    background: var(--blue-600);
}

/* Compact view: relevance still visible (result-fields is hidden), tighter spacing.
     Don't push to bottom in compact — sits right under the name row,
     with a touch of breathing room above the dots. */
.results-list.compact .result-relevance {
    margin-top: 10px;
    padding-top: 0;
    font-size: 9.5px;
}

.results-list.compact .result-relevance-dot {
    width: 6px;
    height: 6px;
}

.result-status-top {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    flex-shrink: 0;
}

.result-status-top.active {
    background: var(--green-50);
    color: #047857;
}

.result-status-top.active .dot {
    width: 5px;
    height: 5px;
    background: var(--green-500);
    border-radius: 50%;
}

.result-status-top.dissolved {
    background: var(--ink-100);
    color: var(--ink-500);
}

.result-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.rf-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.rf-value {
    font-size: 13px;
    color: var(--ink-900);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rf-value.blur {
    filter: blur(4px);
    user-select: none;
    pointer-events: none;
}

.ini-blur {
    display: inline-block;
    background: #94a3b8;
    border-radius: 2px;
    height: 0.85em;
    margin: 0 1.5px;
    vertical-align: -1px;
    user-select: none;
    pointer-events: none;
}

.ini-blur::before {
    content: '';
}

.rf-people {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rf-people>span {
    display: block;
    line-height: 1.5;
}

.rf-more {
    display: block;
    font-size: 11px;
    color: var(--ink-500);
    font-style: italic;
    font-weight: 400;
    margin-top: 6px;
}

.result-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    align-self: flex-start;
    width: fit-content;
}

.result-status.active {
    background: var(--green-50);
    color: #047857;
}

.result-status.active .dot {
    width: 5px;
    height: 5px;
    background: var(--green-500);
    border-radius: 50%;
}

.result-status.dissolved {
    background: var(--ink-100);
    color: var(--ink-500);
}

.result-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    flex-shrink: 0;
    min-height: 100%;
    align-self: stretch;
}

.result-actions .btn {
    margin: auto 0;
}

.result-id {
    font-size: 11px;
    color: var(--ink-400);
    font-family: ui-monospace, monospace;
}

/* Pagination */
.results-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 32px;
    margin-top: 8px;
    color: var(--ink-500);
    font-size: 14px;
}

.pag-buttons {
    display: flex;
    gap: 8px;
}

/* FCRA notice */
.fcra-notice {
    margin-top: 48px;
    padding: 18px 22px;
    background: var(--ink-50);
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-md);
    display: flex;
    gap: 14px;
    align-items: flex-start;
    font-size: 12px;
    line-height: 1.55;
    color: var(--ink-500);
}

.fcra-notice svg {
    color: var(--ink-400);
    flex-shrink: 0;
    margin-top: 1px;
}

.fcra-notice strong {
    color: var(--ink-700);
    font-weight: 600;
}

@media (max-width: 900px) {

    /* Keep button on the right at every width, collapse fields to a 2-col grid instead */
    .result-card {
        grid-template-columns: auto 1fr auto;
        padding: 16px 20px;
    }

    .result-fields {
        grid-template-columns: 1fr 1fr;
        padding-left: 0;
    }

    .result-actions {
        flex-direction: column;
        align-items: flex-end;
    }
}

/* Constrain results-page content to the same 920px width as nav and homepage content */
.results-hero .container>*,
.results-list-section .container>*,
.results-list,
.results-filters-row,
.results-pagination,
.fcra-notice {
    max-width: 1300px;
    margin-left: auto;
    margin-right: auto;
}

.results-hero .container,
.results-list-section .container {
    /* Keep container at full 1000 for outer breathing, inner content is constrained */
}

/* =========================================================
     Mobile responsive (≤ 640px)
     ========================================================= */
@media (max-width: 640px) {
    .container {
        padding: 0 16px;
    }

    .container-narrow {
        padding: 0 16px;
    }

    /* Nav */
    .nav-inner {
        padding: 12px 16px;
    }

    .nav .logo img {
        height: 26px;
    }

    .nav-links {
        gap: 2px;
    }

    .nav-link {
        padding: 6px 8px;
        font-size: 13px;
    }

    .nav-link.hide-on-mobile {
        display: none;
    }

    .btn-sm,
    .nav-cta {
        padding: 8px 12px;
        font-size: 13px;
    }

    /* Hero */
    .results-hero {
        padding: 28px 0 18px;
    }

    .results-title {
        font-size: 22px;
        line-height: 1.25;
    }

    .results-sub {
        font-size: 14px;
    }

    /* Refinement search bar, stay horizontal, compact */
    .results-search {
        padding: 5px;
        gap: 4px;
        flex-wrap: nowrap;
    }

    .results-search-state {
        flex: 0 0 96px;
    }

    .results-search-state select {
        font-size: 13px;
        padding: 10px 22px 10px 10px;
        background-position: right 6px center;
    }

    .results-search-input {
        flex: 1;
        min-width: 0;
        font-size: 16px;
        /* prevent iOS zoom */
        padding: 10px 8px;
    }

    .results-search-submit {
        padding: 0 12px;
        font-size: 13px;
        flex-shrink: 0;
    }

    .results-search-submit svg {
        display: none;
    }

    /* Filter row, wrap nicely */
    .results-filters-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px;
    }

    .results-filters-row .filter-group {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .results-filters-row select,
    .results-filters-row input {
        width: 100%;
        font-size: 16px;
    }

    .results-view-toggle {
        align-self: stretch;
        justify-content: center;
    }

    /* Result cards, keep button on the RIGHT side, fields stack */
    .result-card {
        padding: 14px 14px 14px 16px;
        grid-template-columns: auto 1fr auto;
        gap: 12px;
        min-height: 0;
        align-items: stretch;
    }

    .result-main {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .result-name-row {
        margin-bottom: 0;
    }

    .result-name {
        font-size: 16px;
        line-height: 1.25;
    }

    .result-meta {
        font-size: 12px;
    }

    .result-fields {
        grid-template-columns: 1fr;
        gap: 6px;
        padding-left: 0;
    }

    .rf-label {
        font-size: 10px;
    }

    .rf-value {
        font-size: 12.5px;
    }

    .rf-people>span {
        line-height: 1.35;
    }

    .rf-more {
        font-size: 10.5px;
    }

    /* Actions column on the right, compact button + small status pill above */
    .result-actions {
        flex-direction: column;
        align-items: flex-end;
        justify-content: center;
        gap: 8px;
        min-height: 0;
    }

    .result-actions .result-status-top {
        font-size: 10.5px;
        padding: 3px 8px;
    }

    .result-actions .btn {
        padding: 8px 12px;
        font-size: 12px;
        gap: 4px;
        margin: 0;
        white-space: nowrap;
    }

    .result-actions .btn svg {
        width: 12px;
        height: 12px;
    }

    .result-id {
        display: none;
    }

    /* Compact view on mobile, just stay readable */
    .results-list.compact .result-card {
        padding: 12px 14px;
        grid-template-columns: auto 1fr auto;
    }

    .results-list.compact .result-name {
        font-size: 14px;
    }

    .results-list.compact .result-actions .btn {
        padding: 6px 10px;
        font-size: 11.5px;
    }

    /* Results list section */
    .results-list-section {
        padding: 16px 0 56px;
    }

    .results-list {
        gap: 10px;
    }

    /* Pagination */
    .results-pagination {
        flex-wrap: wrap;
        gap: 6px;
        justify-content: center;
    }

    .results-pagination .page-num {
        padding: 8px 12px;
        font-size: 13px;
    }

    /* FCRA notice */
    .fcra-notice {
        padding: 14px 16px;
        font-size: 12px;
    }

    /* Footer */
    .footer {
        padding: 36px 0 20px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 28px;
        margin-bottom: 24px;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
        font-size: 12px;
    }
}

/* Small phones (≤ 380px) */
@media (max-width: 380px) {
    .results-title {
        font-size: 19px;
    }

    .nav-link {
        font-size: 12px;
        padding: 6px;
    }

    .results-search-state {
        flex: 0 0 84px;
    }

    .results-search-state select {
        font-size: 12px;
        padding: 10px 20px 10px 8px;
    }

    .results-search-submit {
        padding: 0 10px;
        font-size: 12px;
    }

    .result-card {
        padding: 12px 12px 12px 14px;
    }

    .result-actions .btn {
        padding: 7px 10px;
        font-size: 11.5px;
    }
}
