
/* ==========================================================
   RESUMEPASS — FULL FLOW  |  100% Mobile-First Responsive
   ========================================================== */

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

:root {
  --blue:    #2563EB;
  --blue-h:  #1D4ED8;
  --blue-l:  #EFF6FF;
  --blue-m:  #BFDBFE;
  --white:   #FFFFFF;
  --bg:      #F7F8FA;
  --border:  #E5E7EB;
  --bm:      #D1D5DB;
  --th:      #111827;
  --tb:      #374151;
  --tm:      #6B7280;
  --tl:      #9CA3AF;
  --green:   #16A34A;
  --gl:      #F0FDF4;
  --red:     #DC2626;
  --font:    'Plus Jakarta Sans', system-ui, sans-serif;
  --radius:  10px;
  --shadow:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); font-family: var(--font);
  font-size: 14px; color: var(--tb);
  min-height: 100vh; display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ── NAV ───────────────────────────────────────────────── */
.top-nav {
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 0 clamp(16px, 4vw, 40px); height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 90; gap: 12px;
}
.logo {
  font-size: clamp(15px, 2.5vw, 18px); font-weight: 800;
  color: var(--th); letter-spacing: -0.3px;
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; cursor: pointer; flex-shrink: 0;
}
.logo-icon {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--blue); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-icon svg { width: 15px; height: 15px; }
.nav-right { display: flex; gap: 8px; align-items: center; }
.nav-btn {
  font-family: var(--font); font-size: 13px; font-weight: 600;
  padding: 7px 14px; border-radius: 8px; cursor: pointer;
  border: 1.5px solid var(--border); background: var(--white); color: var(--tm);
  transition: all 0.15s; white-space: nowrap;
}
.nav-btn:hover { border-color: var(--blue); color: var(--blue); }
.nav-btn.primary { background: var(--blue); color: white; border-color: var(--blue); }
.nav-btn.primary:hover { background: var(--blue-h); }

/* ── PROGRESS BAR ──────────────────────────────────────── */
.progress-bar {
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 0 clamp(12px, 4vw, 40px); height: 56px;
  display: flex; align-items: center; justify-content: center; overflow-x: auto;
  scrollbar-width: none;
}
.progress-bar::-webkit-scrollbar { display: none; }
.progress-steps { display: flex; align-items: center; gap: 0; }
.step { display: flex; align-items: center; gap: 8px; padding: 0 clamp(8px, 2vw, 24px); }
.step-circle {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0; transition: all 0.3s;
}
.step.active .step-circle { background: var(--blue); color: white; box-shadow: 0 0 0 4px rgba(37,99,235,0.15); }
.step.done .step-circle   { background: var(--blue); color: white; }
.step.inactive .step-circle { background: var(--bg); color: var(--tl); border: 2px solid var(--border); }
.step-label { font-size: clamp(11px, 1.5vw, 13px); font-weight: 600; transition: color 0.3s; white-space: nowrap; }
.step.active .step-label   { color: var(--blue); }
.step.done .step-label     { color: var(--blue); }
.step.inactive .step-label { color: var(--tl); }
.step-connector { width: clamp(20px, 4vw, 80px); height: 2px; background: var(--border); flex-shrink: 0; transition: background 0.3s; }
.step-connector.done { background: var(--blue); }
/* Hide labels on very small screens */
@media (max-width: 420px) { .step-label { display: none; } .step { padding: 0 8px; } .step-connector { width: 16px; } }

/* ── VIEWS ─────────────────────────────────────────────── */
.view { display: none; flex-direction: column; flex: 1; }
.view.active { display: flex; }

