/* ═══════════════════════════════════════════════════════
   CV Generator — Modern dark UI
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

/* Garantit que display:flex/grid ne peut pas écraser l'attribut HTML hidden */
[hidden] { display: none !important; }

:root {
  /* Palette */
  --bg:           #0d1117;
  --surface:      #161b22;
  --surface-2:    #1c2128;
  --border:       rgba(240,246,252,.1);
  --border-hover: rgba(88,166,255,.4);

  /* Brand */
  --blue:         #2563eb;
  --blue-hover:   #1d4ed8;
  --blue-glow:    rgba(37,99,235,.25);
  --accent:       #58a6ff;
  --purple:       #8b5cf6;

  /* Gradients */
  --grad-brand:   linear-gradient(135deg, #667eea 0%, #2563eb 100%);
  --grad-hero:    linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --grad-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);

  /* Text */
  --text:         #e6edf3;
  --text-muted:   #8b949e;
  --text-subtle:  #484f58;

  /* Status */
  --success:      #3fb950;
  --success-bg:   rgba(63,185,80,.1);
  --success-border: rgba(63,185,80,.3);
  --error:        #f85149;
  --error-bg:     rgba(248,81,73,.1);
  --error-border: rgba(248,81,73,.3);

  --radius-sm:    6px;
  --radius:       12px;
  --radius-lg:    16px;
  --shadow:       0 8px 32px rgba(0,0,0,.4);
  --shadow-sm:    0 2px 8px rgba(0,0,0,.3);
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── BACKGROUND BLOBS ─────────────────────────────────── */
.bg-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .12;
  pointer-events: none;
  z-index: 0;
}
.blob-1 {
  width: 500px; height: 500px;
  background: var(--blue);
  top: -100px; left: -150px;
  animation: float 14s ease-in-out infinite;
}
.blob-2 {
  width: 400px; height: 400px;
  background: var(--purple);
  bottom: -80px; right: -100px;
  animation: float 18s ease-in-out infinite reverse;
}
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(30px, -20px) scale(1.05); }
  66%       { transform: translate(-20px, 20px) scale(.97); }
}

/* ─── HEADER ───────────────────────────────────────────── */
.header {
  position: sticky; top: 0; z-index: 200;
  background: rgba(13,17,23,.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 780px; margin: 0 auto;
  padding: .75rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.header-brand { display: flex; align-items: center; gap: .75rem; }
.header-icon {
  width: 34px; height: 34px;
  background: var(--grad-brand);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.header-icon svg { color: #fff; width: 18px; height: 18px; }
.header-title { display: block; font-size: .95rem; font-weight: 700; color: var(--text); }
.header-sub    { display: block; font-size: .72rem; color: var(--text-muted); margin-top: -.1rem; }

.btn-settings {
  display: flex; align-items: center; gap: .4rem;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .42rem .85rem;
  font-size: .8rem; font-weight: 500; font-family: inherit;
  cursor: pointer;
  transition: all .2s;
}
.btn-settings:hover { border-color: var(--border-hover); color: var(--accent); }

/* ─── MAIN ─────────────────────────────────────────────── */
.main {
  position: relative; z-index: 1;
  max-width: 680px; margin: 0 auto;
  padding: 3rem 1rem 6rem;
}

/* ─── HERO ─────────────────────────────────────────────── */
.hero { text-align: center; margin-bottom: 2.5rem; animation: fadeUp .6s ease both; }
.hero-title {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 700; line-height: 1.2;
  letter-spacing: -.03em; color: var(--text);
  margin-bottom: .75rem;
}
.gradient-text {
  background: var(--grad-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: .92rem; color: var(--text-muted);
  line-height: 1.7; max-width: 520px; margin: 0 auto;
}
.hide-sm { display: none; }
@media (min-width: 520px) { .hide-sm { display: inline; } }

/* ─── FORM CARD ─────────────────────────────────────────── */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow);
  animation: fadeUp .6s .1s ease both;
}

/* Steps */
.step { }
.step-header {
  display: flex; align-items: flex-start; gap: .9rem;
  margin-bottom: 1.1rem;
}
.step-num {
  width: 26px; height: 26px; flex-shrink: 0;
  background: var(--grad-brand);
  border-radius: 50%;
  font-size: .72rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  color: #fff; margin-top: .1rem;
}
.step-num-opt { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); }
.step-title { font-size: .95rem; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: .5rem; }
.step-desc  { font-size: .78rem; color: var(--text-muted); margin-top: .15rem; }
.badge-opt  {
  font-size: .68rem; font-weight: 500; letter-spacing: .04em;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-muted); border-radius: 4px;
  padding: .1rem .4rem;
}
.collapse-btn {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: .25rem;
  border-radius: 4px; transition: color .2s, transform .25s;
  flex-shrink: 0;
}
.collapse-btn:hover { color: var(--text); }
.collapse-btn.collapsed { transform: rotate(180deg); }

.collapsible {
  overflow: hidden;
  max-height: 600px;
  transition: max-height .35s cubic-bezier(.4,0,.2,1), opacity .3s;
  opacity: 1;
}
.collapsible.hidden { max-height: 0; opacity: 0; }

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

/* ─── DROP ZONE ─────────────────────────────────────────── */
.drop-zone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: rgba(255,255,255,.02);
  position: relative; overflow: hidden;
}
.drop-zone::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--grad-brand);
  opacity: 0;
  transition: opacity .2s;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  border-style: solid;
}
.drop-zone:hover::before, .drop-zone.drag-over::before { opacity: .03; }
.drop-zone.drag-over { border-color: var(--blue); }

