/* ─── Builder Layout ─────────────────────────────────────── */
:root { --sidebar-w: 210px; --preview-w: 440px; --toolbar-h: 60px; }

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: #f1f5f9; color: #1e293b; overflow: hidden; height: 100vh; }

/* ─── Toolbar ─────────────────────────────────────────────── */
.toolbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--toolbar-h);
  background: #0f2444; display: flex; align-items: center; padding: 0 16px;
  gap: 12px; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.toolbar-logo { display: flex; align-items: center; gap: 8px; color: white; font-weight: 800; font-size: 1rem; margin-right: 8px; text-decoration: none; }
.toolbar-logo i { color: #d4af37; }
.toolbar-logo span span { color: #d4af37; }
.toolbar-sep { width: 1px; height: 30px; background: rgba(255,255,255,.15); }

.cv-title-input {
  background: rgba(255,255,255,.1); border: 1.5px solid rgba(255,255,255,.2);
  border-radius: 6px; color: white; padding: 6px 12px; font-size: .88rem;
  font-weight: 600; width: 200px; font-family: inherit;
}
.cv-title-input:focus { outline: none; border-color: #d4af37; background: rgba(255,255,255,.15); }
.cv-title-input::placeholder { color: rgba(255,255,255,.4); }

.template-select {
  background: rgba(255,255,255,.1); border: 1.5px solid rgba(255,255,255,.2);
  border-radius: 6px; color: white; padding: 6px 10px; font-size: .82rem;
  font-family: inherit; cursor: pointer; max-width: 180px;
}
.template-select:focus { outline: none; border-color: #d4af37; }
.template-select option { background: #0f2444; color: white; }

.lang-toggle { display: flex; border: 1.5px solid rgba(255,255,255,.2); border-radius: 6px; overflow: hidden; }
.lang-btn { padding: 5px 12px; font-size: .8rem; font-weight: 700; color: rgba(255,255,255,.6); cursor: pointer; transition: all .2s; background: none; border: none; font-family: inherit; }
.lang-btn.active { background: #d4af37; color: #0f2444; }

.toolbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.tb-btn {
  display: flex; align-items: center; gap: 6px; padding: 7px 14px;
  border-radius: 6px; font-size: .82rem; font-weight: 700; cursor: pointer;
  border: none; font-family: inherit; transition: all .2s;
}
.tb-btn-ghost { background: rgba(255,255,255,.1); color: rgba(255,255,255,.85); }
.tb-btn-ghost:hover { background: rgba(255,255,255,.2); color: white; }
.tb-btn-primary { background: #d4af37; color: #0f2444; }
.tb-btn-primary:hover { background: #b8960f; transform: translateY(-1px); }
.tb-btn-save { background: #10b981; color: white; }
.tb-btn-save:hover { background: #059669; }

/* ATS Score badge */
.ats-badge {
  display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,.08);
  border: 1.5px solid rgba(255,255,255,.2); border-radius: 20px;
  padding: 4px 12px; font-size: .78rem; color: white; white-space: nowrap;
}
.ats-circle { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .72rem; }
.ats-high   { background: #10b981; color: white; }
.ats-medium { background: #f59e0b; color: white; }
.ats-low    { background: #ef4444; color: white; }

/* Save status */
.save-status { font-size: .75rem; color: rgba(255,255,255,.5); }
.save-status.saved { color: #34d399; }
.save-status.saving { color: #fbbf24; }

/* ─── Main Layout ─────────────────────────────────────────── */
.builder-main {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr var(--preview-w);
  height: 100vh;
  padding-top: var(--toolbar-h);
}

/* ─── Section Sidebar ────────────────────────────────────── */
.section-nav {
  background: #1e2d40; overflow-y: auto; padding: 16px 0;
  display: flex; flex-direction: column; gap: 2px;
}
.section-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; cursor: pointer; transition: all .2s;
  font-size: .85rem; font-weight: 500; color: rgba(255,255,255,.6);
  border-left: 3px solid transparent;
}
.section-nav-item:hover { background: rgba(255,255,255,.06); color: rgba(255,255,255,.9); }
.section-nav-item.active { background: rgba(212,175,55,.12); color: #d4af37; border-left-color: #d4af37; }
.section-nav-item .section-icon { font-size: 1rem; width: 20px; text-align: center; }
.section-nav-divider { height: 1px; background: rgba(255,255,255,.08); margin: 8px 0; }
.section-completeness { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.15); }
.section-completeness.done { background: #10b981; }

/* ─── Form Area ──────────────────────────────────────────── */
.form-area {
  overflow-y: auto; padding: 28px 28px; background: #f1f5f9;
  display: flex; flex-direction: column;
}
.form-section-header { margin-bottom: 24px; }
.form-section-header h2 { font-size: 1.2rem; font-weight: 800; color: #0f2444; }
.form-section-header p { color: #64748b; font-size: .85rem; margin-top: 4px; }

.form-card { background: white; border-radius: 12px; padding: 22px; margin-bottom: 20px; border: 1px solid #e2e8f0; }
.form-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.form-card-header h3 { font-size: .95rem; font-weight: 700; color: #0f2444; display: flex; align-items: center; gap: 8px; }
.form-card-header .entry-num { background: #0f2444; color: white; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .72rem; }
.remove-btn { background: none; border: none; cursor: pointer; color: #94a3b8; padding: 4px 8px; border-radius: 6px; font-size: .8rem; display: flex; align-items: center; gap: 4px; }
.remove-btn:hover { background: #fef2f2; color: #ef4444; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: .8rem; font-weight: 600; color: #374151; margin-bottom: 5px; }
.form-control {
  width: 100%; padding: 9px 12px; border: 1.5px solid #e2e8f0;
  border-radius: 7px; font-size: .88rem; font-family: inherit; color: #1e293b;
  background: white; transition: border .2s;
}
.form-control:focus { outline: none; border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.form-control::placeholder { color: #9ca3af; }
textarea.form-control { resize: vertical; min-height: 90px; line-height: 1.5; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input { width: 15px; height: 15px; cursor: pointer; accent-color: #4f46e5; }
.form-check label { font-size: .85rem; color: #374151; cursor: pointer; margin: 0; }

.add-btn {
  display: flex; align-items: center; gap: 8px; padding: 10px 18px;
  background: white; border: 2px dashed #cbd5e1; border-radius: 10px;
  color: #64748b; cursor: pointer; font-size: .85rem; font-weight: 600;
  font-family: inherit; width: 100%; justify-content: center; transition: all .2s;
}
.add-btn:hover { border-color: #4f46e5; color: #4f46e5; background: #f5f3ff; }

/* Skills / Languages chips style */
.skill-row { display: flex; gap: 10px; align-items: flex-start; }
.skill-row .form-control { flex: 1; }
.level-select { width: 120px; flex-shrink: 0; }

/* ─── Preview Pane ────────────────────────────────────────── */
.preview-pane {
  background: #94a3b8; overflow-y: auto; display: flex;
  flex-direction: column; align-items: center; padding: 20px;
  gap: 20px; position: relative;
}
.preview-toolbar {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  background: #1e2d40; border-radius: 8px; padding: 8px 14px; flex-shrink: 0;
}
.preview-toolbar span { color: rgba(255,255,255,.7); font-size: .78rem; font-weight: 600; }
.preview-zoom { display: flex; gap: 4px; }
.zoom-btn { background: rgba(255,255,255,.1); border: none; color: rgba(255,255,255,.7); padding: 3px 10px; border-radius: 4px; cursor: pointer; font-size: .78rem; }
.zoom-btn:hover { background: rgba(255,255,255,.2); color: white; }

.cv-preview-frame {
  width: 100%; min-height: 842px; background: white; border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,.3); position: relative; overflow: hidden;
}
.cv-preview-content { width: 100%; min-height: 842px; }

.watermark-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: none; z-index: 10;
  background: repeating-linear-gradient(
    45deg,
    transparent, transparent 80px,
    rgba(15,36,68,.04) 80px, rgba(15,36,68,.04) 160px
  );
}
.watermark-text {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 40px; pointer-events: none;
}
.watermark-item {
  transform: rotate(-35deg); font-size: 1rem; font-weight: 700;
  color: rgba(15,36,68,.1); letter-spacing: 2px; text-transform: uppercase;
  white-space: nowrap;
}

/* ─── Upgrade Banner ─────────────────────────────────────── */
.upgrade-banner {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border-radius: 10px; padding: 16px 20px; color: white; text-align: center;
}
.upgrade-banner h4 { font-size: .95rem; margin-bottom: 6px; }
.upgrade-banner p { font-size: .8rem; opacity: .85; margin-bottom: 12px; }
.upgrade-banner a { background: white; color: #4f46e5; padding: 7px 20px; border-radius: 20px; font-weight: 700; font-size: .82rem; display: inline-block; }

/* ─── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.2); border-radius: 10px; }

/* ─── CV Template Styles (inside preview) ───────────────── */
.cv-wrap { width: 100%; min-height: 842px; }

/* Classic ATS */
.cv-classic {
  font-family: 'Georgia', 'Times New Roman', serif; font-size: 10.5pt;
  color: #111; background: white; padding: 28px 34px; min-height: 842px;
}
.cv-classic .cv-name { font-size: 20pt; font-weight: bold; text-transform: uppercase; letter-spacing: 3px; text-align: center; }
.cv-classic .cv-jobtitle { font-size: 11pt; color: #444; text-align: center; font-style: italic; margin-top: 2px; }
.cv-classic .cv-contact { text-align: center; font-size: 9pt; color: #333; margin-top: 6px; }
.cv-classic .cv-contact span { margin: 0 5px; }
.cv-classic .cv-divider { border: none; border-top: 2px solid #111; margin: 10px 0 12px; }
.cv-classic .cv-sec-divider { border: none; border-top: 1px solid #888; margin-bottom: 7px; }
.cv-classic h2 { font-size: 10pt; font-weight: bold; text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 3px; margin-top: 13px; }
.cv-classic p { font-size: 9.5pt; line-height: 1.45; }
.cv-classic .exp-item { margin-bottom: 10px; }
.cv-classic .exp-row { display: flex; justify-content: space-between; align-items: baseline; }
.cv-classic .exp-pos { font-weight: bold; font-size: 10pt; }
.cv-classic .exp-date { font-size: 9pt; color: #555; }
.cv-classic .exp-co { color: #555; font-size: 9.5pt; margin-top: 1px; }
.cv-classic .exp-desc { margin-top: 4px; font-size: 9.5pt; line-height: 1.4; }
.cv-classic .edu-item { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.cv-classic .edu-left strong { font-size: 10pt; }
.cv-classic .edu-left span { display: block; color: #555; font-size: 9.5pt; }
.cv-classic .skills-wrap { display: flex; flex-wrap: wrap; gap: 5px; }
.cv-classic .skill-pill { background: #f0f0f0; border: 1px solid #ddd; padding: 2px 8px; font-size: 8.5pt; border-radius: 2px; }
.cv-classic .lang-item { display: inline-block; margin-right: 18px; font-size: 9.5pt; }
.cv-classic .lang-lv { color: #666; }
.cv-classic .cert-item { font-size: 9.5pt; margin-bottom: 5px; }
.cv-classic .proj-item { margin-bottom: 8px; }
.cv-classic .proj-name { font-weight: bold; font-size: 10pt; }
.cv-classic .proj-tech { font-size: 8.5pt; color: #555; font-style: italic; }

/* Modern Professional */
.cv-modern {
  font-family: 'Arial', 'Helvetica', sans-serif; font-size: 9.5pt;
  color: #222; background: white; min-height: 842px;
}
.cv-modern .cv-top-bar { height: 8px; background: #1e3a5f; }
.cv-modern .cv-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 20px 28px 14px; border-bottom: 1px solid #e2e8f0; }
.cv-modern .cv-name { font-size: 18pt; font-weight: 900; color: #1e3a5f; }
.cv-modern .cv-title { font-size: 10.5pt; color: #4f46e5; font-weight: 600; margin-top: 2px; }
.cv-modern .cv-contact-r { text-align: right; font-size: 9pt; color: #555; line-height: 1.8; }
.cv-modern .cv-body { padding: 14px 28px; }
.cv-modern h2 { font-size: 10pt; font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px; color: #1e3a5f; border-bottom: 2px solid #4f46e5; padding-bottom: 4px; margin-top: 14px; margin-bottom: 8px; }
.cv-modern .sum-text { font-size: 9.5pt; line-height: 1.55; color: #333; }
.cv-modern .exp-item { margin-bottom: 10px; }
.cv-modern .exp-row { display: flex; justify-content: space-between; }
.cv-modern .exp-pos { font-weight: 700; font-size: 10pt; color: #1e3a5f; }
.cv-modern .exp-date { font-size: 8.5pt; color: #4f46e5; font-weight: 600; }
.cv-modern .exp-co { font-size: 9pt; color: #555; }
.cv-modern .exp-desc { font-size: 9pt; line-height: 1.45; margin-top: 3px; color: #333; }
.cv-modern .edu-item { display: flex; justify-content: space-between; margin-bottom: 8px; }
.cv-modern .edu-deg { font-weight: 700; font-size: 9.5pt; }
.cv-modern .edu-inst { font-size: 9pt; color: #555; }
.cv-modern .edu-date { font-size: 8.5pt; color: #4f46e5; }
.cv-modern .skills-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.cv-modern .skill-pill { background: #ede9fe; color: #4f46e5; padding: 3px 10px; font-size: 8.5pt; border-radius: 20px; font-weight: 600; }
.cv-modern .lang-row { display: flex; gap: 16px; flex-wrap: wrap; }
.cv-modern .lang-item { font-size: 9pt; }
.cv-modern .lang-lv { color: #555; }

/* Creative */
.cv-creative { font-family: 'Arial', sans-serif; font-size: 9.5pt; background: white; min-height: 842px; display: flex; }
.cv-creative .cv-sidebar { width: 38%; background: #1a5276; color: white; padding: 28px 22px; flex-shrink: 0; }
.cv-creative .cv-main-col { flex: 1; padding: 28px 24px; }
.cv-creative .cv-photo { width: 80px; height: 80px; border-radius: 50%; background: rgba(255,255,255,.2); border: 3px solid rgba(255,255,255,.4); margin: 0 auto 16px; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.5); font-size: 1.8rem; }
.cv-creative .cv-name { font-size: 16pt; font-weight: 900; text-align: center; color: white; }
.cv-creative .cv-title { font-size: 9pt; color: rgba(255,255,255,.75); text-align: center; margin: 4px 0 20px; }
.cv-creative .sb-section-title { font-size: 7.5pt; text-transform: uppercase; letter-spacing: 2px; color: rgba(255,255,255,.5); margin-bottom: 8px; margin-top: 18px; font-weight: 700; }
.cv-creative .sb-contact-item { display: flex; align-items: center; gap: 7px; font-size: 8.5pt; margin-bottom: 5px; color: rgba(255,255,255,.85); }
.cv-creative .sb-skill-item { margin-bottom: 7px; }
.cv-creative .sb-skill-name { font-size: 8.5pt; color: white; margin-bottom: 3px; }
.cv-creative .sb-skill-bar { height: 4px; background: rgba(255,255,255,.2); border-radius: 2px; }
.cv-creative .sb-skill-fill { height: 100%; background: rgba(255,255,255,.8); border-radius: 2px; }
.cv-creative .cv-main-name { font-size: 18pt; font-weight: 900; color: #1a5276; }
.cv-creative .cv-main-title { font-size: 10pt; color: #2e86c1; margin-bottom: 14px; }
.cv-creative h2 { font-size: 9.5pt; font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px; color: #1a5276; border-left: 4px solid #2e86c1; padding-left: 8px; margin-top: 16px; margin-bottom: 8px; }
.cv-creative .exp-item { margin-bottom: 10px; }
.cv-creative .exp-pos { font-weight: 700; font-size: 9.5pt; color: #1a5276; }
.cv-creative .exp-co { font-size: 8.5pt; color: #555; }
.cv-creative .exp-date { font-size: 8pt; color: #2e86c1; font-weight: 600; }
.cv-creative .exp-desc { font-size: 9pt; line-height: 1.45; color: #333; margin-top: 3px; }

/* Tech Minimal */
.cv-tech {
  font-family: 'Courier New', monospace; font-size: 9.5pt;
  color: #1e293b; background: white; padding: 30px 36px; min-height: 842px;
}
.cv-tech .cv-name { font-size: 18pt; font-weight: bold; color: #0f172a; letter-spacing: -0.5px; }
.cv-tech .cv-title { font-size: 10pt; color: #475569; margin: 2px 0 8px; font-family: Arial, sans-serif; }
.cv-tech .cv-contact { display: flex; gap: 16px; flex-wrap: wrap; font-size: 8.5pt; color: #64748b; }
.cv-tech .cv-contact a { color: #3b82f6; }
.cv-tech .cv-hr { border: none; border-top: 1px solid #e2e8f0; margin: 12px 0; }
.cv-tech h2 { font-size: 8pt; text-transform: uppercase; letter-spacing: 3px; color: #94a3b8; margin-bottom: 8px; margin-top: 14px; }
.cv-tech .sum-text { font-family: Arial, sans-serif; font-size: 9.5pt; line-height: 1.6; color: #334155; }
.cv-tech .exp-item { margin-bottom: 12px; border-left: 2px solid #e2e8f0; padding-left: 12px; }
.cv-tech .exp-pos { font-weight: bold; font-size: 10pt; color: #0f172a; }
.cv-tech .exp-co { font-family: Arial; font-size: 9pt; color: #3b82f6; }
.cv-tech .exp-date { font-size: 8.5pt; color: #94a3b8; }
.cv-tech .exp-desc { font-family: Arial; font-size: 9pt; line-height: 1.5; color: #475569; margin-top: 4px; }
.cv-tech .skills-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.cv-tech .skill-pill { background: #f1f5f9; border: 1px solid #e2e8f0; padding: 2px 8px; font-size: 8pt; border-radius: 4px; color: #334155; }
.cv-tech .edu-item { margin-bottom: 8px; font-family: Arial; }
.cv-tech .edu-deg { font-weight: bold; font-size: 9.5pt; }
.cv-tech .edu-inst { font-size: 9pt; color: #64748b; }
.cv-tech .edu-date { font-size: 8.5pt; color: #94a3b8; }
.cv-tech .lang-row { display: flex; gap: 16px; flex-wrap: wrap; font-family: Arial; }
.cv-tech .lang-item { font-size: 9pt; }
.cv-tech .lang-lv { color: #64748b; }
.cv-tech .cert-item { font-family: Arial; font-size: 9pt; margin-bottom: 5px; }

/* Executive */
.cv-exec { font-family: 'Arial', sans-serif; font-size: 9.5pt; color: #111; background: white; min-height: 842px; }
.cv-exec .cv-gold-top { height: 10px; background: linear-gradient(90deg, #b8860b, #d4af37, #b8860b); }
.cv-exec .cv-header { padding: 24px 32px 18px; background: #faf8f0; border-bottom: 1px solid #e8d89c; display: flex; justify-content: space-between; align-items: center; }
.cv-exec .cv-name { font-size: 20pt; font-weight: 900; color: #1a1a1a; letter-spacing: 1px; }
.cv-exec .cv-title { font-size: 10.5pt; color: #b8860b; font-weight: 600; margin-top: 3px; }
.cv-exec .cv-contact-r { text-align: right; font-size: 8.5pt; color: #555; line-height: 1.9; }
.cv-exec .cv-body { padding: 18px 32px; }
.cv-exec h2 { font-size: 9.5pt; font-weight: 800; text-transform: uppercase; letter-spacing: 2px; color: #b8860b; margin-top: 16px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.cv-exec h2::after { content: ''; flex: 1; height: 1px; background: #e8d89c; }
.cv-exec .exp-item { margin-bottom: 11px; }
.cv-exec .exp-row { display: flex; justify-content: space-between; }
.cv-exec .exp-pos { font-weight: 700; font-size: 10pt; color: #111; }
.cv-exec .exp-date { font-size: 8.5pt; color: #b8860b; font-weight: 600; }
.cv-exec .exp-co { font-size: 9pt; color: #555; }
.cv-exec .exp-desc { font-size: 9pt; line-height: 1.5; margin-top: 3px; color: #333; }
.cv-exec .bottom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.cv-exec .skills-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.cv-exec .skill-pill { border: 1px solid #e8d89c; background: #fffbeb; color: #78350f; padding: 2px 10px; font-size: 8.5pt; border-radius: 3px; }
.cv-exec .lang-item { display: flex; justify-content: space-between; font-size: 9pt; padding: 3px 0; border-bottom: 1px dotted #e8d89c; }
.cv-exec .lang-lv { color: #b8860b; font-weight: 600; }
.cv-exec .edu-item { margin-bottom: 8px; }
.cv-exec .edu-deg { font-weight: 700; font-size: 9.5pt; }
.cv-exec .edu-inst { font-size: 9pt; color: #555; }
.cv-exec .edu-date { font-size: 8.5pt; color: #b8860b; }

/* ─── Import CV Modal ────────────────────────────────────── */
.tb-btn-import { background: #0ea5e9; color: white; }
.tb-btn-import:hover { background: #0284c7; transform: translateY(-1px); }
.tb-btn-translate { background: #059669; color: white; }
.tb-btn-translate:hover { background: #047857; transform: translateY(-1px); }

.import-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 300; display: flex; align-items: center; justify-content: center;
}
.import-overlay.hidden { display: none; }

.import-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: min(560px, 95vw); background: white; border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,.25); z-index: 301;
  overflow: hidden; max-height: 90vh; overflow-y: auto;
}
.import-modal.hidden { display: none; }

.import-modal-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 20px 24px 16px; border-bottom: 1px solid #f1f5f9;
}
.import-close-btn { background: #f1f5f9; border: none; border-radius: 50%; width: 30px; height: 30px; cursor: pointer; font-size: 1.1rem; color: #64748b; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.import-close-btn:hover { background: #e2e8f0; color: #0f2444; }

.import-step { padding: 24px; }
.import-step.hidden { display: none; }

/* Drop zone */
.import-dropzone {
  border: 2.5px dashed #cbd5e1; border-radius: 14px; padding: 40px 24px;
  text-align: center; transition: all .2s; cursor: pointer; background: #f8fafc;
}
.import-dropzone.drag-over { border-color: #0ea5e9; background: #f0f9ff; }
.import-dz-icon { font-size: 3rem; margin-bottom: 12px; }
.import-dz-title { font-size: 1.1rem; font-weight: 800; color: #0f2444; margin-bottom: 6px; }
.import-dz-sub { font-size: .85rem; color: #64748b; margin-bottom: 20px; }
.import-browse-btn { display: inline-block; background: #0ea5e9; color: white; padding: 10px 24px; border-radius: 8px; font-size: .88rem; font-weight: 700; cursor: pointer; transition: background .2s; }
.import-browse-btn:hover { background: #0284c7; }
.import-formats { margin-top: 16px; display: flex; gap: 8px; justify-content: center; }
.fmt-badge { background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 4px; padding: 2px 8px; font-size: .72rem; font-weight: 700; color: #64748b; }
.import-note { margin-top: 14px; font-size: .78rem; color: #94a3b8; text-align: center; display: flex; align-items: center; justify-content: center; gap: 6px; }

/* Loading */
.import-loading-box { text-align: center; padding: 20px 0; }
.import-spinner { width: 44px; height: 44px; border: 4px solid #e2e8f0; border-top-color: #0ea5e9; border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 18px; }
.import-loading-title { font-size: 1.05rem; font-weight: 800; color: #0f2444; margin-bottom: 6px; }
.import-loading-sub { font-size: .85rem; color: #64748b; margin-bottom: 20px; }
.import-progress-bar { height: 6px; background: #f1f5f9; border-radius: 3px; overflow: hidden; }
.import-progress-fill { height: 100%; background: linear-gradient(90deg,#0ea5e9,#7c3aed); border-radius: 3px; transition: width .4s ease; width: 0%; }

/* Success */
.import-success-header { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.import-check { font-size: 2rem; }
.import-success-title { font-size: 1rem; font-weight: 800; color: #0f2444; }
.import-success-sub { font-size: .85rem; color: #64748b; margin-top: 2px; }
.import-summary-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 20px; }
.import-sum-item { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 8px; text-align: center; }
.import-sum-icon { display: block; font-size: 1.3rem; margin-bottom: 4px; }
.import-sum-val { display: block; font-size: 1.4rem; font-weight: 900; color: #0f2444; }
.import-sum-label { display: block; font-size: .7rem; color: #64748b; margin-top: 2px; }
.import-template-pick { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 14px 16px; margin-bottom: 18px; }
.import-actions { display: flex; gap: 10px; }
.import-apply-btn { flex: 1; background: #0f2444; color: white; border: none; border-radius: 9px; padding: 12px; font-size: .9rem; font-weight: 800; cursor: pointer; font-family: inherit; display: flex; align-items: center; justify-content: center; gap: 8px; }
.import-apply-btn:hover { background: #1e3a5f; }
.import-retry-btn { background: #f1f5f9; color: #374151; border: 1px solid #e2e8f0; border-radius: 9px; padding: 12px 16px; font-size: .85rem; font-weight: 700; cursor: pointer; font-family: inherit; display: flex; align-items: center; gap: 6px; }
.import-retry-btn:hover { background: #e2e8f0; }

/* Error */
.import-error-box { text-align: center; padding: 10px 0; }
.import-error-msg { background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; padding: 14px 18px; color: #dc2626; font-size: .88rem; line-height: 1.5; }

/* ─── AI Assistant ───────────────────────────────────────── */
.tb-btn-ai { background: linear-gradient(135deg,#7c3aed,#4f46e5); color:white; }
.tb-btn-ai:hover { background: linear-gradient(135deg,#6d28d9,#4338ca); transform:translateY(-1px); }

.ai-panel {
  position: fixed; top: var(--toolbar-h); right: 0;
  width: 360px; height: calc(100vh - var(--toolbar-h));
  background: white; border-left: 1.5px solid #e2e8f0;
  box-shadow: -6px 0 24px rgba(0,0,0,.15);
  display: flex; flex-direction: column; z-index: 200;
  transform: translateX(100%); transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.ai-panel.open { transform: translateX(0); }

.ai-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 199;
  transition: opacity .3s;
}
.ai-overlay.hidden { display:none; }

.ai-panel-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; background: linear-gradient(135deg,#7c3aed,#4f46e5);
  color: white; flex-shrink: 0;
}
.ai-panel-header strong { font-size: .95rem; }
.ai-beta-badge { background: rgba(255,255,255,.2); font-size: .65rem; font-weight: 700; padding: 2px 7px; border-radius: 20px; text-transform: uppercase; letter-spacing: 1px; }
.ai-close-btn { background: rgba(255,255,255,.15); border: none; color: white; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; font-size: 1.1rem; display: flex; align-items: center; justify-content: center; }
.ai-close-btn:hover { background: rgba(255,255,255,.3); }

.ai-panel-body { flex: 1; overflow-y: auto; min-height: 0; padding: 16px; display: flex; flex-direction: column; gap: 12px; }

.ai-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 40px 0; color: #64748b; font-size: .9rem; }
.ai-spinner { width: 28px; height: 28px; border: 3px solid #e2e8f0; border-top-color: #7c3aed; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.ai-suggestions-title { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #64748b; margin-bottom: 8px; }
.ai-suggestion { display: flex; gap: 10px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px 12px; }
.ai-num { background: #7c3aed; color: white; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 800; flex-shrink: 0; margin-top: 1px; }
.ai-suggestion p { font-size: .84rem; line-height: 1.5; color: #334155; margin: 0; }

.ai-improved-box { background: #f5f3ff; border: 1.5px solid #ddd6fe; border-radius: 10px; padding: 14px; margin-top: 4px; }
.ai-improved-label { font-size: .75rem; font-weight: 700; color: #7c3aed; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.ai-improved-text { font-size: .85rem; line-height: 1.6; color: #1e293b; white-space: pre-wrap; }
.ai-apply-btn { margin-top: 12px; width: 100%; background: #7c3aed; color: white; border: none; border-radius: 7px; padding: 9px; font-size: .84rem; font-weight: 700; cursor: pointer; font-family: inherit; }
.ai-apply-btn:hover { background: #6d28d9; }

.ai-error { color: #ef4444; font-size: .84rem; background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 12px; }

.ai-panel-footer { padding: 12px 16px; border-top: 1px solid #e2e8f0; flex-shrink: 0; background: #f8fafc; }
.ai-footer-label { font-size: .75rem; font-weight: 600; color: #64748b; margin-bottom: 6px; }
.ai-input-row { display: flex; gap: 8px; }
.ai-prompt-input { flex: 1; border: 1.5px solid #e2e8f0; border-radius: 8px; padding: 8px 10px; font-size: .83rem; font-family: inherit; resize: none; color: #1e293b; }
.ai-prompt-input:focus { outline: none; border-color: #7c3aed; }
.ai-ask-btn { background: #7c3aed; color: white; border: none; border-radius: 8px; padding: 0 14px; cursor: pointer; font-size: .82rem; font-weight: 700; font-family: inherit; flex-shrink: 0; }
.ai-ask-btn:hover { background: #6d28d9; }
.ai-hint { font-size: .72rem; color: #94a3b8; margin-top: 8px; }

/* Field-level AI buttons */
.field-with-ai { position: relative; }
.field-with-ai .form-control { padding-right: 40px; }
.ai-field-btn { position: absolute; right: 8px; top: 8px; background: none; border: none; cursor: pointer; font-size: 1rem; opacity: .5; transition: opacity .2s; padding: 2px; }
.ai-field-btn:hover { opacity: 1; }

/* ─── Photo Upload Widget ────────────────────────────────── */
.photo-upload-zone {
  display: flex; align-items: center; gap: 20px;
  padding-bottom: 20px; margin-bottom: 20px;
  border-bottom: 1.5px solid #f1f5f9;
}
.photo-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  background: #f1f5f9; border: 2.5px dashed #cbd5e1;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; cursor: pointer; flex-shrink: 0;
  transition: border-color .2s, background .2s;
}
.photo-avatar:hover { border-color: #4f46e5; background: #f5f3ff; }
.photo-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-avatar i { font-size: 2rem; color: #94a3b8; }
.photo-info-title { font-size: .88rem; font-weight: 700; color: #0f2444; margin-bottom: 3px; }
.photo-info-hint { font-size: .75rem; color: #94a3b8; margin-bottom: 10px; }
.photo-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-upload-btn {
  background: #0f2444; color: white; border: none;
  padding: 7px 14px; border-radius: 7px; cursor: pointer;
  font-size: .8rem; font-weight: 700; font-family: inherit;
  display: flex; align-items: center; gap: 6px; transition: background .2s;
}
.photo-upload-btn:hover { background: #1e3a5f; }
.photo-remove-btn {
  background: transparent; color: #ef4444;
  border: 1.5px solid #fecaca; padding: 7px 12px;
  border-radius: 7px; cursor: pointer; font-size: .78rem;
  font-weight: 600; font-family: inherit; display: flex;
  align-items: center; gap: 5px; transition: all .2s;
}
.photo-remove-btn:hover { background: #fef2f2; }

/* ─── Photo in CV Templates ──────────────────────────────── */
/* Classic ATS */
.cv-classic-photo-wrap {
  float: right; margin: 0 0 8px 16px;
}
.cv-classic-photo {
  width: 80px; height: 80px; border-radius: 4px;
  object-fit: cover; border: 1px solid #ccc;
  display: block;
}

/* Modern Professional */
.cv-modern-photo {
  width: 60px; height: 60px; border-radius: 50%;
  object-fit: cover; border: 2px solid #4f46e5;
  flex-shrink: 0;
}

/* Creative — inside .cv-photo circle */
.cv-creative .cv-photo { overflow: hidden; }
.cv-creative-photo { width: 100%; height: 100%; object-fit: cover; display: block; }
.cv-creative .cv-photo-icon { font-size: 1.8rem; }

/* Executive */
.cv-exec-photo {
  width: 68px; height: 68px; border-radius: 50%;
  object-fit: cover; border: 2px solid #d4af37;
  flex-shrink: 0;
}

/* ─── Responsive Builder ─────────────────────────────────── */
@media (max-width: 1100px) {
  :root { --preview-w: 360px; }
}
@media (max-width: 850px) {
  .builder-main { grid-template-columns: var(--sidebar-w) 1fr; }
  .preview-pane { display: none; }
  .mob-preview-btn { display: flex; }
}
@media (max-width: 768px) {
  .ats-badge, .save-status, .tb-btn-save { display: none; }
  .cv-title-input { width: 130px; }
  .template-select { max-width: 140px; }
}
@media (max-width: 600px) {
  .builder-main { grid-template-columns: 1fr; }
  .section-nav { display: none; }
  :root { --sidebar-w: 0px; }
  .cv-title-input { width: 110px; font-size: .8rem; }
  .template-select { max-width: 110px; font-size: .78rem; }
  .lang-toggle { display: none; }
  .tb-btn-import, .tb-btn-translate, .tb-btn-ghost { display: none; }
  .toolbar { gap: 6px; padding: 0 10px; }
  .toolbar-sep { display: none; }
}

/* Mobile preview toggle button */
.mob-preview-btn {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, #7c3aed, #4f46e5); color: white;
  border: none; border-radius: 24px; padding: 11px 24px;
  font-size: .88rem; font-weight: 700; font-family: inherit;
  cursor: pointer; z-index: 150; box-shadow: 0 4px 16px rgba(124,58,237,.4);
  align-items: center; gap: 8px; white-space: nowrap; display: none;
}
.mob-preview-btn:hover { box-shadow: 0 6px 20px rgba(124,58,237,.55); }

/* Mobile preview overlay mode */
@media (max-width: 850px) {
  .preview-pane.mob-show {
    display: flex !important;
    position: fixed; top: var(--toolbar-h); left: 0; right: 0; bottom: 0;
    z-index: 95; background: #1e2d40;
  }
}

/* ─── Print / PDF export ─────────────────────────────────── */
@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

  @page { margin: 0; size: A4 portrait; }

  body { height: auto !important; overflow: visible !important; background: white !important; }

  /* Hide all UI chrome */
  .toolbar,
  .section-nav,
  .form-area,
  .preview-toolbar,
  .preview-zoom,
  .upgrade-banner,
  .ai-panel,
  .ai-overlay,
  .import-modal,
  .import-overlay,
  .tb-btn,
  p[style*="marca de agua"] { display: none !important; }

  /* Reset layout so only the preview fills the page */
  .builder-main {
    display: block !important;
    padding-top: 0 !important;
    height: auto !important;
  }

  .preview-pane {
    display: block !important;
    padding: 0 !important;
    background: white !important;
    height: auto !important;
    overflow: visible !important;
    gap: 0 !important;
    width: 100% !important;
  }

  /* Remove the scale transform so the CV prints at true A4 size */
  .cv-preview-frame {
    transform: none !important;
    margin: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    width: 100% !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  .cv-preview-content {
    width: 100% !important;
    min-height: 0 !important;
  }

  /* Watermark stays visible during print for free plan users */
  .watermark-overlay {
    position: fixed !important;
  }
}

/* ─── QR Code en CV ──────────────────────────────────────── */
.cv-classic, .cv-modern, .cv-creative, .cv-tech, .cv-exec { position: relative; }
.cv-qr-corner { position: absolute; bottom: 14px; right: 14px; text-align: center; z-index: 10; }
.cv-qr-img { width: 62px; height: 62px; display: block; border: 1px solid #e2e8f0; border-radius: 4px; }
.cv-qr-lbl { font-size: 6.5pt; color: #94a3b8; margin-top: 3px; text-align: center; }
@media print { .cv-qr-img { border-color: #ccc; } }

/* ─── AI Tabs ────────────────────────────────────────────── */
.ai-tabs { display: flex; border-bottom: 1px solid #e2e8f0; background: #f8fafc; flex-shrink: 0; }
.ai-tab { flex: 1; padding: 10px 8px; font-size: .82rem; font-weight: 600; color: #64748b; background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; transition: all .2s; }
.ai-tab:hover { color: #0f2444; background: #f1f5f9; }
.ai-tab.active { color: #4f46e5; border-bottom-color: #4f46e5; background: white; }

/* AI tab panel containers — must stretch to fill remaining height for scroll to work */
#ai-assist-panel, #ai-scan-panel, #ai-cover-panel {
  display: flex; flex-direction: column; flex: 1; min-height: 0;
}

/* ─── Offer Scanner ──────────────────────────────────────── */
.ai-scan-intro { padding: 12px 16px 4px; color: #64748b; font-size: .83rem; }
.ai-offer-textarea { width: calc(100% - 32px); padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: .83rem; font-family: inherit; resize: vertical; margin: 8px 16px 0; background: #f8fafc; }
.ai-offer-textarea:focus { outline: none; border-color: #4f46e5; background: white; }
.ai-scan-btn { display: block; margin: 12px 16px; width: calc(100% - 32px); padding: 10px; background: linear-gradient(135deg, #4f46e5, #7c3aed); color: white; border: none; border-radius: 8px; font-weight: 700; font-size: .88rem; cursor: pointer; transition: opacity .2s; }
.ai-scan-btn:hover { opacity: .9; }
.scan-score-wrap { display: flex; align-items: center; gap: 14px; padding: 16px; background: #f8fafc; border-radius: 10px; margin: 8px 16px 12px; }
.scan-score-circle { width: 72px; height: 72px; border-radius: 50%; border: 3px solid; display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0; }
.scan-score-num { font-size: 1.3rem; font-weight: 800; line-height: 1; }
.scan-score-lbl { font-size: .62rem; color: #64748b; text-align: center; margin-top: 2px; }
.scan-summary { font-size: .83rem; color: #374151; line-height: 1.5; }
.scan-kw-block { padding: 0 16px 12px; }
.scan-kw-title { font-size: .8rem; font-weight: 700; color: #374151; margin-bottom: 7px; display: flex; align-items: center; gap: 6px; }
.scan-kw-list { display: flex; flex-wrap: wrap; gap: 6px; }
.scan-tag { padding: 3px 9px; border-radius: 20px; font-size: .75rem; font-weight: 600; }
.scan-tag.found { background: #dcfce7; color: #166534; }
.scan-tag.missing { background: #fee2e2; color: #991b1b; }
.scan-suggestions-block { padding: 0 16px 16px; }

/* ─── Cover Letter ───────────────────────────────────────── */
.cover-result-wrap { padding: 8px 16px 16px; }
.cover-result-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.cover-action-btn { flex: 1; padding: 7px 10px; border: 1.5px solid #e2e8f0; border-radius: 7px; background: white; color: #374151; font-size: .8rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; transition: all .2s; }
.cover-action-btn:hover { border-color: #4f46e5; color: #4f46e5; background: #eef2ff; }
.cover-letter-textarea { width: 100%; min-height: 320px; padding: 14px; border: 1.5px solid #e2e8f0; border-radius: 8px; font-size: .82rem; font-family: Georgia, serif; line-height: 1.7; color: #1e293b; resize: vertical; background: #fafafa; }
.cover-letter-textarea:focus { outline: none; border-color: #4f46e5; background: white; }
