/* ============================================================
   CVCORE — builder.css
   Builder wizard: step nav, form, live preview
   ============================================================ */

/* ─── BUILDER LAYOUT ─── */
.builder-page {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  padding-top: var(--nav-h);
}

.builder-body {
  display: grid;
  grid-template-columns: 260px 1fr 340px;
  flex: 1;
  min-height: calc(100svh - var(--nav-h));
}

/* ─── STEP SIDEBAR ─── */
.step-sidebar {
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
}

.step-nav-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 0.875rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
  border: 1px solid transparent;
}
.step-nav-item:hover { background: var(--surface2); }
.step-nav-item.active {
  background: var(--accent-dim);
  border-color: var(--accent-border);
}
.step-nav-item.completed .step-nav-dot { background: var(--accent); border-color: var(--accent); }
.step-nav-item.completed .step-nav-dot svg { display: block; }

.step-nav-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--border2);
  background: transparent;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-faint);
  transition: all var(--transition);
}
.step-nav-item.active .step-nav-dot {
  border-color: var(--accent);
  background: var(--accent);
  color: #09090B;
}
.step-nav-dot svg { display: none; width: 12px; height: 12px; color: #09090B; }

.step-nav-label {
  font-size: 0.855rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition);
}
.step-nav-item.active .step-nav-label { color: var(--accent); font-weight: 600; }
.step-nav-item.completed .step-nav-label { color: var(--text); }

.step-nav-connector {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin-left: calc(0.875rem + 12px);
}

/* ─── MAIN FORM AREA ─── */
.builder-form-area {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.step-header {
  padding: 2rem 2.5rem 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.5rem;
}

.step-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.step-count {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.step-title-main {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.step-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.step-content {
  padding: 2rem 2.5rem;
  flex: 1;
}

/* ─── FORM SECTIONS ─── */
.form-section {
  margin-bottom: 2.5rem;
}

.form-section:last-child { margin-bottom: 0; }

.form-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 1rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid var(--border);
}

/* ─── PHOTO UPLOAD ─── */
.photo-upload-area {
  width: 100px; height: 100px;
  border-radius: 50%;
  border: 2px dashed var(--border2);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  cursor: pointer;
  overflow: hidden;
  transition: all var(--transition);
  position: relative;
}
.photo-upload-area:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.photo-upload-area input {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
  width: 100%; height: 100%;
}
.photo-upload-area svg { color: var(--text-faint); }
.photo-upload-label {
  font-size: 0.68rem;
  color: var(--text-faint);
  text-align: center;
  line-height: 1.3;
}
.photo-upload-area img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}

/* ─── ENTRY CARDS (Experience, Education) ─── */
.entries-list {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  margin-bottom: 1.25rem;
}

.entry-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
}
.entry-card:hover { border-color: var(--border2); }

.entry-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  cursor: pointer;
  user-select: none;
}

.entry-card-info { flex: 1; min-width: 0; }

.entry-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entry-card-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.entry-card-actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.entry-card-chevron {
  transition: transform 0.25s ease;
  color: var(--text-faint);
}
.entry-card.open .entry-card-chevron { transform: rotate(180deg); }

.entry-card-body {
  display: none;
  padding: 1.25rem;
  padding-top: 0;
  border-top: 1px solid var(--border);
}
.entry-card.open .entry-card-body { display: block; }

/* ─── SKILLS PANEL ─── */
.skills-input-area {
  min-height: 80px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition);
  cursor: text;
}
.skills-input-area:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200,255,71,0.08);
}

.skill-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
}

.skill-tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  padding: 0;
  transition: color var(--transition);
}
.skill-tag-remove:hover { color: #f87171; }

.skill-inline-input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.875rem;
  min-width: 120px;
  flex: 1;
}
.skill-inline-input::placeholder { color: var(--text-faint); }

.suggestions-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 1rem;
}

.suggestions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
}

.suggestions-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.suggestions-search {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.suggestions-search input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.8rem 0.55rem 2.2rem;
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.85rem;
  width: 100%;
  transition: border-color var(--transition);
}
.suggestions-search input:focus {
  outline: none;
  border-color: var(--accent);
}
.suggestions-search svg {
  position: absolute;
  left: 1.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

.suggestions-list {
  max-height: 280px;
  overflow-y: auto;
  padding: 0.5rem;
}
.suggestions-list::-webkit-scrollbar { width: 4px; }
.suggestions-list::-webkit-scrollbar-track { background: transparent; }
.suggestions-list::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  font-size: 0.875rem;
  color: var(--text-muted);
}
.suggestion-item:hover {
  background: var(--surface2);
  color: var(--text);
}
.suggestion-item .add-icon {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: all var(--transition);
}
.suggestion-item:hover .add-icon {
  background: var(--accent);
  color: #09090B;
}