.drop-zone-sm { padding: 1.4rem; }

.drop-inner { position: relative; z-index: 1; }

.drop-icon-wrap {
  width: 56px; height: 56px; margin: 0 auto .9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  transition: transform .2s, background .2s;
}
.drop-zone:hover .drop-icon-wrap { transform: translateY(-2px); background: rgba(88,166,255,.08); }
.drop-icon-sm { width: 42px; height: 42px; margin-bottom: .6rem; }

.drop-text {
  font-size: .92rem; font-weight: 500; color: var(--text);
  margin-bottom: .25rem;
}
.drop-text-sm { font-size: .84rem; }
.drop-hint { font-size: .8rem; color: var(--text-muted); }

/* File chip */
.file-chip {
  display: flex; align-items: center; gap: .7rem;
  background: rgba(88,166,255,.08);
  border: 1px solid rgba(88,166,255,.2);
  border-radius: var(--radius-sm);
  padding: .65rem 1rem;
  position: relative; z-index: 1;
}
.file-chip-icon { color: var(--accent); flex-shrink: 0; }
.file-chip-name {
  flex: 1; font-size: .88rem; font-weight: 500;
  color: var(--text); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.file-chip-size { font-size: .76rem; color: var(--text-muted); white-space: nowrap; }
.file-chip-remove {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); display: flex;
  padding: .2rem; border-radius: 4px;
  transition: color .15s, background .15s;
}
.file-chip-remove:hover { color: var(--error); background: var(--error-bg); }

/* ─── FORM FIELDS ───────────────────────────────────────── */
.field-row { margin-bottom: 1.1rem; }
.field-label {
  display: block; font-size: .82rem; font-weight: 500;
  color: var(--text-muted); margin-bottom: .45rem;
}

.text-input, .textarea-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .65rem .9rem;
  font-size: .9rem; font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  resize: vertical;
}
.text-input::placeholder, .textarea-input::placeholder { color: var(--text-subtle); }
.text-input:focus, .textarea-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-glow);
}
.textarea-input { min-height: 90px; }

.char-bar {
  height: 2px; background: var(--surface-2);
  border-radius: 2px; margin-top: .4rem; overflow: hidden;
}
.char-bar-fill {
  height: 100%; background: var(--grad-brand);
  border-radius: 2px; width: 0;
  transition: width .3s;
}
.char-counter {
  text-align: right; font-size: .72rem;
  color: var(--text-subtle); margin-top: .25rem;
}

/* ─── ALERTS ─────────────────────────────────────────────── */
.alert-error, .alert-success {
  display: flex; align-items: flex-start; gap: .55rem;
  border-radius: var(--radius-sm);
  padding: .7rem .9rem;
  font-size: .84rem; margin: 1rem 0;
}
.alert-error   { background: var(--error-bg);   border: 1px solid var(--error-border);   color: var(--error);   }
.alert-success { background: var(--success-bg); border: 1px solid var(--success-border); color: var(--success); }
.alert-error svg, .alert-success svg { flex-shrink: 0; margin-top: .1rem; }

/* ─── GENERATE BUTTON ───────────────────────────────────── */
.btn-generate {
  width: 100%;
  background: var(--grad-brand);
  color: #fff; border: none;
  border-radius: var(--radius);
  padding: .9rem 1.5rem;
  font-size: .95rem; font-weight: 600; font-family: inherit;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  margin-top: 1.5rem;
  position: relative; overflow: hidden;
  transition: opacity .2s, transform .15s, box-shadow .2s;
  box-shadow: 0 4px 20px var(--blue-glow);
}
.btn-generate::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.15) 0%, transparent 60%);
  opacity: 0; transition: opacity .2s;
}
.btn-generate:hover::after { opacity: 1; }
.btn-generate:hover { box-shadow: 0 6px 28px var(--blue-glow); transform: translateY(-1px); }
.btn-generate:active { transform: translateY(0); }
.btn-generate:disabled {
  opacity: .65; cursor: not-allowed;
  transform: none; box-shadow: none;
}
#btnLabel { display: flex; align-items: center; gap: .5rem; }

