/* ==========================================================================
   match.css — page-specific styles for the AI Job Match Assistant page.
   Base layout (body, header, .input-bar, textarea, button) lives in
   common.css, which must be loaded first.
   ========================================================================== */

body {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Match page uses a wider header/footer gutter than the chat pages */
header {
    padding: 18px 36px;
}

/* ===== PROGRESS BAR ===== */
#progress-bar {
    padding: 16px 36px 4px;
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
}

.step-pill {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    color: var(--text-secondary);
    font-size: .75rem;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    border: none;
    background: #1e293b;
    opacity: .45;
    transition: all .3s ease;
    cursor: pointer;
}

.step-pill:hover {
    opacity: 1;
    background: #334155;
}

.step-pill .pill-label {
    max-width: 8em;
    overflow: hidden;
    text-overflow: ellipsis;
}

.step-pill .pi {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--border-input);
    display: inline-block;
}

/* states */
.step-pill.active {
    opacity: 1;
    color: #fff;
    background: linear-gradient(90deg, var(--accent), #3b82f6);
    transform: scale(1.03);
}

.step-pill.done {
    opacity: .95;
    color: var(--success-border);
    background: var(--success-bg);
    font-weight: 700;
}

.step-pill.error {
    opacity: .95;
    color: var(--error);
    background: var(--error-bg);
    font-weight: 700;
}

/* connector between pills */
.connector {
    width: 1.5px;
    height: 20px;
    background: #475569;
    flex-shrink: 0;
}

/* ===== CHAT / RUNS AREA ===== */
#chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px 36px;
    display: flex;
    flex-direction: column;
    gap: .6em;
}

.system-msg {
    text-align: left;
    color: var(--text-muted);
    font-size: .8rem;
    margin: 6px 0;
    white-space: pre-wrap;
}

.system-msg.warn {
    color: var(--warn);
}

.run {
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    margin: 6px 0 18px;
    padding: 14px 16px;
    background: #0f172a80;
}

.run .submitted {
    background: var(--accent);
    color: #fff;
    align-self: auto;
    margin: 0 0 12px;
    padding: 10px 14px;
    border-radius: var(--radius-lg);
    white-space: pre-wrap;
    word-break: break-word;
    font-size: .9rem;
    max-width: 100%;
}

.steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.step-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-header);
    overflow: hidden;
}

.step-card .step-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: .85rem;
    font-weight: 600;
    color: #cbd5e1;
    background: #0d1526;
}

.step-card .step-head .icon {
    font-size: 1rem;
}

.step-card .step-head .label {
    flex: 1;
}

.step-card .step-head .status {
    font-size: .85rem;
}

.step-card.active .step-head {
    color: #fff;
    background: linear-gradient(90deg, var(--accent-hover), var(--accent));
}

.step-card.done .step-head {
    color: var(--success-border);
}

.step-card.error .step-head {
    color: var(--error);
    background: var(--error-bg);
}

.step-card .step-body {
    padding: 10px 14px;
    font-size: .88rem;
    color: #e2e8f0;
}

.step-card .step-body.empty {
    display: none;
}

.spinner {
    width: 11px;
    height: 11px;
    border: 2px solid var(--border-input);
    border-top-color: var(--accent-soft);
    border-radius: 50%;
    display: inline-block;
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* markdown rendering inside step bodies (clean / letter) */
.step-body p, .step-body ul, .step-body ol {
    margin: 0 0 8px;
}

.step-body :last-child {
    margin-bottom: 0;
}

.step-body strong {
    color: var(--accent-soft);
}

.step-body ul, .step-body ol {
    padding-left: 20px;
}

.step-body code {
    background: #1e293b;
    color: var(--accent-soft);
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    font-size: .88em;
    font-family: var(--font-mono);
}

.step-body pre {
    background: var(--bg-body);
    padding: 10px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-size: .85em;
}

.step-body pre code {
    background: none;
    padding: 0;
}

.step-body .raw {
    font-family: var(--font-mono);
    font-size: .8rem;
    color: var(--text-secondary);
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    font-size: .75rem;
    font-weight: 700;
}

.badge.ok {
    background: var(--success-bg);
    color: var(--success);
}

.badge.bad {
    background: var(--error-bg);
    color: var(--error);
}

.score-badge {
    font-size: 1.6rem;
    font-weight: 800;
}

.score-badge.good {
    color: var(--success);
}

.score-badge.mid {
    color: #fbbf24;
}

.score-badge.bad {
    color: var(--error);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.chip {
    background: #1e293b;
    color: #cbd5e1;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    font-size: .75rem;
}

.result-banner {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: .9rem;
}

.result-banner.success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success-border);
}

.result-banner.error {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid var(--error-border);
}

/* ===== FOOTER ===== */
footer.input-bar {
    padding: 18px 36px;
}

footer.input-bar #clearBtn {
    flex: 0 0 auto;
}

footer.input-bar form {
    flex: 1;
    display: flex;
    gap: 12px;
}

footer.input-bar textarea {
    resize: vertical;
    min-height: 60px;
}
