/* ═══════════════════════════════════════════════════════════════════════════
   builder.css — resume builder workspace (v4 rebuild)
   Depends on app.css. Class hooks consumed by builder.js / renderer.js /
   pdfUpload.js are preserved exactly.
   ═══════════════════════════════════════════════════════════════════════════ */

.builder-page { background: var(--bg); }

.nav-context {
  font-size: 0.82rem; font-weight: 600; color: var(--text-muted);
  padding-left: 0.9rem; border-left: 1px solid var(--border);
  white-space: nowrap;
}
.nav-avatar {
  display: none;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand-grad);
  align-items: center; justify-content: center;
  font-size: 0.68rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

/* ── Progress (in app bar) ────────────────────────────────────────────────── */
.nav-progress { display: flex; align-items: center; gap: 0.7rem; flex: 1; max-width: 320px; }
.progress-track {
  flex: 1; height: 6px; border-radius: 99px;
  background: var(--surface-3); overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0;
  background: var(--brand-grad);
  border-radius: 99px;
  transition: width 0.4s cubic-bezier(0.3, 0.8, 0.3, 1);
}
.progress-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.builder-body {
  display: grid;
  grid-template-columns: minmax(360px, 460px) minmax(0, 1fr);
  gap: 1.4rem;
  max-width: 1500px;
  margin: 0 auto;
  padding: 1.4rem clamp(1rem, 3vw, 2rem) 3rem;
  align-items: start;
}

/* ── Form panel ───────────────────────────────────────────────────────────── */
.builder-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.5rem;
}
.form-head h1 { font-size: 1.35rem; margin-bottom: 0.35rem; }
.form-head p { font-size: 0.86rem; color: var(--text-muted); margin-bottom: 1.4rem; }