/* ── STEP 1 — TEMPLATE CHOOSER ─────────────────────────── */
.page-header { text-align: center; padding: clamp(20px,4vw,40px) clamp(16px,4vw,40px) clamp(16px,3vw,24px); }
.page-title { font-size: clamp(20px,4vw,28px); font-weight: 800; color: var(--th); letter-spacing: -0.5px; margin-bottom: 8px; }
.page-subtitle { font-size: clamp(13px,2vw,14px); color: var(--tm); max-width: 440px; margin: 0 auto 12px; line-height: 1.55; }
.choose-later { font-size: 13px; color: var(--tm); font-weight: 500; border-bottom: 1px dashed var(--bm); cursor: pointer; }
.choose-later:hover { color: var(--blue); border-color: var(--blue); }

.filter-bar {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; padding: 0 clamp(16px,4vw,40px) 20px;
  flex-wrap: wrap;
}
.filter-tab {
  font-family: var(--font); font-size: clamp(12px,1.5vw,13px); font-weight: 600;
  padding: 7px 14px; border-radius: 8px; border: 1.5px solid var(--border);
  background: var(--white); color: var(--tm); cursor: pointer; transition: all 0.15s;
  white-space: nowrap;
}
.filter-tab:hover { border-color: var(--blue-m); color: var(--blue); background: var(--blue-l); }
.filter-tab.active { background: var(--blue); color: white; border-color: var(--blue); box-shadow: 0 2px 8px rgba(37,99,235,0.25); }

.grid-container { padding: 0 clamp(12px,3vw,40px) 60px; max-width: 1280px; margin: 0 auto; width: 100%; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(180px, 45vw), 1fr)); gap: clamp(10px,2vw,18px); }

