/* Shared job card styles used across search, basket, comparison and prepare pages. */
.match-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.match-card:hover {
    border-color: var(--border-hover);
}

.match-card.selected {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.match-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 14px 16px;
    cursor: pointer;
    gap: 14px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.match-head:active {
    background: var(--surface-hover);
}

/* ── Score badge column (LEFT) ── */
.match-score-col {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-width: 48px;
}

.match-score-col .score-badge {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 800;
    padding: 0;
    line-height: 1;
}

.match-info {
    flex: 1;
    min-width: 0;
}

.match-info .title {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.match-info .meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Match pills (NEW, category, source badges below meta) ── */
.match-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
}

.match-pills .badge,
.match-pills .badge-new,
.match-pills .meta-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.chevron {
    transition: transform 0.3s;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.match-card.open .chevron {
    transform: rotate(180deg);
}

.match-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.match-card.open .match-body {
    max-height: none;
    overflow: visible;
}

.match-body-inner {
    padding: 0 18px 18px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 18px;
    font-size: 0.88rem;
}

.match-body-inner dt {
    color: var(--text-muted);
    font-weight: 500;
}

.match-body-inner dd {
    margin: 0;
}

.head-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

/* Keep quick actions (star/trash) pinned above any dossier/status blocks */
.head-actions-row {
    order: 1;
}

.head-actions > :not(.head-actions-row) {
    order: 2;
}

/* Top row in right column: score + primary action */
.head-actions-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Micro-line in right column: doc status + app status */
.head-actions-micro {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.76rem;
    color: var(--text-muted);
}

.head-action {
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
    border-radius: 6px;
    font-size: 0.82rem;
    padding: 3px 7px;
    cursor: pointer;
    /* accessibility: visible focus ring */
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.head-action:hover {
    border-color: var(--border-hover);
    color: var(--text);
}

.head-action:focus-visible {
    outline: 2px solid var(--accent, #B85C38);
    outline-offset: 2px;
}

.head-action:active {
    background: var(--surface-hover);
    transform: scale(0.96);
}

.head-action.active {
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.35);
}

.score-badge {
    flex-shrink: 0;
    padding: 4px 12px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    font-family: inherit;
    line-height: inherit;
    transition: filter 0.15s, transform 0.15s;
}

.score-badge:hover {
    filter: brightness(1.2);
    transform: scale(1.08);
}

.score-badge:active {
    transform: scale(0.95);
}

.score-badge:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .match-card,
    .score-badge,
    .head-action,
    .chevron,
    .match-body,
    .badge-new,
    .score-unknown {
        animation: none !important;
        transition: none !important;
    }
}

.score-high {
    background: var(--success-bg, rgba(52, 211, 153, 0.12));
    color: var(--success);
}

.score-mid {
    background: rgba(251, 191, 36, 0.12);
    color: var(--warning);
}

.score-low {
    background: var(--danger-bg, rgba(239, 68, 68, 0.12));
    color: var(--danger, #ef4444);
}

/* Unscored: pulsing "?" inviting evaluation */
.score-unknown {
    background: rgba(184, 92, 56, 0.10);
    color: var(--accent);
    border: 1.5px dashed rgba(184, 92, 56, 0.35);
    font-size: 1.2rem;
    animation: score-unknown-pulse 2.5s ease-in-out infinite;
}
.score-unknown:hover {
    background: rgba(184, 92, 56, 0.18);
    border-style: solid;
}
@keyframes score-unknown-pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.badge {
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-core {
    background: rgba(200, 120, 42, 0.15);
    color: var(--accent-light);
}

.badge-adjacent {
    background: rgba(52, 211, 153, 0.15);
    color: var(--success);
}

.badge-bridge-count {
    background: rgba(59, 130, 246, 0.14);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.32);
}

.badge-bridge-distinguishing {
    background: rgba(251, 191, 36, 0.14);
    color: #fcd34d;
    border: 1px solid rgba(251, 191, 36, 0.35);
}

.badge-filtered {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning);
}

.badge-source {
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
    white-space: nowrap;
}

.badge-source-url {
    border-color: rgba(139, 92, 246, 0.3);
    color: #a78bfa;
    background: rgba(139, 92, 246, 0.08);
}

.badge-new {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.35);
    animation: badge-new-pulse 2s ease-in-out 3;
}
[data-theme="dark"] .badge-new {
    background: rgba(248, 113, 113, 0.14);
    color: #fca5a5;
    border-color: rgba(248, 113, 113, 0.35);
}
@keyframes badge-new-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.offer-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.compare-check {
    width: 15px;
    height: 15px;
}

.offer-select-check {
    width: 20px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: var(--accent);
}

.job-card-desc-compact {
    display: block;
    max-height: 320px;
    overflow: auto;
    white-space: pre-wrap;
}

.job-card-desc-compare {
    max-height: 320px;
    overflow-y: auto;
    white-space: pre-line;
    line-height: 1.6;
    padding-right: 8px;
    scrollbar-width: thin;
}

.job-card-desc-full {
    max-height: 500px;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.6;
    padding-right: 8px;
    scrollbar-width: thin;
}

.job-card-desc-wrap {
    white-space: pre-wrap;
}

.job-card-eval {
    margin-top: 8px;
}

.job-card-keywords {
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 0 16px;
}

.job-card-footer-info {
    padding: 0 16px 12px;
}

.job-card-footer-actions {
    padding: 0 16px 16px;
}

.job-card-link-disabled {
    opacity: 0.55;
    pointer-events: none;
}

.job-card-title-prefix {
    margin-right: 10px;
    vertical-align: middle;
}

.job-card-open-link {
    padding: 8px 14px;
    font-size: 0.85rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
}
.job-card-open-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

.bridge-list {
    display: grid;
    gap: 8px;
}

.bridge-item {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
    padding: 8px 10px;
}

.bridge-item-distinguishing {
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.38);
}

