/* ── Variables ─────────────────────────────────────────────────── */
:root {
  --bg:          #F8FAFC;
  --surface:     #FFFFFF;
  --border:      #E2E8F0;
  --sidebar-bg:  #FFFFFF;
  --sidebar-w:   240px;
  --primary:     #2563EB;
  --primary-hover:#1D4ED8;
  --text:        #1E293B;
  --text-muted:  #64748B;
  --green:       #16A34A;
  --green-bg:    #DCFCE7;
  --amber:       #D97706;
  --amber-bg:    #FEF3C7;
  --red:         #DC2626;
  --red-bg:      #FEE2E2;
  --radius:      12px;
  --shadow:      0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:   0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 10;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}
.logo-icon { font-size: 22px; }
.logo-text  { font-size: 18px; font-weight: 700; color: var(--text); }

.sidebar-nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  font-weight: 500;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.nav-item:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.nav-item.active { background: #EFF6FF; color: var(--primary); }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

/* ── Main ──────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
}
.page-content {  margin: 0 auto; padding: 36px 32px; }
.page-content--wide { }

/* ── Page header ───────────────────────────────────────────────── */
.page-header { margin-bottom: 28px; }
.page-title  { font-size: 24px; font-weight: 700; color: var(--text); }
.page-subtitle { color: var(--text-muted); margin-top: 4px; }

/* ── Card ──────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; color: var(--text); }

/* ── Metrics ───────────────────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.metric-value { font-size: 28px; font-weight: 700; color: var(--primary); }
.metric-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ── Section header ────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-title { font-size: 17px; font-weight: 600; }
.link-muted    { font-size: 13px; color: var(--text-muted); }
.link-muted:hover { color: var(--primary); }

/* ── Bulk actions (jobs page) ──────────────────────────────────── */
.bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  padding: 12px 16px;
}
.bulk-select-all {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  user-select: none;
}
.bulk-count {
  flex: 1;
  font-size: 13px;
  color: var(--text-muted);
}
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.view-toggle-btn {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.view-toggle-btn + .view-toggle-btn {
  border-left: 1px solid var(--border);
}
.view-toggle-btn:hover {
  background: var(--bg);
  color: var(--text);
}
.view-toggle-btn.active {
  background: #EFF6FF;
  color: var(--primary);
}
.btn-favourite {
  background: #F59E0B;
  color: #fff;
}
.btn-favourite:hover:not(:disabled) {
  background: #D97706;
  text-decoration: none;
  color: #fff;
}
.btn-favourite:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.fav-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: #FEF3C7;
  color: #B45309;
  vertical-align: middle;
}
.job-card-favourite {
  border-color: #FCD34D;
}

