/* ============================================================
   Job Finder Assistant — Styles
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:       #2563eb;
  --blue-dark:  #1d4ed8;
  --blue-light: #eff6ff;
  --green:      #16a34a;
  --orange:     #ea580c;
  --red:        #dc2626;
  --gray-50:    #f9fafb;
  --gray-100:   #f3f4f6;
  --gray-200:   #e5e7eb;
  --gray-400:   #9ca3af;
  --gray-600:   #4b5563;
  --gray-700:   #374151;
  --gray-900:   #111827;
  --radius:     12px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,.10);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

/* ── Header ── */
header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
header .logo { font-size: 22px; }
header h1 { font-size: 1.15rem; font-weight: 700; color: var(--gray-900); }
header span { font-size: .85rem; color: var(--gray-400); margin-left: 4px; }

/* ── Layout ── */
main { max-width: 860px; margin: 0 auto; padding: 32px 16px 64px; }

/* ── Steps indicator ── */
.steps {
  display: flex;
  gap: 0;
  margin-bottom: 32px;
  border-radius: var(--radius);
  overflow: hidden;
  background: white;
  border: 1px solid var(--gray-200);
}
.step {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  font-size: .8rem;
  color: var(--gray-400);
  border-right: 1px solid var(--gray-200);
  position: relative;
  transition: all .25s;
}
.step:last-child { border-right: none; }
.step.active { background: var(--blue-light); color: var(--blue); font-weight: 600; }
.step.done   { background: #f0fdf4; color: var(--green); }
.step-num {
  display: inline-block;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--gray-600);
  font-size: .75rem;
  font-weight: 700;
  line-height: 22px;
  margin-right: 6px;
}
.step.active .step-num { background: var(--blue); color: white; }
.step.done   .step-num { background: var(--green); color: white; }

/* ── Card ── */
.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.card h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: 16px; color: var(--gray-700); }

/* ── Upload Zone ── */
#upload-zone {
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--gray-50);
}
#upload-zone:hover, #upload-zone.drag-over {
  border-color: var(--blue);
  background: var(--blue-light);
}
#upload-zone .icon { font-size: 3rem; margin-bottom: 12px; }
#upload-zone p { color: var(--gray-600); margin-bottom: 6px; }
#upload-zone small { color: var(--gray-400); font-size: .8rem; }
#file-input { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .2s;
}
.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── File selected state ── */
#file-info {
  display: none;
  align-items: center;
  gap: 12px;
  background: var(--blue-light);
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 16px;
}
#file-info .file-icon { font-size: 1.4rem; }
#file-info .file-name { font-weight: 600; color: var(--blue-dark); flex: 1; }
#file-info .file-size { font-size: .8rem; color: var(--gray-600); }

/* ── Progress / Loading ── */
.progress-container {
  display: none;
  flex-direction: column;
  gap: 12px;
}
.progress-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .9rem;
  color: var(--gray-600);
}
.progress-item .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--gray-200);
  flex-shrink: 0;
}
.progress-item.running .dot {
  background: var(--blue);
  animation: pulse 1s infinite;
}
.progress-item.done .dot { background: var(--green); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

.spinner {
  width: 20px; height: 20px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Profile display ── */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) { .profile-grid { grid-template-columns: 1fr; } }

.profile-field label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-400);
  display: block;
  margin-bottom: 6px;
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  background: var(--blue-light);
  color: var(--blue);
  border: 1px solid #bfdbfe;
  border-radius: 20px;
  padding: 3px 10px;
  font-size: .78rem;
  font-weight: 500;
}
.tag-green { background: #f0fdf4; color: var(--green); border-color: #bbf7d0; }
.tag-gray  { background: var(--gray-100); color: var(--gray-600); border-color: var(--gray-200); }

/* ── Filters ── */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
}
.filters label { font-size: .85rem; font-weight: 600; color: var(--gray-600); }
select, input[type="range"] {
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: .85rem;
  background: white;
  cursor: pointer;
}
#score-filter-label { font-size: .85rem; color: var(--gray-600); min-width: 60px; }

/* ── Job cards ── */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.results-count { font-size: .9rem; color: var(--gray-600); }
.results-count strong { color: var(--gray-900); }

.job-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, border-color .2s;
  cursor: pointer;
}
.job-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--blue);
}

.job-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.job-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
  flex: 1;
  text-decoration: none;
}
.job-title:hover { color: var(--blue); }

