/* ─── Reset & variabelen ────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:       #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --accent:        #7c3aed;
  --bg:            #f5f4ff;
  --card:          #ffffff;
  --border:        #e5e7eb;
  --text:          #111827;
  --muted:         #6b7280;
  --error:         #dc2626;
  --radius:        14px;
  --shadow:        0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(79,70,229,.08);
  --shadow-lg:     0 4px 6px rgba(0,0,0,.05), 0 10px 40px rgba(79,70,229,.12);
}

html, body { height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

#app { display: flex; flex-direction: column; min-height: 100vh; }

/* ─── Header ───────────────────────────────────── */
.app-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  max-width: 920px;
  margin: 0 auto;
  width: 100%;
}

.logo { display: flex; align-items: center; gap: 8px; }
.logo-img {
  height: 120px;
  width: auto;
  object-fit: contain;
  display: block;
}
/* Toon placeholder-tekst als logo.png nog niet beschikbaar is */
.logo-img[src="logo.png"]:not([data-loaded]) {
  display: none;
}
.logo-text { font-weight: 700; font-size: 18px; color: var(--text); }
.koalify-text {
  background: linear-gradient(135deg, #4a9e1f, #6dbf3a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -.2px;
}

.step-pills { display: flex; gap: 6px; align-items: center; }
.step-pill {
  width: 28px; height: 6px;
  border-radius: 9px;
  background: var(--border);
  transition: background .3s, width .3s;
}
.step-pill.done   { background: var(--primary); opacity: .45; }
.step-pill.active { background: var(--primary); width: 42px; }

.progress-track { height: 3px; background: var(--border); }
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width .4s cubic-bezier(.4,0,.2,1);
  width: 0%;
}

/* ─── Stap wrapper ─────────────────────────────── */
.steps-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 16px 80px;
}

.step {
  width: 100%;
  max-width: 760px;
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  height: 0;
  overflow: hidden;
  transition: opacity .35s ease, transform .35s ease;
}
.step.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  height: auto;
  overflow: visible;
}
.step.hidden { display: none; }

/* ─── Welkomstscherm ───────────────────────────── */
.welcome-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: 12px;
}

.ai-bubble {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.ai-avatar       { flex-shrink: 0; width: 52px; height: 52px; }
.ai-avatar svg   { width: 52px; height: 52px; }
.ai-greeting     { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.ai-question     { font-size: 16px; font-weight: 500; line-height: 1.55; }
.ai-question strong { color: var(--primary); }

/* ─── URL kaart ────────────────────────────────── */
.url-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}
.url-row { display: flex; gap: 10px; }
.url-input {
  flex: 1;
  height: 46px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.url-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
  background: white;
}
.url-input::placeholder { color: #aaa; }

.btn-text-link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  padding: 4px 0;
  text-align: center;
  transition: color .2s;
}
.btn-text-link:hover { color: var(--primary); }
.btn-text-link.small { font-size: 13px; }

/* ─── Knoppen ──────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  padding: 0 22px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s, transform .1s, box-shadow .2s;
  box-shadow: 0 2px 8px rgba(79,70,229,.28);
}
.btn-primary:hover   { background: var(--primary-hover); box-shadow: 0 4px 14px rgba(79,70,229,.35); }
.btn-primary:active  { transform: scale(.98); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  height: 46px;
  padding: 0 20px;
  background: white;
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: border-color .2s, background .2s, color .2s;
}
.btn-secondary:hover { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }

.btn-ghost {
  background: none;
  border: 1.5px dashed var(--border);
  color: var(--primary);
  border-radius: 10px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
  transition: border-color .2s, background .2s;
}
.btn-ghost:hover { border-color: var(--primary); background: var(--primary-light); }

.btn-spinner {
  width: 16px; height: 16px;
  border: 2.5px solid rgba(255,255,255,.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin-left: 6px;
}

/* ─── Fout / validatie ─────────────────────────── */
.field-error {
  margin-top: 8px;
  color: var(--error);
  font-size: 13px;
}
.field-error::before { content: '⚠ '; }

/* ─── Stap container ───────────────────────────── */
.step-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.step-container.wide { max-width: 860px; }

.step-heading { margin-bottom: 4px; }
.step-heading h2 { font-size: 22px; font-weight: 700; margin-bottom: 3px; }
.step-heading p  { font-size: 14px; color: var(--muted); }

.step-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 4px;
}

.skip-link-wrap {
  display: flex;
  justify-content: center;
  margin-top: -4px;
}

/* ─── AI mini (inline header) ──────────────────── */
.ai-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}
.ai-avatar-sm     { width: 28px; height: 28px; flex-shrink: 0; }
.ai-avatar-sm svg { width: 28px; height: 28px; }

