/* ==========================================================================
   Shared UI chrome
   --------------------------------------------------------------------------
   Components that appear on more than one page: the fixed KU header, the
   contact-form field helpers, and the collaborator filter control.

   These rules used to live in an inline <style> block in index.html. Any page
   that reused the same markup and JavaScript — /sund-collab renders results
   through the very same displayCollaboratorResults() — therefore rendered the
   header at the wrong width and the filter control completely unstyled
   (position: static, no background, browser-default button chrome).

   Keep genuinely page-specific styling in the page. Anything driven by shared
   markup in script.js belongs here, so a second page cannot silently miss it.
   ========================================================================== */

/* ── Fixed KU header ────────────────────────────────────────────────────── */

.custom-header .header-wrapper {
    justify-content: space-between !important;
}

/* Match header width/padding to the main column so the title and buttons line
   up with the card edges below. */
body.landing-minimal .header-content {
    max-width: 720px;
    padding: 0 30px;
}

.custom-header .ku-title-link {
    font-size: 1.4rem;
}

.custom-header .contact-link {
    margin-left: auto !important;
}

.header-contact-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.6);
    color: inherit;
    padding: 5px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s, border-color 0.2s;
}

.header-contact-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.9);
}

/* ── Contact form field helpers ─────────────────────────────────────────── */

.field-required {
    color: #c0392b;
}

.field-hint {
    font-size: 0.8rem;
    color: #888;
    font-weight: normal;
}

.field-error {
    display: block;
    color: #c0392b;
    font-size: 0.82rem;
    margin-top: 3px;
    min-height: 1.1em;
}

.message-counter {
    text-align: right;
    font-size: 0.78rem;
    color: #999;
    margin-top: 3px;
}

.message-counter.near-limit {
    color: #e67e22;
}

.message-counter.at-limit {
    color: #c0392b;
    font-weight: bold;
}

input.input-error,
textarea.input-error {
    border-color: #c0392b !important;
}

/* ── Collaborators header row + filter control ──────────────────────────────
   Built by renderFilteredCollaborators() in script.js, so every page that
   displays collaborator results gets this markup whether it styles it or not. */

.collaborators-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    margin-top: 10px;
}

.collaborators-header-row .collaborators-header {
    margin: 0;
}

.filter-dropdown-wrapper {
    position: relative;
    margin-top: -5px;
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.82rem;
    color: #555;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.filter-btn:hover {
    border-color: #8A2422;
    color: #8A2422;
}

.filter-btn.filter-active {
    border-color: #8A2422;
    color: #8A2422;
}

.filter-chevron {
    font-size: 0.65rem;
    transition: transform 0.2s ease;
}

.filter-active-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #8A2422;
    flex-shrink: 0;
}

.filter-panel {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    z-index: 200;
    min-width: 190px;
}

.filter-panel label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 0.88rem;
    cursor: pointer;
    color: #333;
    user-select: none;
}

.filter-panel label:hover {
    color: #8A2422;
}

.filter-panel input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: #8A2422;
    cursor: pointer;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .collaborators-header-row {
        flex-wrap: wrap;
        row-gap: 8px;
    }
}

/* ── Primary action button ──────────────────────────────────────────────────
   The "Search" / "Find collaborators" button. Was inline on the landing page,
   so the SUND page's button fell back to browser-default chrome (grey
   buttonface instead of KU red). Pages may still adjust its geometry — see
   `.b-card .upload-button` in landing-themes.css and `.sund-card
   .upload-button` on the SUND page. */

.upload-button {
    margin-top: 8px;
    background: #8A2422;
    color: white;
    padding: 0 20px;
    border: none;
    height: 35px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-button:hover {
    background: #6A1C1A;
}

.upload-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ── Collaborator result card ───────────────────────────────────────────────
   themes.css carries an older, looser version of this card. The landing page
   had been overriding it from its inline <style>, so the same card rendered
   with different padding, border and shadow depending on which page you were
   on. The landing treatment is the reference; it belongs here so every page
   that renders these cards gets it. */

.result-item {
    display: flex;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 15px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.3s ease;
}

.result-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

@media (max-width: 768px) {
    .result-item {
        flex-direction: column;
        padding: 16px;
    }
}

/* ── SUND department + match-band badges ────────────────────────────────────
   Emitted by displayCollaboratorResults() in script.js, which every result page
   shares, so they are styled here rather than on the SUND page. */

.sund-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 6px 0 2px;
}

.sund-dept-badge,
.sund-band-badge {
    display: inline-block;
    font-size: 0.74rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 11px;
    letter-spacing: 0.01em;
}

.sund-dept-badge {
    background: #f0eaea;
    color: #6d3033;
}

.sund-band-strong {
    background: #e4f2e6;
    color: #1f5c2b;
}

.sund-band-possible {
    background: #eaf0f7;
    color: #27496b;
}

.sund-band-long_shot {
    background: #f6f0e4;
    color: #6d5620;
}

/* ── Hero banner: current-collaborators toggle ──────────────────────────────
   The "Show top current collaborators" button and the list it reveals, both
   emitted by displayCollaboratorResults() in script.js. These lived inline in
   index.html, so opening a researcher from /sund-collab — which renders through
   the very same function — got a browser-default grey button next to the
   correctly styled "Hide research interests", and unstyled name chips under it.

   The palette is white-on-maroon because this sits inside .hero-banner; the
   sibling .hero-read-more in themes.css is the button these match. */

.hero-buttons-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.hero-collabs-btn {
    display: inline-block;
    color: white;
    background: transparent;
    border: 1px solid white;
    padding: 5px 15px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Open Sans', sans-serif;
    font-size: 1rem;
    line-height: 1.4;
}

.hero-collabs-btn:hover {
    background-color: white;
    color: #8A2422;
}

/* Collapsible section listing current collaborators */
.hero-current-collabs-section {
    margin-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 12px;
}

.current-collabs-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.current-collabs-list li {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    padding: 5px 12px;
    font-size: 0.9rem;
}

.cc-name {
    color: white;
    font-weight: 600;
}

.cc-count {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.82rem;
}

/* ── Progress card ──────────────────────────────────────────────────────────
   What the user looks at between pressing "Find collaborators" and the results
   landing, on the landing page and on /sund-collab alike. Driven by
   paper_upload.js, which streams the pipeline's own step messages into
   .progress-card__step.

   It deliberately carries more than a spinner. A run takes 1-2 minutes with
   long gaps between progress messages, so an elapsed counter, an honest
   estimate and the live step are the evidence that something is still
   happening — a lone "Processing..." line is indistinguishable from a page
   that has hung.
   ========================================================================== */

.progress-card {
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 10px;
    padding: 20px 24px;
    margin-top: 22px;
}

.progress-card__row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-card__headline {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.progress-card__elapsed {
    font-variant-numeric: tabular-nums;
    color: #8a8a8a;
    font-size: 0.85rem;
}

.progress-card__eta {
    margin: 10px 0 0;
    color: #555;
    font-size: 0.88rem;
    line-height: 1.5;
}

.progress-card__step {
    margin: 12px 0 0;
    padding-top: 12px;
    border-top: 1px solid #eee;
    color: #777;
    font-size: 0.85rem;
}
