/* ── Reset & Variables ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --blue: #4398d7;
    --blue-dark: #3680b8;
    --blue-deep: #3C7ABD;
    --pink: #ED0082;
    --pink-light: #d64794;
    --slate: #253746;
    --slate-light: #2e4455;
    --slate-lighter: #354f63;
    --bg: #ffffff;
    --bg-tint: #f2f9ff;
    --bg-card: #f7fafd;
    --border: #dce4ec;
    --border-hover: #bdc8d4;
    --text: #253746;
    --text-secondary: #4a5e6f;
    --text-muted: #8d9baa;
    --gradient: linear-gradient(135deg, #3C7ABD, #ED0082);
    --gradient-subtle: linear-gradient(135deg, rgba(60,122,189,0.06), rgba(237,0,130,0.04));
    --green: #0d9f6e;
    --green-bg: rgba(13,159,110,0.08);
    --green-border: rgba(13,159,110,0.2);
    --amber: #ca8a04;
    --amber-bg: rgba(202,138,4,0.08);
    --amber-border: rgba(202,138,4,0.2);
    --red: #dc2626;
    --red-bg: rgba(220,38,38,0.06);
    --red-border: rgba(220,38,38,0.15);
    --shadow-sm: 0 1px 3px rgba(37,55,70,0.06);
    --shadow-md: 0 4px 16px rgba(37,55,70,0.08);
    --shadow-lg: 0 8px 32px rgba(37,55,70,0.12);
    --radius: 8px;
    --radius-lg: 12px;
    --sidebar-width: 280px;
}

html, body {
    height: 100%;
    font-family: 'Outfit', sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

/* ── Layout ── */
body {
    display: flex;
}

#sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    background: var(--slate);
    color: rgba(255,255,255,0.75);
    display: flex;
    flex-direction: column;
    padding: 24px 20px;
    overflow-y: auto;
    position: sticky;
    top: 0;
}

#main-content {
    flex: 1;
    padding: 40px 48px;
    overflow-y: auto;
    height: 100vh;
    max-width: 1100px;
}

/* ── Sidebar ── */
.sidebar-header h1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
}

.sidebar-header .subtitle {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.35);
    letter-spacing: 0.1em;
    margin-top: 3px;
    text-transform: uppercase;
    font-weight: 500;
}

.gradient-bar {
    height: 3px;
    background: var(--gradient);
    border-radius: 2px;
    margin-top: 16px;
    opacity: 0.7;
}

#new-screening-btn {
    width: 100%;
    margin-top: 24px;
    padding: 10px 16px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius);
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

#new-screening-btn:hover {
    background: rgba(255,255,255,0.14);
    border-color: rgba(255,255,255,0.22);
}

.sidebar-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.35);
    margin-top: 28px;
    margin-bottom: 10px;
}

#job-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.job-item {
    padding: 10px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
}

.job-item:hover {
    background: rgba(255,255,255,0.06);
}

.job-item.active {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.15);
}

.job-item .job-title {
    font-size: 0.88rem;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.job-item .job-meta {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.4);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.status-setup { background: rgba(67,152,215,0.15); color: var(--blue); }
.status-progress { background: rgba(202,138,4,0.15); color: var(--amber); }
.status-complete { background: rgba(13,159,110,0.15); color: var(--green); }

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer .model-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.3);
    margin-bottom: 2px;
}

.sidebar-footer .model-name {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.6);
}

.sidebar-footer .brand {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.2);
    margin-top: 12px;
}

/* ── Page Header ── */
.page-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0;
}

.page-header .accent-bar {
    height: 3px;
    width: 60px;
    background: var(--gradient);
    border-radius: 2px;
    margin-top: 8px;
    margin-bottom: 24px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.92rem;
    margin-bottom: 28px;
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 100px 40px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 3.5rem;
    opacity: 0.15;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 16px;
}

.empty-state h2 {
    color: var(--text);
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.92rem;
    max-width: 420px;
    margin: 0 auto;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* ── Forms ── */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-group input[type="text"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Outfit', sans-serif;
    font-size: 0.92rem;
    color: var(--text);
    background: var(--bg);
    transition: all 0.2s;
    outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(67,152,215,0.12);
}

.form-group textarea {
    resize: vertical;
    min-height: 70px;
}

/* File drop zone */
.file-drop {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-card);
}

.file-drop:hover, .file-drop.dragover {
    border-color: var(--blue);
    background: rgba(67,152,215,0.04);
}

.file-drop .drop-icon {
    font-size: 2rem;
    opacity: 0.3;
    margin-bottom: 8px;
}

.file-drop .drop-text {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.file-drop .drop-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.file-drop input[type="file"] {
    display: none;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 22px;
    border: none;
    border-radius: var(--radius);
    font-family: 'Outfit', sans-serif;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--blue);
    color: #fff;
    box-shadow: 0 2px 8px rgba(67,152,215,0.2);
}

.btn-primary:hover {
    background: var(--blue-dark);
    box-shadow: 0 4px 16px rgba(67,152,215,0.3);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-gradient {
    background: var(--gradient);
    color: #fff;
    box-shadow: 0 2px 12px rgba(237,0,130,0.15);
}

.btn-gradient:hover {
    box-shadow: 0 4px 20px rgba(237,0,130,0.25);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text-secondary);
    border: 1.5px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.btn-danger {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid var(--red-border);
}

.btn-danger:hover {
    background: var(--red);
    color: #fff;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
}

.btn-row {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* ── Metric Cards ── */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

.metric-card:hover {
    box-shadow: var(--shadow-md);
}

.metric-card .metric-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.metric-card .metric-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--blue);
}