/* ── Job cards ─────────────────────────────────────────────────── */
.job-list--list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.job-list--grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.job-card   {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
  transition: box-shadow .15s, border-color .15s;
}
.job-list--grid .job-card {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  height: 100%;
}
.job-list--grid .job-card-main {
  flex-direction: column;
  align-items: stretch;
}
.job-list--grid .job-actions {
  margin-top: 8px;
}
.job-list--grid .job-card-score {
  position: absolute;
  top: 14px;
  right: 14px;
  width: auto;
}
.job-list--grid .job-card {
  position: relative;
  padding-top: 14px;
  padding-right: 70px;
}
.job-list--grid .score-badge {
  width: 48px;
  height: 48px;
  font-size: 15px;
}
.job-list--grid .job-title {
  font-size: 16px;
  line-height: 1.35;
  padding-right: 4px;
}
.job-list--grid .desc-toggle {
  display: none;
}
.job-checkbox {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer;
  padding-top: 4px;
}
.job-checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}
.job-card--selectable {
  cursor: pointer;
}
.job-card:has(.job-select:checked) {
  border-color: var(--primary);
  background: #F8FAFF;
}
.job-card--selectable:hover { box-shadow: var(--shadow-md); border-color: #CBD5E1; }
.job-card--selectable .job-checkbox,
.job-card--selectable .job-checkbox input {
  cursor: pointer;
}
.job-card-main { flex: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.job-info      { flex: 1; }
.job-title     { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.job-meta      { display: flex; flex-wrap: wrap; gap: 10px; font-size: 13px; color: var(--text-muted); }
.job-skills    { margin-top: 6px; font-size: 13px; color: var(--text-muted); }
.job-actions   { flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.cv-saved-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: var(--green-bg);
  color: var(--green);
}

/* Score badge */
.job-card-score { text-align: center; flex-shrink: 0; width: 60px; }
.score-badge {
  font-size: 18px; font-weight: 700;
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.score-label { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.score-green { background: var(--green-bg); color: var(--green); }
.score-amber { background: var(--amber-bg); color: var(--amber); }
.score-red   { background: var(--red-bg);   color: var(--red); }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 18px; border-radius: 8px; font-size: 14px; font-weight: 500;
  cursor: pointer; border: none; transition: background .15s, opacity .15s;
  text-decoration: none;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); text-decoration: none; color: #fff; }
.btn-ghost    { background: transparent; color: var(--primary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); text-decoration: none; }
.btn-full     { width: 100%; margin-top: 8px; padding: 11px; font-size: 15px; }
.btn-sm       { padding: 5px 12px; font-size: 13px; }

/* ── Forms ─────────────────────────────────────────────────────── */
.search-layout { display: flex; flex-direction: column; gap: 16px; }
.search-form-card { }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
  margin-bottom: 4px;
}
.form-group-full { grid-column: 1 / -1; }

.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; color: var(--text); }
.required   { color: var(--red); }

.form-input {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

/* Slider */
.slider-row { display: flex; align-items: center; gap: 10px; }
.slider     { flex: 1; accent-color: var(--primary); cursor: pointer; }
.slider-val { font-size: 13px; font-weight: 600; color: var(--primary); min-width: 36px; }

/* Toggle */
.toggle-row   { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle-input { display: none; }
.toggle-track {
  width: 42px; height: 24px; border-radius: 12px; background: #CBD5E1;
  position: relative; transition: background .2s; flex-shrink: 0;
}
.toggle-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-input:checked + .toggle-track { background: var(--primary); }
.toggle-input:checked + .toggle-track .toggle-thumb { transform: translateX(18px); }
.toggle-label { font-size: 14px; font-weight: 500; }

/* ── Log output ────────────────────────────────────────────────── */
.log-card   { background: #0F172A; border-color: #1E293B; }
.log-card .card-title { color: #94A3B8; }
.log-output {
  font-family: 'Courier New', monospace; font-size: 12.5px;
  white-space: pre-wrap; word-break: break-all;
  max-height: 320px; overflow-y: auto;
  color: #94A3B8; line-height: 1.8;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}
/* Colour specific log line prefixes */
.log-output { }


/* ── Filter bar ────────────────────────────────────────────────── */
.filter-bar  { margin-bottom: 16px; }
.filter-form { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filter-search { flex: 1; min-width: 180px; }
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px 16px;
  width: 100%;
}
.filter-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.filter-check {
  display: flex;
  align-items: flex-end;
  min-height: 58px;
}
.job-card--hidden,
.job-card[hidden] {
  display: none !important;
}
#bulkToolbar[hidden],
#jobList[hidden] {
  display: none !important;
}

.platform-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.platform-filters-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}
.platform-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}
.platform-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s;
}
.platform-check:has(input:checked) {
  border-color: var(--primary);
  background: #EFF6FF;
  color: var(--primary);
  font-weight: 500;
}
.platform-check input { accent-color: var(--primary); cursor: pointer; }
.platform-clear {
  font-size: 12px;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
}
.platform-clear:hover { text-decoration: underline; }

.date-filters {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.date-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 150px;
}
.date-filter .form-input { min-width: 150px; }

/* ── Description toggle ────────────────────────────────────────── */
.desc-toggle { margin-top: 8px; }
.desc-toggle summary { font-size: 13px; color: var(--primary); cursor: pointer; }
.desc-text   { margin-top: 8px; font-size: 13px; color: var(--text-muted); line-height: 1.7; }

/* ── Profile ───────────────────────────────────────────────────── */
.page-header--actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.profile-toolbar { display: flex; gap: 8px; flex-shrink: 0; }
.profile-toolbar-edit { display: flex; gap: 8px; }
.profile-toolbar-edit[hidden] { display: none !important; }
#profileView[hidden] { display: none !important; }
.profile-edit { display: flex; flex-direction: column; gap: 16px; }
.profile-edit[hidden] { display: none !important; }
.profile-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.form-hint { font-size: 12px; color: var(--text-muted); margin: -4px 0 10px; }
.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.card-title-row .card-title { margin-bottom: 0; }
.entry-list { display: flex; flex-direction: column; gap: 12px; }
.profile-entry {
  position: relative;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}
.profile-entry--compact { padding-bottom: 10px; }
.entry-remove {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}
.entry-remove:hover { background: #FEE2E2; color: var(--red); }
.form-status {
  font-size: 14px;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: 8px;
}
.form-status--ok { background: var(--green-bg); color: var(--green); }
.form-status--error { background: #FEE2E2; color: var(--red); }

.profile-header-card { display: flex; align-items: center; gap: 20px; }
.profile-avatar {
  width: 60px; height: 60px; border-radius: 50%;
  background: #EFF6FF; color: var(--primary);
  font-size: 24px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.profile-info  { flex: 1; }
.profile-name  { font-size: 18px; font-weight: 700; }
.profile-meta  { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.profile-stat  { text-align: center; }
.stat-value    { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-label    { font-size: 12px; color: var(--text-muted); }

.skills-grid   { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-tag {
  padding: 4px 12px; border-radius: 20px;
  background: #EFF6FF; color: var(--primary);
  font-size: 13px; font-weight: 500;
}

.exp-item      { padding: 14px 0; border-bottom: 1px solid var(--border); }
.exp-item:last-child { border-bottom: none; padding-bottom: 0; }
.exp-header    { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.exp-title     { font-weight: 600; font-size: 15px; }
.exp-company   { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.exp-dates     { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.exp-bullets   { margin-top: 8px; padding-left: 18px; }
.exp-bullets li { font-size: 13px; color: var(--text-muted); margin-bottom: 3px; }

.edu-item      { padding: 10px 0; border-bottom: 1px solid var(--border); }
.edu-item:last-child { border-bottom: none; }
.edu-degree    { font-weight: 600; }
.edu-inst      { font-size: 13px; color: var(--text-muted); }

.project-item  { padding: 10px 0; border-bottom: 1px solid var(--border); }
.project-item:last-child { border-bottom: none; }
.project-name  { font-weight: 600; cursor: pointer; list-style: none; }
.project-name::before { content: "▶ "; font-size: 11px; color: var(--primary); }
details[open] .project-name::before { content: "▼ "; }
.project-desc  { font-size: 13px; color: var(--text-muted); margin-top: 6px; padding-left: 14px; }

/* ── Empty state ───────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-text { color: var(--text-muted); margin-bottom: 20px; font-size: 15px; }
.code-hint  { display: inline-block; background: var(--bg); padding: 6px 14px; border-radius: 6px; font-size: 13px; }

/* ── Platform table (scrape page) ───────────────────────────────── */
.platform-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 16px;
}
.platform-table th,
.platform-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.platform-table th { color: var(--text-muted); font-weight: 600; }
.platform-table td:first-child { font-weight: 500; }

/* ── CV upload ─────────────────────────────────────────────────── */
.notice-card {
  margin-bottom: 16px;
  border-color: #FDE68A;
  background: #FFFBEB;
  font-size: 14px;
  color: #92400E;
}
.upload-dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.upload-dropzone:hover,
.upload-dropzone-active {
  border-color: var(--primary);
  background: #EEF2FF;
}
.upload-icon { font-size: 36px; margin-bottom: 8px; }
.upload-title { font-weight: 600; margin-bottom: 4px; }
.upload-hint { font-size: 13px; color: var(--text-muted); }
.upload-filename { margin-top: 10px; font-size: 13px; font-weight: 500; color: var(--primary); }
.upload-status { font-size: 14px; color: var(--text-muted); margin-top: 8px; }
.upload-summary { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.upload-summary li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.upload-summary li:last-child { border-bottom: none; }

/* ── Badge ─────────────────────────────────────────────────────── */
.badge        { padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-green  { background: var(--green-bg); color: var(--green); }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main    { margin-left: 0; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .form-grid    { grid-template-columns: 1fr; }
  .job-list--grid { grid-template-columns: 1fr; }
  .bulk-toolbar { flex-wrap: wrap; }
  .view-toggle { order: 3; width: 100%; }
  .view-toggle-btn { flex: 1; }
}