.bridge-skill {
    font-weight: 600;
    color: var(--text);
    font-size: 0.84rem;
}

.bridge-detail {
    margin-top: 2px;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.45;
}

/* ── Offer date chip (shown in meta line) ── */
.offer-date-chip {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ── Meta tags (compact inline source/category indicators) ── */
.meta-tag {
    font-size: 0.76rem;
    font-weight: 500;
    white-space: nowrap;
}
.meta-tag-core {
    color: var(--accent-light);
}
.meta-tag-adjacent {
    color: var(--success, #34d399);
}

/* ── Refresh availability button ── */
.offer-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--border, #ddd);
    border-radius: 6px;
    background: var(--card-bg, #fff);
    cursor: pointer;
    font-size: 0.88rem;
    transition: transform 0.2s, border-color 0.2s;
    flex-shrink: 0;
}
.offer-refresh-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.offer-refresh-btn:hover {
    border-color: var(--accent);
    background: rgba(184, 92, 56, 0.06);
}
.offer-refresh-spinning {
    animation: offer-refresh-spin 0.8s linear infinite;
    pointer-events: none;
}
@keyframes offer-refresh-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.offer-refresh-ok {
    border-color: #22c55e;
    background: #f0fdf4;
    cursor: default;
}
.offer-refresh-gone {
    border-color: #ef4444;
    background: #fef2f2;
    cursor: default;
}

/* ── Expired offer card (dimmed) ── */
.match-card.offer-expired {
    opacity: 0.55;
    position: relative;
}
.match-card.offer-expired::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 8px,
        rgba(239,68,68,0.06) 8px,
        rgba(239,68,68,0.06) 16px
    );
    pointer-events: none;
    border-radius: inherit;
}

/* ── Collapsible "other offers" section (below 70 threshold) ── */
.dash-other-offers {
    margin-top: 16px;
    border: 1px dashed var(--border, #ddd);
    border-radius: 8px;
    padding: 0;
}
.dash-other-offers-toggle {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--text-muted);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
}
.dash-other-offers-toggle::before {
    content: "▸";
    transition: transform 0.2s;
}
.dash-other-offers[open] > .dash-other-offers-toggle::before {
    transform: rotate(90deg);
}
.dash-other-offers-toggle::-webkit-details-marker {
    display: none;
}
.dash-other-offers-list {
    padding: 0 8px 8px;
}
.dash-other-offers-list .match-card {
    opacity: 0.75;
}

/* ── Qualified count badge ── */
.dash-results-count-badge.high {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    font-weight: 600;
    border: 1px solid #f59e0b;
}

/* ══ Job-cards Mobile ══ */
@media (max-width: 768px) {
    .match-head {
        padding: 12px 14px;
        gap: 10px;
    }
    .match-score-col {
        min-width: 40px;
    }
    .match-score-col .score-badge {
        width: 40px;
        height: 40px;
        font-size: 0.95rem;
        border-radius: 8px;
    }
    .match-info .title {
        font-size: 0.88rem;
    }
    .match-info .meta { font-size: 0.78rem; }
    .match-pills { gap: 4px; margin-top: 4px; }
    .head-actions {
        gap: 4px;
    }
    .head-actions-row { gap: 4px; }
    .head-actions-micro { gap: 6px; }
    .head-action {
        min-height: 36px;
        min-width: 36px;
        padding: 4px 8px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .match-body-inner {
        padding: 0 14px 14px;
        grid-template-columns: 1fr;
        gap: 4px;
    }
    .match-body-inner dt {
        font-size: 0.78rem;
        margin-top: 8px;
    }
    .match-body-inner dt:first-child { margin-top: 0; }
    .match-body-inner dd { font-size: 0.85rem; }
    .offer-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .offer-actions .btn { width: 100%; text-align: center; }
    .score-badge { padding: 4px 10px; font-size: 0.75rem; }
}

@media (max-width: 480px) {
    .match-head { padding: 12px; flex-wrap: wrap; align-items: flex-start; }
    .match-body-inner { padding: 0 12px 12px; }
    /* Title + score in one row: score takes fixed width, info fills the rest */
    .match-score-col { min-width: 36px; align-self: flex-start; }
    .match-score-col .score-badge { width: 36px; height: 36px; font-size: 0.85rem; }
    .match-info { flex: 1; min-width: 0; }
    .match-info .title { font-size: 0.88rem; white-space: normal; line-height: 1.3; }
    /* Hide standalone chevron — shown inline in actions row instead */
    .match-head > .chevron { display: none; }
    /* Actions row below, full width, buttons at end */
    .head-actions { width: 100%; flex-direction: row; justify-content: flex-end; align-items: center; margin-top: 8px; gap: 8px; border-top: 1px solid var(--border); padding-top: 10px; }
    .head-actions-row { margin-right: auto; display: flex; align-items: center; gap: 6px; } /* star/trash left, extra actions right */
    /* Chevron injected via ::after next to star/trash */
    .head-actions-row::after {
        content: "▾";
        font-size: 0.82rem;
        color: var(--text-muted);
        transition: transform 0.3s;
        display: inline-block;
        margin-left: 2px;
    }
    .match-card.open .head-actions-row::after {
        transform: rotate(180deg);
    }
}
details.dash-keywords-card[open] summary .chevron {
    transform: rotate(180deg);
}
details.dash-keywords-card summary::-webkit-details-marker {
    display: none;
}