.score-badge {
  flex-shrink: 0;
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  font-weight: 800;
  border: 3px solid;
}
.score-high   { color: var(--green);  border-color: var(--green);  background: #f0fdf4; }
.score-medium { color: #d97706;        border-color: #fbbf24;        background: #fffbeb; }
.score-low    { color: var(--orange); border-color: var(--orange); background: #fff7ed; }

.job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: .82rem;
  color: var(--gray-600);
  margin-bottom: 10px;
}
.job-meta span { display: flex; align-items: center; gap: 4px; }

.job-summary {
  font-size: .85rem;
  color: var(--gray-700);
  margin-bottom: 10px;
  font-style: italic;
}

.job-points {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--gray-100);
}
.job-card.expanded .job-points { display: block; }

.points-section { margin-bottom: 8px; }
.points-section h4 { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.points-section h4.match  { color: var(--green);  }
.points-section h4.miss   { color: var(--orange); }
.points-list { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.point-item {
  font-size: .78rem;
  padding: 2px 8px;
  border-radius: 12px;
}
.point-match { background: #f0fdf4; color: var(--green);  border: 1px solid #bbf7d0; }
.point-miss  { background: #fff7ed; color: var(--orange); border: 1px solid #fed7aa; }

.source-badge {
  font-size: .72rem;
  padding: 2px 8px;
  background: var(--gray-100);
  color: var(--gray-600);
  border-radius: 12px;
  font-weight: 500;
}

.btn-apply {
  margin-top: 12px;
  padding: 8px 18px;
  background: var(--blue);
  color: white;
  border-radius: 8px;
  text-decoration: none;
  font-size: .85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .2s;
}
.btn-apply:hover { background: var(--blue-dark); }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-400);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }

/* ── Error state ── */
.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: .9rem;
}

/* ── Sections hidden/shown ── */
.hidden { display: none !important; }

/* ── Section divider ── */
.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0 20px;
  color: var(--gray-400);
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.section-divider::before,
.section-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

/* ── Search params grid ── */
.search-params-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 600px) { .search-params-grid { grid-template-columns: 1fr; } }

.param-field label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-400);
  display: block;
  margin-bottom: 8px;
}

.param-input {
  width: 100%;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: .9rem;
  color: var(--gray-900);
  background: white;
  transition: border-color .2s;
}
.param-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

/* ── Tag editor (mots-clés éditables) ── */
.tag-editor {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 8px 10px;
  min-height: 44px;
  background: white;
  cursor: text;
  transition: border-color .2s;
}
.tag-editor:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.tag-edit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--blue-light);
  color: var(--blue);
  border: 1px solid #bfdbfe;
  border-radius: 20px;
  padding: 3px 8px 3px 10px;
  font-size: .78rem;
  font-weight: 500;
  white-space: nowrap;
}

.tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  background: rgba(37,99,235,.15);
  color: var(--blue);
  font-size: .75rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: background .15s;
}
.tag-remove:hover { background: rgba(37,99,235,.35); }

.tag-add-input {
  border: none;
  outline: none;
  font-size: .85rem;
  color: var(--gray-700);
  background: transparent;
  min-width: 120px;
  flex: 1;
  padding: 2px 0;
}
.tag-add-input::placeholder { color: var(--gray-400); }

/* ── Toggle buttons (contrat, taille) ── */
.toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.toggle-btn {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--gray-200);
  background: white;
  color: var(--gray-600);
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .18s;
}
.toggle-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-light);
}
.toggle-btn.active {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

/* ── Department picker ── */
.dept-picker-wrapper {
  position: relative;
}

.dept-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 8px 10px;
  min-height: 44px;
  background: white;
  cursor: text;
  transition: border-color .2s;
}
.dept-picker:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.dept-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--blue-light);
  color: var(--blue);
  border: 1px solid #bfdbfe;
  border-radius: 20px;
  padding: 3px 8px 3px 10px;
  font-size: .78rem;
  font-weight: 500;
  white-space: nowrap;
}

.dept-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  background: rgba(37,99,235,.15);
  color: var(--blue);
  font-size: .75rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: background .15s;
}
.dept-chip-remove:hover { background: rgba(37,99,235,.35); }

.dept-search-input {
  border: none;
  outline: none;
  font-size: .85rem;
  color: var(--gray-700);
  background: transparent;
  min-width: 140px;
  flex: 1;
  padding: 2px 0;
}
.dept-search-input::placeholder { color: var(--gray-400); }

.dept-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  max-height: 250px;
  overflow-y: auto;
  margin-top: 4px;
}

.dept-option {
  padding: 8px 12px;
  font-size: .85rem;
  color: var(--gray-700);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background .12s;
}
.dept-option:hover {
  background: var(--blue-light);
  color: var(--blue);
}
.dept-option.selected {
  background: var(--blue-light);
  color: var(--blue);
  font-weight: 600;
}
.dept-option-check {
  width: 16px;
  height: 16px;
  border: 2px solid var(--gray-200);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  transition: all .12s;
}
.dept-option.selected .dept-option-check {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

/* ── Search progress (dans profile section) ── */
.progress-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}