/* ── Criteria Cards ── */
.criteria-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 28px;
}

.criterion-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.criterion-card .crit-number {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--blue);
    background: rgba(67,152,215,0.1);
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 10px;
    border: 1px solid rgba(67,152,215,0.2);
}

.criterion-card .form-group {
    margin-bottom: 14px;
}

.criterion-card .form-group:last-child {
    margin-bottom: 0;
}

/* ── Criteria Legend (results page) ── */
.criteria-legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 28px;
    margin-bottom: 20px;
    padding: 16px 20px;
    background: var(--gradient-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.criteria-legend-item {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 0.84rem;
}

.crit-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--blue);
    background: rgba(67,152,215,0.1);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(67,152,215,0.2);
    white-space: nowrap;
}

.crit-name {
    font-weight: 600;
    color: var(--text);
}

.crit-weight {
    font-size: 0.74rem;
    color: var(--text-muted);
    margin-left: 2px;
}

/* ── Results Table ── */
.results-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
}

.results-table thead th {
    background: var(--slate);
    color: rgba(255,255,255,0.65);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 14px 16px;
    text-align: center;
    font-family: 'Outfit', sans-serif;
}

.results-table thead th:first-child {
    text-align: left;
    color: rgba(255,255,255,0.85);
}

.results-table thead th:last-child {
    text-align: center;
}

.results-table tbody tr {
    transition: background 0.15s;
}

.results-table tbody tr:hover {
    background: var(--bg-tint);
}

.results-table tbody td {
    padding: 12px 16px;
    text-align: center;
    border-top: 1px solid var(--border);
    vertical-align: middle;
}

.results-table tbody td:first-child {
    text-align: left;
}

/* Name cell */
.applicant-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
}

.rank-1 { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #1a1a2e; box-shadow: 0 2px 8px rgba(251,191,36,0.3); }
.rank-2 { background: linear-gradient(135deg, #d1d5db, #9ca3af); color: #1a1a2e; box-shadow: 0 2px 8px rgba(156,163,175,0.3); }
.rank-3 { background: linear-gradient(135deg, #d97706, #b45309); color: #fff; box-shadow: 0 2px 8px rgba(217,119,6,0.3); }
.rank-other { background: var(--bg-card); color: var(--text-muted); border: 1px solid var(--border); }

.applicant-name {
    font-weight: 500;
    font-size: 0.9rem;
}

/* Score pills */
.score-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: 0.84rem;
    min-width: 34px;
    text-align: center;
}

.score-high { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.score-mid { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border); }
.score-low { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
.score-none { color: var(--text-muted); }

.score-total {
    font-size: 0.96rem;
    padding: 4px 14px;
}

/* Details link */
.details-link {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--blue);
    cursor: pointer;
    border: none;
    background: none;
    font-family: 'Outfit', sans-serif;
    transition: color 0.15s;
    padding: 4px 8px;
}

.details-link:hover {
    color: var(--pink);
}

/* ── Sort Control ── */
.sort-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.sort-row label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

.sort-row select {
    padding: 6px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Outfit', sans-serif;
    font-size: 0.84rem;
    color: var(--text);
    outline: none;
    background: var(--bg);
}

.sort-row select:focus {
    border-color: var(--blue);
}

/* ── Progress Bar ── */
.progress-container {
    margin: 32px 0;
}

.progress-bar-outer {
    width: 100%;
    height: 10px;
    background: var(--bg-card);
    border-radius: 6px;
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 14px;
}

.progress-bar-inner {
    height: 100%;
    background: var(--gradient);
    border-radius: 6px;
    transition: width 0.4s ease;
    width: 0%;
}

.progress-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.progress-detail {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Modal ── */
#modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(37,55,70,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

#modal-overlay.hidden {
    display: none;
}

#modal-content {
    background: var(--bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 680px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 32px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.modal-close:hover { color: var(--text); }

.justification-item {
    margin-bottom: 18px;
}

.justification-item .just-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.88rem;
}

.justification-box {
    background: var(--bg-tint);
    border: 1px solid var(--border);
    border-left: 3px solid var(--blue);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 0.86rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ── Loading Spinner ── */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-dark {
    border-color: var(--border);
    border-top-color: var(--blue);
}

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

/* ── File List ── */
.file-list {
    margin-top: 16px;
    margin-bottom: 20px;
}

.file-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 6px;
    font-size: 0.84rem;
    background: var(--bg-card);
}

.file-list-item .file-name {
    color: var(--text);
    font-weight: 500;
}

.file-list-item .extracted-name {
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* ── Utility ── */
.hidden { display: none !important; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.84rem; }

.action-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.divider {
    height: 1px;
    background: var(--border);
    margin: 28px 0;
}

/* ── Weight Select ── */
.weight-select {
    padding: 6px 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Outfit', sans-serif;
    font-size: 0.84rem;
    color: var(--text);
    background: var(--bg);
    width: 100%;
}

/* ── Applicant count in upload view ── */
.uploaded-count {
    background: var(--bg-tint);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}