/* ─── RICH TEXT TOOLBAR ─── */
.richtext-toolbar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.richtext-btn {
  width: 28px; height: 28px;
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  transition: all var(--transition);
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--sans);
}
.richtext-btn:hover { background: var(--surface2); color: var(--text); }
.richtext-btn.active { background: var(--accent-dim); color: var(--accent); }

.richtext-divider {
  width: 1px; height: 16px;
  background: var(--border);
  margin: 0 0.25rem;
}

.richtext-area {
  background: var(--bg);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 0.75rem;
  min-height: 120px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.6;
  outline: none;
  transition: border-color var(--transition);
}
.richtext-area:focus { border-color: var(--accent); }
.richtext-area ul, .richtext-area ol { padding-left: 1.25rem; }

/* ─── ADDITIONAL SECTIONS GRID ─── */
.additional-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.875rem;
}

.additional-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.additional-card:hover {
  background: var(--surface2);
  border-color: var(--border2);
}
.additional-card.added {
  border-color: var(--accent-border);
  background: var(--accent-dim);
}

.additional-card-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--text-muted);
}
.additional-card.added .additional-card-icon {
  background: var(--accent);
  border-color: var(--accent);
  color: #09090B;
}

.additional-card-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}
.additional-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ─── STEP FOOTER NAV ─── */
.step-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  gap: 1rem;
}

.step-footer-left  { display: flex; align-items: center; gap: 0.75rem; }
.step-footer-right { display: flex; align-items: center; gap: 0.75rem; }

.step-progress-bar {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
  max-width: 200px;
}
.step-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 100px;
  transition: width 0.4s ease;
}

/* ─── PREVIEW PANEL ─── */
.preview-panel {
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.preview-panel-title {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.preview-zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.preview-viewport {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.25rem;
  background: #2a2a30;
  position: relative;
}

.preview-paper {
  background: #ffffff;
  width: 100%;
  max-width: 560px;
  min-height: 730px;
  border-radius: 2px;
  box-shadow: var(--shadow-lg);
  transform-origin: top center;
  overflow: hidden;
  position: relative;
}

/* ─── RESUME TEMPLATE: EXECUTIVE ─── */
.tmpl-executive .tmpl-header {
  background: #1a3fa0;
  padding: 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: center;
}
.tmpl-executive .tmpl-photo {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  border: 2px solid rgba(255,255,255,.3);
  flex-shrink: 0;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.6);
}
.tmpl-executive .tmpl-photo img { width: 100%; height: 100%; object-fit: cover; }
.tmpl-executive .tmpl-name {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
}
.tmpl-executive .tmpl-contact-row {
  display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 0.35rem;
}
.tmpl-executive .tmpl-contact-item {
  font-size: 0.62rem; color: rgba(255,255,255,.7);
  display: flex; align-items: center; gap: 0.3rem;
}
.tmpl-executive .tmpl-body {
  display: grid; grid-template-columns: 140px 1fr;
}
.tmpl-executive .tmpl-sidebar {
  background: #eef1f8;
  padding: 1rem 0.875rem;
}
.tmpl-executive .tmpl-main { padding: 1rem 1.1rem; }

.tmpl-section-title {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #1a3fa0;
  border-bottom: 1px solid #dde2ef;
  padding-bottom: 0.25rem;
  margin-bottom: 0.5rem;
  margin-top: 0.75rem;
}
.tmpl-executive .tmpl-sidebar .tmpl-section-title { color: #1a3fa0; border-color: #c8d0e0; }

.tmpl-text-line {
  height: 5px; border-radius: 2px; background: #e0e0e0; margin-bottom: 0.25rem;
}
.tmpl-text-line.accent { background: rgba(26,63,160,.12); }
.tmpl-text-line.short  { width: 60%; }
.tmpl-text-line.medium { width: 80%; }
.tmpl-text-line.full   { width: 100%; }

/* ─── RESPONSIVE ─── */
@media (max-width: 1100px) {
  .builder-body { grid-template-columns: 220px 1fr 300px; }
}

@media (max-width: 900px) {
  .builder-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .step-sidebar { display: none; }
  .preview-panel { display: none; }
  .step-header, .step-content { padding-left: 1.25rem; padding-right: 1.25rem; }
  .step-footer { padding-left: 1.25rem; padding-right: 1.25rem; }
  .additional-grid { grid-template-columns: 1fr; }
}