/* ─── Vacature info kaart ──────────────────────── */
.job-info-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.job-info-title   { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.job-info-company { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.job-meta         { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.job-info-section        { margin-bottom: 14px; }
.job-info-section-label  { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin-bottom: 8px; }
.skills-row              { display: flex; flex-wrap: wrap; gap: 6px; }
.skill-badge             { background: #f3f4f6; color: var(--text); padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 500; }
.responsibilities-list   { list-style: none; }
.responsibilities-list li { padding: 3px 0 3px 16px; font-size: 13px; color: var(--muted); position: relative; }
.responsibilities-list li::before { content: '→'; position: absolute; left: 0; color: var(--primary); }

/* ─── Formulier kaart ──────────────────────────── */
.form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; }
.form-group input, .form-group textarea {
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.form-group input:focus, .form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.10);
  background: white;
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: #aaa; }

.req   { color: var(--primary); }
.muted { color: var(--muted); font-weight: 400; }

/* ─── Chat scherm ──────────────────────────────── */
.chat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-messages {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 260px;
  max-height: 440px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

/* Berichten */
.chat-msg {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.chat-msg.user {
  flex-direction: row-reverse;
}

.chat-ai-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  margin-bottom: 2px;
}
.chat-ai-icon svg { width: 28px; height: 28px; }

.chat-bubble {
  max-width: 75%;
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
}

.ai-bubble-chat {
  background: #f3f4f6;
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.user-bubble {
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

/* Scheiding tussen items in dezelfde chat */
.chat-sep {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0;
}
.chat-sep::before, .chat-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Typ-indicator */
.typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 14px 16px;
}
.typing span {
  width: 7px; height: 7px;
  background: #9ca3af;
  border-radius: 50%;
  animation: bounce .9s infinite;
}
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .30s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-6px); }
}

/* Chat invoerveld */
.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: #fafafa;
}

.chat-input-area textarea {
  flex: 1;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: white;
  outline: none;
  resize: none;
  line-height: 1.5;
  max-height: 180px;
  overflow-y: auto;
  transition: border-color .2s, box-shadow .2s;
}
.chat-input-area textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.10);
}
.chat-input-area textarea::placeholder { color: #aaa; }

.btn-send {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, transform .1s;
  box-shadow: 0 2px 6px rgba(79,70,229,.28);
}
.btn-send:hover  { background: var(--primary-hover); }
.btn-send:active { transform: scale(.95); }
.btn-send:disabled { opacity: .5; cursor: not-allowed; }

/* Done-balk */
.done-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
}

/* ─── Vaardigheden ─────────────────────────────── */
.skills-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.chips-area { display: flex; flex-wrap: wrap; gap: 8px; min-height: 40px; }
.skill-chip {
  padding: 7px 15px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 500;
  border: 1.5px solid var(--border);
  background: white;
  color: var(--muted);
  cursor: pointer;
  transition: all .18s;
  user-select: none;
  font-family: inherit;
}
.skill-chip.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 2px 6px rgba(79,70,229,.25);
}
.skill-chip:hover:not(.selected) { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* ─── Preview ──────────────────────────────────── */
.preview-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 920px;
}
.preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.preview-title h2 { font-size: 20px; font-weight: 700; }
.preview-title p  { font-size: 13px; color: var(--muted); margin-top: 2px; }
.preview-actions  { display: flex; gap: 10px; }
.cv-frame-wrap {
  background: #d1d5db;
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  justify-content: center;
  min-height: 700px;
}
.cv-iframe {
  width: 100%;
  max-width: 780px;
  min-height: 900px;
  border: none;
  border-radius: 6px;
  box-shadow: 0 4px 24px rgba(0,0,0,.18);
  background: white;
}

/* ─── Laadscherm ───────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(17,24,39,.52);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  backdrop-filter: blur(3px);
}
.overlay.hidden { display: none; }
.loading-box {
  background: white;
  border-radius: var(--radius);
  padding: 36px 52px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.loading-box p { font-size: 15px; font-weight: 500; }
.spinner {
  width: 42px; height: 42px;
  border: 3.5px solid #e0e7ff;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

/* ─── Responsief ───────────────────────────────── */
@media (max-width: 620px) {
  .form-grid         { grid-template-columns: 1fr; }
  .url-row           { flex-direction: column; }
  .url-input         { width: 100%; }
  .btn-primary,
  .btn-secondary     { width: 100%; justify-content: center; }
  .step-actions      { flex-direction: column-reverse; }
  .preview-toolbar   { flex-direction: column; align-items: flex-start; }
  .steps-wrapper     { padding: 24px 12px 60px; }
  .step-pills        { display: none; }
  .chat-bubble       { max-width: 88%; }
}