.form-section { margin-bottom: 1.6rem; }
.form-section-label {
  display: flex; align-items: center; gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 0.95rem; font-weight: 600; color: var(--text);
  margin-bottom: 0.9rem;
}
.section-step {
  width: 24px; height: 24px; border-radius: 8px; flex-shrink: 0;
  background: rgba(124, 92, 252, 0.14);
  border: 1px solid rgba(124, 92, 252, 0.32);
  color: var(--accent-light);
  font-size: 0.75rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
.form-group { margin-bottom: 0.85rem; min-width: 0; }
.form-group label { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.char-count { font-size: 0.7rem; font-weight: 500; color: var(--text-muted); }
.opt { font-size: 0.7rem; font-weight: 400; color: var(--text-muted); }

/* ── Upload zone ──────────────────────────────────────────────────────────── */
.upload-zone {
  display: block;
  cursor: pointer;
  text-align: center;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  padding: 1.5rem 1.2rem;
  margin-bottom: 1.6rem;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.upload-zone:hover { border-color: var(--accent); background: var(--surface-3); }
.upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(124, 92, 252, 0.1);
  transform: scale(1.01);
}
.upload-icon {
  width: 46px; height: 46px; margin: 0 auto 0.7rem;
  border-radius: 13px;
  background: rgba(124, 92, 252, 0.14);
  color: var(--accent-light);
  display: flex; align-items: center; justify-content: center;
}
.upload-text { font-size: 0.9rem; font-weight: 600; color: var(--text); margin-bottom: 0.25rem; }
.upload-hint { font-size: 0.76rem; color: var(--text-muted); }
.upload-file-info {
  display: none; align-items: center; justify-content: center; gap: 0.4rem;
  margin-top: 0.7rem;
  font-size: 0.8rem; font-weight: 600; color: var(--success);
}

/* ── Generate button ──────────────────────────────────────────────────────── */
.generate-wrap { position: sticky; bottom: 0; padding-top: 0.4rem; background: linear-gradient(transparent, var(--surface) 35%); }
.generate-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.02rem; font-weight: 700; color: #fff;
  background: var(--brand-grad);
  border: none; border-radius: 14px;
  padding: 1rem 1.4rem;
  box-shadow: 0 6px 24px -6px rgba(124, 92, 252, 0.6);
  transition: box-shadow 0.2s, transform 0.15s, opacity 0.2s;
}
.generate-btn:hover:not(:disabled) { box-shadow: var(--glow); transform: translateY(-1px); }
.generate-btn:disabled { opacity: 0.65; cursor: progress; }
.generate-btn.loading { animation: genPulse 2s ease infinite; }
@keyframes genPulse {
  0%, 100% { box-shadow: 0 6px 24px -6px rgba(124, 92, 252, 0.5); }
  50% { box-shadow: 0 6px 36px -4px rgba(124, 92, 252, 0.85); }
}
.form-footer-note { text-align: center; font-size: 0.74rem; color: var(--text-muted); margin-top: 0.7rem; }

/* ── Output panel ─────────────────────────────────────────────────────────── */
.builder-output {
  min-height: calc(100vh - 140px);
  display: flex; flex-direction: column; gap: 1rem;
}

/* Action toolbar */
.output-actions {
  display: none; /* shown by JS after generation */
  flex-wrap: wrap; gap: 0.55rem;
  position: sticky; top: 64px; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.action-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.84rem; font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
}
.action-btn:active { transform: translateY(1px); }
.action-btn.primary {
  background: var(--brand-grad); color: #fff;
  box-shadow: 0 3px 12px -3px rgba(124, 92, 252, 0.5);
}
.action-btn.primary:hover { box-shadow: 0 5px 18px -3px rgba(124, 92, 252, 0.7); }
.action-btn.primary.docx { background: linear-gradient(135deg, #2563eb, #3b82f6); box-shadow: 0 3px 12px -3px rgba(59, 130, 246, 0.5); }
.action-btn.primary.txt { background: linear-gradient(135deg, #059669, #10b981); box-shadow: 0 3px 12px -3px rgba(16, 185, 129, 0.5); }
.action-btn.secondary {
  background: var(--surface-2); color: var(--text-soft);
  border-color: var(--border-strong);
}
.action-btn.secondary:hover { color: var(--text); border-color: var(--accent); }
.action-btn.secondary.active {
  background: rgba(124, 92, 252, 0.16);
  border-color: var(--accent);
  color: var(--accent-light);
}
.action-btn:disabled { opacity: 0.6; cursor: wait; }

/* Status bar (generation in progress) */
.status-bar {
  display: none;
  align-items: center; gap: 0.7rem;
  background: var(--surface);
  border: 1px solid rgba(124, 92, 252, 0.35);
  border-radius: var(--radius-md);
  padding: 0.8rem 1.1rem;
  font-size: 0.88rem; color: var(--text-soft);
}
.status-bar.show { display: flex; animation: fadeIn 0.3s ease; }
.status-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent);
  animation: statusBlink 1.1s ease infinite;
}
@keyframes statusBlink { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.8); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* Empty state */
.output-empty {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.4rem;
  text-align: center;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 1.5rem;
  min-height: 380px;
}
.output-empty-art {
  color: var(--text-muted); opacity: 0.7; margin-bottom: 0.8rem;
  animation: floatY 5s ease-in-out infinite;
}
@keyframes floatY { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.output-empty h3 { font-size: 1.15rem; color: var(--text-soft); }
.output-empty p { font-size: 0.88rem; color: var(--text-muted); }

/* ── Rendered resume — always paper-white like a real document ────────────── */
#resume-output, #cover-letter-output {
  display: none;
  background: #fff;
  color: #111;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  padding: clamp(1.4rem, 3vw, 2.4rem);
  font-family: 'Times New Roman', Times, serif;
  font-size: 10.5pt;
  line-height: 1.35;
}
.resume-reveal { animation: resumeIn 0.6s cubic-bezier(0.2, 0.8, 0.3, 1); }
@keyframes resumeIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* AI resume markup (.sh-*) */
#resume-output .sh-header h1 { font-size: 19pt; font-weight: 700; text-align: center; margin-bottom: 3px; color: #000; font-family: inherit; letter-spacing: 0; }
#resume-output .sh-contact { text-align: center; font-size: 9.5pt; margin-bottom: 8px; color: #222; }
#resume-output .sh-section { margin-bottom: 10px; }
#resume-output h2.sh-section-title {
  font-size: 11pt; font-weight: 700; text-transform: uppercase; color: #000;
  border-bottom: 1.5px solid #000; padding-bottom: 2px; margin-bottom: 6px;
  font-family: inherit; letter-spacing: 0.02em;
}
#resume-output .sh-summary { font-size: 10.5pt; text-align: justify; margin-bottom: 4px; }
#resume-output .sh-job { margin-bottom: 7px; }
#resume-output .sh-job-header { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2px; margin-bottom: 2px; }
#resume-output .sh-job-title { font-weight: 700; font-size: 10.5pt; }
#resume-output .sh-job-dates { font-weight: 700; font-size: 10pt; white-space: nowrap; }
#resume-output .sh-project { margin-bottom: 7px; }
#resume-output .sh-project-name { font-weight: 700; font-size: 10.5pt; margin-bottom: 2px; }
#resume-output .sh-bullets { list-style-type: disc; padding-left: 22px; margin-top: 2px; }
#resume-output .sh-bullets li { font-size: 10pt; margin-bottom: 2px; text-align: justify; }
#resume-output .sh-skill-list { list-style-type: disc; padding-left: 22px; }
#resume-output .sh-skill-list li { font-size: 10pt; margin-bottom: 2px; }
#resume-output .sh-edu-item { margin-bottom: 4px; font-size: 10.5pt; }

/* Keyword highlight marks */
#resume-output mark.kw-highlight {
  background: rgba(124, 92, 252, 0.22);
  color: inherit;
  border-radius: 3px;
  padding: 0 2px;
  box-shadow: 0 0 0 1px rgba(124, 92, 252, 0.3);
}

/* Cover letter */
.cover-letter-title {
  font-family: var(--font-display);
  font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: #6d28d9;
  border-bottom: 1px solid #e5e0f5;
  padding-bottom: 6px; margin-bottom: 14px;
}
#cover-letter-output p { margin-bottom: 9px; }

/* ── ATS Score Panel (markup from renderer.js) ────────────────────────────── */
.ats-score-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.ats-loading {
  display: flex; align-items: center; gap: 0.8rem;
  color: var(--text-muted); font-size: 0.9rem;
  padding: 0.6rem 0;
}
.ats-spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid var(--surface-3); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
.ats-error { color: var(--warning); font-size: 0.88rem; }

.ats-header h3 { font-size: 1.1rem; margin-bottom: 0.2rem; }
.ats-sub { font-size: 0.84rem; color: var(--text-muted); margin-bottom: 1.2rem; }

.ats-score-row { display: flex; gap: 1.6rem; align-items: center; }
.ats-donut-wrap { width: 130px; flex-shrink: 0; }
.ats-donut { width: 100%; }
.ats-breakdown { flex: 1; display: grid; gap: 0.7rem; min-width: 0; }
.ats-row { display: grid; grid-template-columns: minmax(90px, 130px) 1fr auto; align-items: center; gap: 0.7rem; }
.ats-row-label { font-size: 0.8rem; color: var(--text-soft); text-transform: capitalize; }
.ats-bar-wrap { height: 7px; background: var(--ats-track); border-radius: 99px; overflow: hidden; }
.ats-bar-fill { height: 100%; border-radius: 99px; transition: width 0.8s cubic-bezier(0.3, 0.8, 0.3, 1); }
.ats-row-score { font-size: 0.76rem; font-weight: 700; }

.ats-missing, .ats-wins { margin-top: 1.3rem; }
.ats-missing h4, .ats-wins h4 { font-size: 0.88rem; margin-bottom: 0.6rem; color: var(--text-soft); }
.ats-tags { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.ats-tag {
  font-size: 0.76rem; font-weight: 600;
  padding: 0.28rem 0.7rem; border-radius: 99px;
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text-soft);
}
.ats-tag.missing {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.35);
  color: var(--warning);
}
.ats-wins ul { padding-left: 1.2rem; display: grid; gap: 0.35rem; }
.ats-wins li { font-size: 0.86rem; color: var(--text-soft); }