/* Loading state */
.btn-spinner {
  display: flex; align-items: center; gap: .65rem;
}
.ring {
  width: 16px; height: 16px; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#btnStepText { font-weight: 500; }

/* ─── SUCCESS CARD ──────────────────────────────────────── */
.success-card {
  background: var(--surface);
  border: 1px solid var(--success-border);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  box-shadow: 0 0 40px rgba(63,185,80,.08);
  animation: fadeUp .5s ease both;
}
.success-anim { margin-bottom: 1.5rem; }
.success-circle {
  width: 70px; height: 70px; margin: 0 auto;
  border-radius: 50%;
  background: var(--grad-success);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 30px rgba(56,239,125,.2);
}
.checkmark { width: 42px; height: 42px; }
.checkmark-circle {
  stroke: rgba(255,255,255,.3);
  stroke-width: 2;
}
.checkmark-check {
  stroke: #fff; stroke-width: 3;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: draw .5s .1s ease forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.success-title { font-size: 1.4rem; font-weight: 700; margin-bottom: .5rem; }
.success-sub   { font-size: .9rem; color: var(--text-muted); margin-bottom: 2rem; }
.success-actions {
  display: flex; align-items: center; justify-content: center;
  gap: .75rem; flex-wrap: wrap;
}

/* ─── BUTTONS ───────────────────────────────────────────── */
.btn-download {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--grad-success);
  color: #fff; text-decoration: none;
  border-radius: var(--radius-sm);
  padding: .72rem 1.4rem;
  font-size: .9rem; font-weight: 600;
  box-shadow: 0 4px 16px rgba(63,185,80,.25);
  transition: transform .15s, box-shadow .2s;
}
.btn-download:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(63,185,80,.35); }

.btn-ghost {
  display: inline-flex; align-items: center; gap: .45rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .72rem 1.2rem;
  font-size: .88rem; font-weight: 500; font-family: inherit;
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}
.btn-ghost:hover { border-color: var(--border-hover); color: var(--text); background: rgba(255,255,255,.03); }

.link-btn {
  background: none; border: none;
  color: var(--accent); cursor: pointer;
  font-size: inherit; font-family: inherit;
  text-decoration: underline; padding: 0;
  transition: color .15s;
}
.link-btn:hover { color: #fff; }

/* ─── MODAL ─────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border: 1px solid rgba(240,246,252,.15);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 500px;
  box-shadow: var(--shadow), 0 0 0 1px rgba(0,0,0,.3);
  animation: scaleIn .2s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.94) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-title-row { display: flex; align-items: center; gap: .6rem; color: var(--accent); }
.modal-header h2 { font-size: .98rem; font-weight: 600; color: var(--text); }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: .3rem;
  border-radius: 4px; display: flex;
  transition: color .15s, background .15s;
}
.modal-close:hover { color: var(--error); background: var(--error-bg); }

.modal-body { padding: 1.5rem; }
.modal-tip {
  font-size: .82rem; line-height: 1.55;
  background: rgba(88,166,255,.08);
  border: 1px solid rgba(88,166,255,.2);
  border-radius: var(--radius-sm);
  color: var(--accent);
  padding: .65rem .9rem;
  margin-bottom: 1rem;
}
.modal-tip strong { color: #fff; }

.modal-desc {
  font-size: .85rem; color: var(--text-muted);
  line-height: 1.6; margin-bottom: 1.1rem;
}
.modal-desc strong { color: var(--text); }

.tpl-status-row { margin-bottom: 1rem; }
.tpl-badge {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .78rem; font-weight: 500;
  border-radius: 4px; padding: .25rem .6rem;
}
.tpl-ok   { background: var(--success-bg); border: 1px solid var(--success-border); color: var(--success); }
.tpl-none { background: var(--surface-2);  border: 1px solid var(--border);         color: var(--text-muted); }

.modal-footer {
  display: flex; align-items: center; justify-content: flex-end;
  gap: .65rem; margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}
.btn-apply {
  display: inline-flex; align-items: center; gap: .45rem;
  background: var(--grad-brand); color: #fff; border: none;
  border-radius: var(--radius-sm);
  padding: .6rem 1.1rem;
  font-size: .85rem; font-weight: 600; font-family: inherit;
  cursor: pointer;
  transition: opacity .2s;
}
.btn-apply:hover { opacity: .9; }
.btn-apply:disabled { opacity: .5; cursor: not-allowed; }

/* ─── ANIMATIONS ─────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 520px) {
  .main { padding: 1.5rem .75rem 4rem; }
  .form-card, .success-card { padding: 1.5rem; }
  .btn-generate { font-size: .88rem; }
  .hero-title { font-size: 1.6rem; }
}