/* Template Card */
.tmpl-card { background: var(--white); border: 1.5px solid var(--border); border-radius: 12px; overflow: hidden; cursor: pointer; position: relative; transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s; animation: cardIn 0.35s ease both; }
.tmpl-card:hover { transform: translateY(-3px); border-color: var(--blue); box-shadow: 0 10px 32px rgba(37,99,235,0.13); }
.tmpl-card.selected { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.18); }
@keyframes cardIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.card-preview { aspect-ratio: 1/1.414; overflow: hidden; position: relative; background: #F9FAFB; }
.card-overlay { position: absolute; inset: 0; background: rgba(255,255,255,0.92); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.18s; flex-direction: column; gap: 8px; padding: 12px; }
.tmpl-card:hover .card-overlay { opacity: 1; }
/* Touch devices: always show overlay (no hover) */
@media (hover: none) { .card-overlay { opacity: 0 !important; } }
.ov-btn { font-family: var(--font); font-size: 12px; font-weight: 700; padding: 9px 0; border-radius: 8px; border: none; cursor: pointer; width: 100%; max-width: 160px; transition: all 0.15s; }
.ov-btn.primary { background: var(--blue); color: white; }
.ov-btn.primary:hover { background: var(--blue-h); }
.ov-btn.outline { background: white; color: var(--blue); border: 1.5px solid var(--blue); }
.ov-btn.outline:hover { background: var(--blue-l); }
.selected-check { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--blue); color: white; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; opacity: 0; transform: scale(0.5); transition: opacity 0.2s, transform 0.2s; z-index: 5; box-shadow: 0 2px 8px rgba(37,99,235,0.4); }
.tmpl-card.selected .selected-check { opacity: 1; transform: scale(1); }
.badge { position: absolute; top: 8px; left: 8px; font-size: 9px; font-weight: 700; padding: 2px 7px; border-radius: 4px; letter-spacing: 0.3px; z-index: 5; }
.badge-popular { background: #FFF7ED; color: #C2410C; border: 1px solid #FED7AA; }
.badge-ats     { background: var(--gl); color: var(--green); border: 1px solid #BBF7D0; }
.badge-new     { background: #F5F3FF; color: #7C3AED; border: 1px solid #DDD6FE; }
.card-info { padding: 9px 11px 11px; border-top: 1px solid var(--border); }
.card-name { font-size: 12px; font-weight: 700; color: var(--th); margin-bottom: 2px; }
.card-meta { display: flex; align-items: center; justify-content: space-between; }
.card-cat  { font-size: 11px; color: var(--tl); font-weight: 500; }
.card-ats  { font-size: 10px; color: var(--green); font-weight: 700; }

/* ── PREVIEW MODAL ─────────────────────────────────────── */
.preview-modal { display: none; position: fixed; inset: 0; z-index: 200; background: rgba(15,23,42,0.7); backdrop-filter: blur(4px); }
.preview-modal.open { display: flex; }
.preview-inner { background: var(--white); width: 100%; height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.preview-topbar {
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 0 clamp(12px,3vw,32px); height: 56px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.preview-template-name { font-size: clamp(13px,2vw,16px); font-weight: 700; color: var(--th); display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; }
.preview-template-num { font-size: 11px; color: var(--tl); font-weight: 500; font-family: monospace; background: var(--bg); padding: 2px 8px; border-radius: 4px; border: 1px solid var(--border); white-space: nowrap; }
.preview-topbar-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.preview-close { width: 34px; height: 34px; border-radius: 8px; border: 1.5px solid var(--border); background: var(--white); color: var(--tm); font-size: 16px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.preview-close:hover { border-color: var(--red); color: var(--red); }
.preview-body { display: flex; flex: 1; overflow: hidden; }
.preview-sidebar { width: 180px; flex-shrink: 0; border-right: 1px solid var(--border); background: var(--bg); overflow-y: auto; padding: 14px 10px; }
.preview-sidebar-label { font-size: 10px; font-weight: 700; color: var(--tl); letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 10px; padding: 0 2px; }
.preview-thumb { border-radius: 7px; overflow: hidden; cursor: pointer; border: 1.5px solid transparent; margin-bottom: 7px; transition: border-color 0.15s; background: var(--white); }
.preview-thumb:hover { border-color: var(--blue-m); }
.preview-thumb.active { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(37,99,235,0.15); }
.preview-thumb-img { aspect-ratio: 1/1.414; overflow: hidden; }
.preview-thumb-label { padding: 5px 7px; font-size: 11px; font-weight: 600; color: var(--th); border-top: 1px solid var(--border); }
.preview-canvas { flex: 1; overflow-y: auto; background: #E8EAF0; display: flex; flex-direction: column; align-items: center; padding: clamp(12px,2vw,32px); gap: 0; }
.preview-cv-sheet { background: white; width: 100%; max-width: 720px; border-radius: 4px; box-shadow: 0 8px 40px rgba(0,0,0,0.18); overflow: visible; flex-shrink: 0; }
/* Each page block inside the CV */
.cv-page { width: 100%; min-height: 1056px; position: relative; overflow: visible; }
.cv-page + .cv-page { margin-top: 20px; border-radius: 4px; box-shadow: 0 8px 40px rgba(0,0,0,0.18); }
.cv-page-break-label { text-align:center; padding: 8px; font-size: 11px; color: #9CA3AF; letter-spacing: 1px; background: #E8EAF0; }
.preview-panel { width: 260px; flex-shrink: 0; border-left: 1px solid var(--border); background: var(--white); padding: 20px 18px; display: flex; flex-direction: column; overflow-y: auto; }
.panel-section { margin-bottom: 20px; }
.panel-label { font-size: 10px; font-weight: 700; color: var(--tl); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 8px; }
.panel-tmpl-name { font-size: 18px; font-weight: 800; color: var(--th); letter-spacing: -0.3px; margin-bottom: 3px; }
.panel-tmpl-style { font-size: 12px; color: var(--tm); margin-bottom: 10px; }
.panel-badges { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-badge { font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 4px; }
.pb-ats { background: var(--gl); color: var(--green); border: 1px solid #BBF7D0; }
.pb-lay { background: #F5F3FF; color: #7C3AED; border: 1px solid #DDD6FE; }
.pb-use { background: #FFF7ED; color: #C2410C; border: 1px solid #FED7AA; }
.panel-divider { height: 1px; background: var(--border); margin-bottom: 18px; }
.panel-meta-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 12px; }
.pml { color: var(--tm); font-weight: 500; }
.pmv { color: var(--th); font-weight: 600; }
.pmv.accent { color: var(--blue); }
.pmv.green  { color: var(--green); }
.color-swatches { display: flex; gap: 6px; margin-bottom: 18px; }
.swatch { width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.8); box-shadow: 0 0 0 1px var(--border); }
.panel-use-btn { display: block; width: 100%; text-align: center; background: var(--blue); color: white; font-family: var(--font); font-size: 14px; font-weight: 700; padding: 12px; border-radius: 9px; border: none; cursor: pointer; transition: all 0.15s; margin-bottom: 8px; }
.panel-use-btn:hover { background: var(--blue-h); }
.panel-nav-btns { display: flex; gap: 8px; margin-bottom: 18px; }
.panel-nav-btn { flex: 1; font-family: var(--font); font-size: 12px; font-weight: 600; padding: 8px; border-radius: 8px; border: 1.5px solid var(--border); background: var(--white); color: var(--tm); cursor: pointer; transition: all 0.15s; }
.panel-nav-btn:hover { border-color: var(--blue); color: var(--blue); }
.ats-check-list { display: flex; flex-direction: column; gap: 6px; }
.ats-row { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--tb); }
.ats-icon { width: 16px; height: 16px; border-radius: 50%; background: var(--gl); color: var(--green); display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; flex-shrink: 0; }
.ats-score-bar { margin-top: 10px; }
.ats-score-label { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.ats-score-val { font-weight: 700; color: var(--green); }
.ats-bar-bg { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.ats-bar-fill { height: 6px; background: linear-gradient(90deg, var(--green), #4ADE80); border-radius: 3px; transition: width 0.8s ease; }

/* ── STEP 2 — FORM ─────────────────────────────────────── */
/* ── STEP 2 — TWO COLUMN: FORM 50% | PREVIEW 50% ── */
.step2-wrap  { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.step2-header { padding: 14px 20px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0; background: var(--white); }
.step2-outer { flex: 1; display: flex; overflow: hidden; min-height: 0; }

/* Form column — exactly 50% */
.step2-form-col {
  width: 50%; flex-shrink: 0; min-width: 0;
  overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg);
}
.step2-form-inner { padding: 16px 20px; flex: 1; }

/* Preview column — exactly 50%, sticky CV view */
.step2-preview-col {
  width: 50%; flex-shrink: 0; min-width: 0;
  background: #DDE1E9;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.step2-preview-topbar {
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 10px 16px; display: flex; align-items: center;
  justify-content: space-between; flex-shrink: 0; gap: 8px;
}
.step2-preview-label  { font-size: 10px; font-weight: 700; color: var(--tl); letter-spacing: 1.5px; text-transform: uppercase; }
.step2-preview-tmpl-name { font-size: 13px; font-weight: 700; color: var(--blue); }

/* CV frame — scrollable area inside preview col */
.step2-cv-frame {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 20px 16px 40px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}

/* The scaled CV page */
.step2-cv-page {
  background: white; border-radius: 3px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  overflow: visible; flex-shrink: 0;
  transform-origin: top center;
  /* Width set by JS based on column width */
}
.step2-title { font-size: clamp(18px,3.5vw,24px); font-weight: 800; color: var(--th); letter-spacing: -0.4px; margin-bottom: 5px; }
.step2-subtitle { font-size: 13px; color: var(--tm); line-height: 1.5; }
.step2-selected-tmpl { display: flex; align-items: center; gap: 12px; background: var(--blue-l); border: 1px solid var(--blue-m); border-radius: 10px; padding: 10px 14px; margin-top: 12px; flex-wrap: wrap; }
.step2-tmpl-preview { width: 36px; height: 50px; border-radius: 4px; overflow: hidden; flex-shrink: 0; border: 1px solid var(--blue-m); }
.step2-tmpl-name { font-size: 13px; font-weight: 700; color: var(--blue); }
.step2-tmpl-change { font-size: 12px; color: var(--blue); text-decoration: underline; cursor: pointer; margin-left: auto; }

/* Section nav pills */
.form-sec-panel { display: none; }
.form-sec-panel.active-panel { display: block; }
.sec-pill {
  font-family: var(--font); font-size: 11px; font-weight: 600;
  padding: 5px 11px; border-radius: 20px; border: 1.5px solid var(--border);
  background: var(--white); color: var(--tm); cursor: pointer; transition: all 0.15s;
  white-space: nowrap;
}
.sec-pill:hover { border-color: var(--blue); color: var(--blue); }
.sec-pill.done { background: var(--gl); color: var(--green); border-color: #BBF7D0; }
.sec-pill.active { background: var(--blue); color: white; border-color: var(--blue); box-shadow: 0 2px 8px rgba(37,99,235,0.25); }

.form-section {
  background: var(--white); border: 1px solid var(--border);
  border-radius: 12px; padding: clamp(16px,3vw,24px);
  margin-bottom: 20px;
}
.fs-title { font-size: clamp(14px,2vw,15px); font-weight: 700; color: var(--th); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.fs-icon { font-size: 16px; }
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--tm); margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%; font-family: var(--font); font-size: 14px;
  padding: 10px 12px; border-radius: 8px;
  border: 1.5px solid var(--border); background: var(--white);
  color: var(--th); outline: none; transition: border-color 0.15s;
  -webkit-appearance: none; appearance: none;
}
.field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.08); }
.field textarea { min-height: 80px; line-height: 1.5; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.exp-entry { border: 1px solid var(--border); border-radius: 8px; padding: 14px; margin-bottom: 12px; position: relative; }
.exp-remove { position: absolute; top: 10px; right: 10px; background: none; border: none; color: var(--tl); font-size: 16px; cursor: pointer; line-height: 1; padding: 4px; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 4px; }
.exp-remove:hover { color: var(--red); background: #FFF5F5; }
.add-more-btn { font-family: var(--font); font-size: 13px; font-weight: 600; color: var(--blue); background: var(--blue-l); border: 1.5px dashed var(--blue-m); padding: 9px 14px; border-radius: 8px; cursor: pointer; width: 100%; transition: all 0.15s; }
.add-more-btn:hover { background: var(--blue); color: white; border-style: solid; }
.skill-tags-wrap { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.skill-tag { font-size: 12px; background: var(--blue-l); color: var(--blue); border: 1px solid var(--blue-m); padding: 3px 10px; border-radius: 20px; display: flex; align-items: center; gap: 5px; font-weight: 600; }
.skill-tag button { background: none; border: none; color: var(--blue); cursor: pointer; font-size: 13px; line-height: 1; padding: 0; }
.skill-input-row { display: flex; gap: 8px; }
.skill-input-row input { flex: 1; }
.skill-add-btn { font-family: var(--font); font-size: 13px; font-weight: 700; background: var(--blue); color: white; border: none; padding: 10px 16px; border-radius: 8px; cursor: pointer; white-space: nowrap; -webkit-tap-highlight-color: transparent; }

.step2-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border);
  gap: 10px; flex-wrap: wrap;
}
.back-btn {
  font-family: var(--font); font-size: 14px; font-weight: 600;
  color: var(--tm); background: var(--white); border: 1.5px solid var(--border);
  padding: 11px 20px; border-radius: 9px; cursor: pointer;
  display: flex; align-items: center; gap: 6px; transition: all 0.15s;
  white-space: nowrap;
}
.back-btn:hover { color: var(--th); border-color: var(--bm); }
.next-btn {
  font-family: var(--font); font-size: 14px; font-weight: 700;
  color: white; background: var(--blue); border: none;
  padding: 12px 20px; border-radius: 9px; cursor: pointer;
  display: flex; align-items: center; gap: 6px; transition: all 0.15s;
  box-shadow: 0 2px 12px rgba(37,99,235,0.25); white-space: nowrap;
}
.next-btn:hover { background: var(--blue-h); }
.skip-btn {
  font-family: var(--font); font-size: 13px; font-weight: 600;
  color: var(--tm); background: transparent; border: 1.5px solid var(--border);
  padding: 10px 16px; border-radius: 9px; cursor: pointer;
  display: flex; align-items: center; gap: 5px; transition: all 0.15s;
  white-space: nowrap;
}
.skip-btn:hover { border-color: var(--bm); color: var(--th); background: var(--bg); }
.sec-pill.skipped { background: #FFFBEB; color: #D97706; border-color: #FDE68A; }

/* ── STEP 3 — DOWNLOAD ─────────────────────────────────── */
.step3-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: clamp(20px,4vw,40px); }
.step3-card { background: var(--white); border: 1px solid var(--border); border-radius: 20px; padding: clamp(24px,5vw,48px) clamp(20px,5vw,52px); text-align: center; max-width: 520px; width: 100%; box-shadow: 0 8px 40px rgba(0,0,0,0.06); }
.step3-icon { font-size: clamp(36px,7vw,52px); margin-bottom: 14px; display: block; }
.step3-title { font-size: clamp(20px,4vw,26px); font-weight: 800; color: var(--th); letter-spacing: -0.5px; margin-bottom: 8px; }
.step3-sub { font-size: clamp(13px,2vw,14px); color: var(--tm); line-height: 1.65; margin-bottom: 24px; }
.step3-preview { width: 140px; height: 197px; margin: 0 auto 24px; border-radius: 8px; overflow: hidden; box-shadow: 0 8px 32px rgba(0,0,0,0.14), 0 0 0 1px var(--border); }
.dl-buttons { display: flex; flex-direction: column; gap: 10px; }
.dl-btn { font-family: var(--font); font-size: 14px; font-weight: 700; padding: 13px 20px; border-radius: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.15s; border: none; -webkit-tap-highlight-color: transparent; }
.dl-btn.pdf  { background: var(--blue); color: white; box-shadow: 0 2px 12px rgba(37,99,235,0.3); }
.dl-btn.pdf:hover  { background: var(--blue-h); }
.dl-btn.docx { background: var(--white); color: var(--th); border: 1.5px solid var(--border); }
.dl-btn.docx:hover { border-color: var(--blue); color: var(--blue); }
.dl-btn.edit { background: var(--gl); color: var(--green); border: 1.5px solid #BBF7D0; }
.step3-restart { margin-top: 18px; font-size: 13px; color: var(--tl); }
.step3-restart a { color: var(--blue); cursor: pointer; font-weight: 600; }

/* ── FOOTER ────────────────────────────────────────────── */
footer { background: var(--white); border-top: 1px solid var(--border); padding: 14px clamp(16px,4vw,40px); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.footer-copy { font-size: 12px; color: var(--tl); }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-links a { font-size: 12px; color: var(--tm); text-decoration: none; }
.footer-links a:hover { color: var(--blue); }

/* ── TOAST ─────────────────────────────────────────────── */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--th); color: white; font-size: 13px; font-weight: 600; padding: 10px 20px; border-radius: 10px; z-index: 999; opacity: 0; transition: opacity 0.25s, transform 0.25s; display: flex; align-items: center; gap: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.2); pointer-events: none; white-space: nowrap; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── SCROLLBAR ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

/* ════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ════════════════════════════════════════════════════════ */

/* ── TABLET: ≤ 900px ──────────────────────────────────── */
@media (max-width: 900px) {
  /* Preview: hide sidebar thumbnails */
  .preview-sidebar { display: none; }
  /* Preview: shrink right panel */
  .preview-panel { width: 220px; padding: 14px; }
  .panel-tmpl-name { font-size: 15px; }
  /* Template grid */
  .template-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
}

/* ── MOBILE: ≤ 640px ──────────────────────────────────── */
@media (max-width: 640px) {
  /* Nav */
  .nav-btn:not(.primary):not(#navUseBtn) { display: none; }
  /* Progress: show only circles */
  .step-label { display: none; }
  .step { padding: 0 10px; }
  .step-connector { width: 20px; }
  /* Page header */
  .page-title { font-size: 22px; }
  /* Filter tabs: scroll horizontally */
  .filter-bar { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding-bottom: 12px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .filter-bar::-webkit-scrollbar { display: none; }
  /* Template grid: 2 columns */
  .template-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .grid-container { padding: 0 12px 40px; }
  /* Preview modal: hide both sidebar panels, full-width CV */
  .preview-sidebar { display: none !important; }
  .preview-panel { display: none; }
  .preview-canvas { padding: 12px; }
  .preview-topbar { padding: 0 12px; gap: 6px; }
  .preview-topbar-actions .nav-btn:not(.primary) { display: none; }
  .preview-topbar-actions .panel-nav-btn { display: none; }
  .preview-template-num { display: none; }
  /* Step 2 form */
  .step2-outer { flex-direction: column; }
  .step2-form-col  { width: 100%; border-right: none; }
  .step2-form-inner { padding: 12px 14px; }
  .step2-preview-col { width: 100%; height: 55vw; min-height: 280px; max-height: 440px; border-top: 1px solid var(--border); }
  .step2-cv-frame { padding: 12px 10px 24px; }
  .step2-footer { position: sticky; bottom: 0; background: var(--white); border-top: 1px solid var(--border); padding: 12px 14px; margin: 0 -14px; z-index: 10; box-shadow: 0 -4px 16px rgba(0,0,0,0.06); }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .field-row .field { margin-bottom: 14px; }
  .field-row .field:last-child { margin-bottom: 0; }
  .field input, .field textarea, .field select { font-size: 16px; /* prevent zoom on iOS */ }
  /* Section nav pills: horizontal scroll */
  #formSectionNav { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  #formSectionNav::-webkit-scrollbar { display: none; }
  /* Step 3 */
  .step3-wrap { padding: 20px 16px; align-items: flex-start; padding-top: 40px; }
  .step3-card { padding: 28px 20px; border-radius: 14px; }
}

/* ── SMALL MOBILE: ≤ 390px ────────────────────────────── */
@media (max-width: 390px) {
  .template-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .step2-title { font-size: 18px; }
  .next-btn, .back-btn { padding: 11px 14px; font-size: 13px; }
  .filter-tab { font-size: 12px; padding: 6px 11px; }
  footer { flex-direction: column; align-items: flex-start; gap: 8px; }
  .footer-links { gap: 10px; }
}

/* ── TOUCH OPTIMIZATIONS ──────────────────────────────── */
@media (hover: none) and (pointer: coarse) {
  /* Bigger tap targets */
  .filter-tab { padding: 9px 16px; }
  .nav-btn { padding: 9px 16px; min-height: 44px; }
  .add-more-btn { padding: 12px 16px; min-height: 44px; }
  .exp-remove { width: 36px; height: 36px; top: 8px; right: 8px; }
  .dl-btn { padding: 15px; min-height: 52px; }
  .sec-pill { padding: 7px 13px; min-height: 36px; }
  /* Cards: tap to select (no hover overlay) */
  .tmpl-card:active { transform: scale(0.98); border-color: var(--blue); }
}

/* ── LANDSCAPE MOBILE ─────────────────────────────────── */
@media (max-width: 812px) and (orientation: landscape) {
  .step3-wrap { align-items: flex-start; padding-top: 20px; }
  .step3-card { max-width: 600px; }
  .step3-preview { width: 100px; height: 141px; margin-bottom: 16px; }
}

/* ── SAFE AREA (iPhone notch/home bar) ────────────────── */
@supports (padding: max(0px)) {
  .top-nav { padding-left: max(clamp(16px,4vw,40px), env(safe-area-inset-left)); padding-right: max(clamp(16px,4vw,40px), env(safe-area-inset-right)); }
  footer { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .step2-footer { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}