/* ── Tailoring Report ─────────────────────────────────────────────────────── */
.tailoring-report {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.tailoring-header { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.5rem 0.7rem; margin-bottom: 1.2rem; }
.tailoring-icon { font-size: 1.1rem; }
.tailoring-header h3 { font-size: 1.1rem; }
.tailoring-subtitle { font-size: 0.8rem; color: var(--text-muted); width: 100%; }

.tailoring-score { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.3rem; }
.score-circle {
  width: 66px; height: 66px; border-radius: 50%; flex-shrink: 0;
  background: radial-gradient(circle at 30% 25%, rgba(124, 92, 252, 0.35), transparent 70%), var(--surface-2);
  border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.score-value { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; color: var(--accent-light); }
.score-label { font-size: 0.84rem; color: var(--text-muted); }

.tailoring-section { margin-bottom: 1.2rem; }
.tailoring-section:last-child { margin-bottom: 0; }
.tailoring-section h4 { font-size: 0.88rem; color: var(--text-soft); margin-bottom: 0.6rem; }

.ats-checklist { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem; }
.checklist-item {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.82rem;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-soft);
}
.checklist-item.pass { border-color: rgba(16, 185, 129, 0.3); }
.checklist-item.fail { opacity: 0.65; }
.check-icon { font-size: 0.78rem; }

.keyword-tags { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.keyword-tag {
  font-size: 0.76rem; font-weight: 600;
  padding: 0.28rem 0.7rem; border-radius: 99px;
  background: rgba(124, 92, 252, 0.12);
  border: 1px solid rgba(124, 92, 252, 0.3);
  color: var(--accent-light);
}

.changes-list { padding-left: 1.2rem; display: grid; gap: 0.4rem; }
.changes-list li { font-size: 0.86rem; color: var(--text-soft); }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .nav-progress { display: none; }
}
@media (max-width: 900px) {
  .builder-body { grid-template-columns: 1fr; }
  .builder-output { min-height: 0; }
  .output-actions { top: 58px; }
  .nav-context { display: none; }
  .ats-score-row { flex-direction: column; align-items: stretch; }
  .ats-donut-wrap { margin: 0 auto; }
  .ats-checklist { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
