/* ===== CSS VARIABLES & RESET ===== */
:root {
  --bg: #0a0a0f;
  --bg2: #111118;
  --bg3: #18181f;
  --border: #2a2a35;
  --border2: #3a3a48;
  --text: #e8e8f0;
  --text2: #a0a0b8;
  --text3: #606078;
  --accent: #6c63ff;
  --accent2: #a855f7;
  --accent3: #06d6a0;
  --danger: #ff4d6d;
  --warn: #ffa62b;
  --card: #14141c;
  --card2: #1e1e28;
  --radius: 12px;
  --radius2: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow2: 0 2px 12px rgba(0,0,0,0.3);
  --font-ui: 'DM Sans', sans-serif;
  --transition: all 0.2s ease;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body { font-family: var(--font-ui); background: var(--bg); color: var(--text); min-height: 100vh; overflow-x: hidden; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ===== HEADER ===== */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 56px; background: rgba(10,10,15,0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 20px; gap: 16px;
}
.logo { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 1.3rem; letter-spacing: -0.5px; }
.logo span { background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.header-tabs { display: flex; gap: 4px; margin-left: 24px; }
.header-tab {
  padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 0.85rem;
  font-weight: 500; color: var(--text2); transition: var(--transition); border: none;
  background: none; white-space: nowrap;
}
.header-tab:hover { color: var(--text); background: var(--bg3); }
.header-tab.active { color: var(--accent); background: rgba(108,99,255,0.12); }
.header-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius2); font-size: 0.82rem;
  font-weight: 600; cursor: pointer; transition: var(--transition); border: none;
  font-family: var(--font-ui); white-space: nowrap; letter-spacing: 0.2px;
}
.btn-ghost { background: var(--bg3); color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--border2); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #5a52e0; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(108,99,255,0.4); }
.btn-success { background: var(--accent3); color: #000; }
.btn-success:hover { background: #04b386; transform: translateY(-1px); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-icon { padding: 7px; }

/* ===== MAIN LAYOUT ===== */
.app { display: flex; height: 100vh; padding-top: 56px; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 340px; min-width: 340px; background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.sidebar-header {
  padding: 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar-title { font-size: 0.82rem; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 1px; }
.sidebar-body { flex: 1; overflow-y: auto; padding: 12px; }

/* ===== SECTIONS NAV ===== */
.sections-nav { display: flex; flex-direction: column; gap: 4px; }
.section-nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: var(--radius2); cursor: pointer; transition: var(--transition);
  border: 1px solid transparent; user-select: none;
}
.section-nav-item:hover { background: var(--bg3); border-color: var(--border); }
.section-nav-item.active { background: rgba(108,99,255,0.1); border-color: rgba(108,99,255,0.3); color: var(--accent); }
.section-nav-icon { font-size: 1rem; width: 28px; text-align: center; }
.section-nav-label { flex: 1; font-size: 0.85rem; font-weight: 500; }
.section-nav-badge {
  font-size: 0.7rem; padding: 2px 6px; border-radius: 20px;
  background: var(--bg3); color: var(--text3); font-weight: 600;
}
.section-drag-handle { color: var(--text3); font-size: 0.8rem; cursor: grab; padding: 2px; }
.section-drag-handle:active { cursor: grabbing; }

/* ===== FORM PANEL ===== */
.form-panel { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 0.78rem; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px; }
.form-control {
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius2);
  color: var(--text); font-family: var(--font-ui); font-size: 0.88rem; padding: 9px 12px;
  transition: var(--transition); width: 100%; outline: none;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108,99,255,0.15); }
.form-control::placeholder { color: var(--text3); }
textarea.form-control { resize: vertical; min-height: 80px; line-height: 1.5; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* ===== REPEATABLE ITEMS ===== */
.repeatable-list { display: flex; flex-direction: column; gap: 10px; }
.repeatable-item {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.repeatable-item-header {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  cursor: pointer; user-select: none; background: var(--card2);
  transition: var(--transition);
}
.repeatable-item-header:hover { background: var(--bg3); }
.item-title { flex: 1; font-size: 0.85rem; font-weight: 600; }
.item-subtitle { font-size: 0.75rem; color: var(--text2); }
.item-chevron { transition: transform 0.2s; color: var(--text3); font-size: 0.8rem; }
.item-chevron.open { transform: rotate(180deg); }
.repeatable-item-body { padding: 14px; border-top: 1px solid var(--border); display: none; }
.repeatable-item-body.open { display: block; }
.item-actions { display: flex; gap: 6px; align-items: center; }
.drag-handle { cursor: grab; color: var(--text3); font-size: 0.9rem; }

/* ===== SKILLS ===== */
.skills-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.skill-tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px;
  background: var(--bg3); border: 1px solid var(--border); border-radius: 20px;
  font-size: 0.8rem; font-weight: 500;
}
.skill-level { display: flex; gap: 2px; }
.skill-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--border2);
  cursor: pointer; transition: var(--transition);
}
.skill-dot.filled { background: var(--accent); }
.skill-remove { cursor: pointer; color: var(--text3); font-size: 0.7rem; }
.skill-remove:hover { color: var(--danger); }

/* ===== COLOR PICKER ===== */
.color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch {
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: var(--transition);
}
.color-swatch.selected { border-color: #fff; transform: scale(1.15); }
.color-swatch:hover { transform: scale(1.1); }

/* ===== MAIN CONTENT ===== */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ===== TOOLBAR ===== */
.toolbar {
  height: 48px; background: var(--bg2); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 16px; gap: 8px; flex-shrink: 0;
}
.toolbar-divider { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }
.zoom-ctrl { display: flex; align-items: center; gap: 6px; }
.zoom-val { font-size: 0.78rem; font-weight: 600; color: var(--text2); min-width: 38px; text-align: center; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23a0a0b8' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }

/* ===== CANVAS AREA ===== */
.canvas-area {
  flex: 1; overflow: auto; background: var(--bg);
  display: flex; justify-content: center; align-items: flex-start;
  padding: 32px 24px;
  background-image: radial-gradient(circle, var(--border) 1px, transparent 1px);
  background-size: 24px 24px;
  min-width: 0;
}
.resume-wrapper {
  transform-origin: top center;
  transition: transform 0.2s;
  box-shadow: 0 8px 64px rgba(0,0,0,0.6), 0 2px 16px rgba(0,0,0,0.4);
  border-radius: 2px;
  width: 794px;
  flex-shrink: 0;
}
.resume-paper {
  width: 794px; /* A4 at 96dpi = exactly 210mm */
  max-width: 794px;
  min-height: 1122px;
  background: #fff;
  color: #1a1a1a;
  position: relative;
  overflow: hidden; /* clip visual only - export uses visible override */
  box-sizing: border-box;
}
/* ALL resume children must stay in bounds */
.resume-paper > * {
  max-width: 794px;
  box-sizing: border-box;
  overflow: hidden;
}
.resume-paper [style] {
  max-width: 100% !important;
  min-width: 0 !important;
}

/* ===== RIGHT PANEL ===== */
.right-panel {
  width: 280px; min-width: 280px; background: var(--bg2);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.right-panel-tabs {
  display: flex; border-bottom: 1px solid var(--border);
}
.rpanel-tab {
  flex: 1; padding: 12px 8px; text-align: center; font-size: 0.78rem;
  font-weight: 600; color: var(--text2); cursor: pointer; border: none;
  background: none; transition: var(--transition);
}
.rpanel-tab:hover { color: var(--text); }
.rpanel-tab.active { color: var(--accent); border-bottom: 2px solid var(--accent); margin-bottom: -1px; }
.right-panel-body { flex: 1; overflow-y: auto; padding: 16px; }

/* ===== TEMPLATES GRID ===== */
.templates-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.template-card {
  border-radius: var(--radius2); overflow: hidden; cursor: pointer;
  border: 2px solid var(--border); transition: var(--transition);
  position: relative;
}
.template-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow2); }
.template-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108,99,255,0.3); }
.template-preview {
  height: 120px; position: relative; overflow: hidden;
}
.template-name {
  padding: 6px 8px; font-size: 0.72rem; font-weight: 600; background: var(--card2);
  color: var(--text2); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.template-badge {
  position: absolute; top: 4px; right: 4px; font-size: 0.6rem; font-weight: 700;
  padding: 2px 5px; border-radius: 4px; text-transform: uppercase;
}
.badge-pro { background: linear-gradient(135deg, #f59e0b, #d97706); color: #000; }
.badge-new { background: var(--accent3); color: #000; }

/* ===== SETTINGS PANEL ===== */
.settings-section { margin-bottom: 20px; }
.settings-section-title { font-size: 0.72rem; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
.font-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.font-option {
  padding: 8px 10px; border-radius: var(--radius2); border: 1px solid var(--border);
  cursor: pointer; transition: var(--transition); background: var(--card);
  font-size: 0.82rem; text-align: center;
}
.font-option:hover { border-color: var(--border2); background: var(--card2); }
.font-option.selected { border-color: var(--accent); background: rgba(108,99,255,0.1); color: var(--accent); }
.slider-group { display: flex; align-items: center; gap: 10px; }
.slider { -webkit-appearance: none; width: 100%; height: 4px; border-radius: 2px; background: var(--border); outline: none; }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; }
.slider-val { font-size: 0.78rem; color: var(--text2); min-width: 36px; text-align: right; }
.toggle { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; }
.toggle-label { font-size: 0.82rem; color: var(--text2); }
.switch { position: relative; width: 36px; height: 20px; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; inset: 0; background: var(--border2); border-radius: 20px;
  transition: var(--transition);
}
.switch-slider::before {
  content: ''; position: absolute; height: 14px; width: 14px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: var(--transition);
}
input:checked + .switch-slider { background: var(--accent); }
input:checked + .switch-slider::before { transform: translateX(16px); }

/* ===== PHOTO UPLOAD ===== */
.photo-upload {
  width: 100%; height: 100px; border: 2px dashed var(--border);
  border-radius: var(--radius); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  transition: var(--transition); background: var(--bg3);
}
.photo-upload:hover { border-color: var(--accent); background: rgba(108,99,255,0.05); }
.photo-preview { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; }

/* ===== TABS VIEW ===== */
.view-tabs { display: none; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--card); border: 1px solid var(--border2); border-radius: 16px;
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  transform: scale(0.95); transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close { margin-left: auto; cursor: pointer; color: var(--text3); font-size: 1.2rem; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ===== NOTIFICATION ===== */
.notification {
  position: fixed; bottom: 24px; right: 24px; z-index: 2000;
  background: var(--card); border: 1px solid var(--border2); border-radius: var(--radius);
  padding: 12px 16px; display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow); transform: translateY(80px); opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 320px;
}
.notification.show { transform: translateY(0); opacity: 1; }
.notification-icon { font-size: 1.1rem; }
.notification-text { font-size: 0.84rem; font-weight: 500; }

/* ===== PROGRESS ===== */
.progress-bar-wrap { background: var(--border); border-radius: 4px; height: 6px; }
.progress-bar-fill { height: 6px; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width 0.3s; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 32px 16px; color: var(--text3); }
.empty-state-icon { font-size: 2rem; margin-bottom: 8px; }
.empty-state-text { font-size: 0.85rem; }

/* ===== LOADING ===== */
.loading-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 3000;
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 16px;
}
.spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== ATS SCORE ===== */
.ats-score-ring { width: 80px; height: 80px; margin: 0 auto 12px; position: relative; }
.ats-score-ring svg { transform: rotate(-90deg); }
.ats-score-number { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; font-weight: 700; }
.ats-tip { display: flex; align-items: flex-start; gap: 8px; padding: 8px; background: var(--bg3); border-radius: var(--radius2); margin-bottom: 6px; }
.ats-tip-icon { font-size: 0.9rem; flex-shrink: 0; margin-top: 1px; }
.ats-tip-text { font-size: 0.78rem; color: var(--text2); line-height: 1.4; }

/* ===== EXPORT DROPDOWN ===== */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 4px); background: var(--card);
  border: 1px solid var(--border2); border-radius: var(--radius); padding: 6px;
  min-width: 180px; box-shadow: var(--shadow); z-index: 200;
  display: none;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: var(--radius2); cursor: pointer; transition: var(--transition);
  font-size: 0.85rem; font-weight: 500; color: var(--text2);
}
.dropdown-item:hover { background: var(--bg3); color: var(--text); }
.dropdown-item-icon { font-size: 1rem; width: 20px; text-align: center; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) { .right-panel { display: none; } }
@media (max-width: 900px) { .sidebar { width: 280px; min-width: 280px; } }

/* ============================================================
   RESUME TEMPLATES - All 50+ templates
   ============================================================ */

/* ----- TEMPLATE 1: Classic Professional ----- */
.tpl-classic .resume-header { background: #1a237e; color: #fff; padding: 32px 36px; }
.tpl-classic .resume-name { font-family: 'Playfair Display'; font-size: 2.2rem; font-weight: 700; margin-bottom: 4px; }
.tpl-classic .resume-title { font-size: 1rem; opacity: 0.85; letter-spacing: 1px; margin-bottom: 12px; }
.tpl-classic .resume-contact { display: flex; flex-wrap: wrap; gap: 16px; font-size: 0.8rem; opacity: 0.9; }
.tpl-classic .resume-body { display: grid; grid-template-columns: 1fr 2fr; gap: 0; }
.tpl-classic .sidebar-col { background: #f0f4ff; padding: 24px 24px; }
.tpl-classic .main-col { padding: 24px 32px; }
.tpl-classic .section-title { font-family: 'Playfair Display'; font-size: 1rem; font-weight: 700; color: #1a237e; border-bottom: 2px solid #1a237e; padding-bottom: 4px; margin-bottom: 12px; text-transform: uppercase; letter-spacing: 1px; }
.tpl-classic .section-title-sidebar { font-family: 'Playfair Display'; font-size: 0.85rem; font-weight: 700; color: #1a237e; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
.tpl-classic .skill-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 0.8rem; }
.tpl-classic .skill-bar-fill { height: 4px; border-radius: 2px; background: #1a237e; }
.tpl-classic .skill-bar-bg { flex: 1; height: 4px; background: #dde4ff; border-radius: 2px; }
.tpl-classic .exp-item { margin-bottom: 16px; }
.tpl-classic .exp-title { font-weight: 700; font-size: 0.95rem; color: #1a1a2e; }
.tpl-classic .exp-company { color: #1a237e; font-size: 0.85rem; font-weight: 600; }
.tpl-classic .exp-date { color: #666; font-size: 0.78rem; margin-bottom: 6px; }
.tpl-classic .exp-desc { font-size: 0.82rem; color: #444; line-height: 1.6; }

/* ----- TEMPLATE 2: Modern Minimal ----- */
.tpl-modern .resume-header { padding: 36px 40px 28px; border-bottom: 3px solid #000; }
.tpl-modern .resume-name { font-family: 'DM Sans'; font-size: 2.4rem; font-weight: 700; letter-spacing: -1px; }
.tpl-modern .resume-title { font-size: 1rem; color: #555; margin: 4px 0 12px; }
.tpl-modern .resume-contact { display: flex; gap: 20px; flex-wrap: wrap; font-size: 0.8rem; color: #555; }
.tpl-modern .resume-body { padding: 28px 40px; display: grid; grid-template-columns: 1fr 2.2fr; gap: 32px; }
.tpl-modern .section-title { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 2px; color: #000; margin-bottom: 10px; }
.tpl-modern .exp-item { margin-bottom: 14px; }
.tpl-modern .exp-title { font-weight: 700; font-size: 0.9rem; }
.tpl-modern .exp-company { font-size: 0.82rem; color: #555; }
.tpl-modern .exp-date { font-size: 0.75rem; color: #999; margin-bottom: 4px; }
.tpl-modern .exp-desc { font-size: 0.8rem; color: #444; line-height: 1.55; }
.tpl-modern .skill-pill { display: inline-block; padding: 3px 10px; background: #f0f0f0; border-radius: 20px; font-size: 0.75rem; margin: 2px; }

/* ----- TEMPLATE 3: Creative ----- */
.tpl-creative { font-family: 'Nunito', sans-serif; }
.tpl-creative .resume-header { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; padding: 36px; display: flex; gap: 24px; align-items: center; }
.tpl-creative .header-photo { width: 80px; height: 80px; border-radius: 50%; border: 3px solid rgba(255,255,255,0.5); object-fit: cover; background: rgba(255,255,255,0.2); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 2rem; }
.tpl-creative .resume-name { font-size: 2rem; font-weight: 800; margin-bottom: 4px; }
.tpl-creative .resume-title { opacity: 0.9; margin-bottom: 10px; }
.tpl-creative .resume-contact { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.78rem; opacity: 0.9; }
.tpl-creative .resume-body { display: grid; grid-template-columns: 280px 1fr; gap: 0; min-height: 700px; }
.tpl-creative .sidebar-col { background: #f8f4ff; padding: 24px; }
.tpl-creative .main-col { padding: 24px 32px; }
.tpl-creative .section-title { font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px; color: #764ba2; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.tpl-creative .section-title::after { content: ''; flex: 1; height: 2px; background: linear-gradient(90deg, #764ba2, transparent); }
.tpl-creative .skill-bar-container { margin-bottom: 8px; }
.tpl-creative .skill-bar-label { display: flex; justify-content: space-between; font-size: 0.78rem; margin-bottom: 3px; }
.tpl-creative .skill-bar-track { height: 6px; background: #e0d4f7; border-radius: 3px; }
.tpl-creative .skill-bar-fill { height: 6px; background: linear-gradient(90deg, #667eea, #764ba2); border-radius: 3px; }

/* ----- TEMPLATE 4: Executive ----- */
.tpl-executive { font-family: 'Cormorant Garamond', serif; }
.tpl-executive .resume-header { background: #0f1923; color: #f0e6d3; padding: 40px 48px; }
.tpl-executive .resume-name { font-size: 2.8rem; font-weight: 300; letter-spacing: 4px; text-transform: uppercase; margin-bottom: 6px; }
.tpl-executive .resume-title { font-style: italic; font-size: 1.1rem; opacity: 0.75; margin-bottom: 16px; }
.tpl-executive .divider-gold { height: 1px; background: linear-gradient(90deg, transparent, #c9a84c, transparent); margin: 16px 0; }
.tpl-executive .resume-contact { display: flex; gap: 24px; justify-content: center; font-size: 0.8rem; opacity: 0.75; }
.tpl-executive .resume-body { padding: 36px 48px; }
.tpl-executive .section-title { font-size: 1.1rem; font-weight: 600; letter-spacing: 3px; text-transform: uppercase; color: #0f1923; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid #c9a84c; }
.tpl-executive .exp-item { margin-bottom: 20px; border-left: 2px solid #c9a84c; padding-left: 16px; }
.tpl-executive .exp-title { font-size: 1rem; font-weight: 600; }
.tpl-executive .exp-company { color: #555; font-style: italic; font-size: 0.9rem; }
.tpl-executive .exp-date { color: #c9a84c; font-size: 0.8rem; margin-bottom: 6px; }
.tpl-executive .exp-desc { font-size: 0.85rem; color: #555; line-height: 1.7; }

/* ----- TEMPLATE 5: Tech/Developer ----- */
.tpl-tech { font-family: 'IBM Plex Sans', sans-serif; }
.tpl-tech .resume-header { background: #0d1117; color: #e6edf3; padding: 28px 32px; display: flex; align-items: flex-start; gap: 24px; }
.tpl-tech .header-info { flex: 1; }
.tpl-tech .resume-name { font-size: 1.8rem; font-weight: 700; color: #58a6ff; margin-bottom: 4px; }
.tpl-tech .resume-title { font-size: 0.9rem; color: #8b949e; margin-bottom: 12px; }
.tpl-tech .resume-contact { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.75rem; color: #8b949e; }
.tpl-tech .contact-item { display: flex; align-items: center; gap: 4px; }
.tpl-tech .status-badge { padding: 4px 12px; background: #1f6feb; color: #fff; border-radius: 20px; font-size: 0.72rem; font-weight: 600; }
.tpl-tech .resume-body { display: grid; grid-template-columns: 240px 1fr; gap: 0; }
.tpl-tech .sidebar-col { background: #161b22; padding: 20px; border-right: 1px solid #30363d; }
.tpl-tech .main-col { padding: 20px 28px; }
.tpl-tech .section-title { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: #58a6ff; border-bottom: 1px solid #30363d; padding-bottom: 6px; margin-bottom: 10px; }
.tpl-tech .tech-tag { display: inline-block; padding: 2px 8px; background: #1f3a5f; color: #58a6ff; border: 1px solid #1f6feb; border-radius: 4px; font-size: 0.72rem; font-family: 'Space Mono', monospace; margin: 2px; }
.tpl-tech .exp-title { font-weight: 600; font-size: 0.88rem; color: #e6edf3; }
.tpl-tech .exp-company { color: #58a6ff; font-size: 0.8rem; }
.tpl-tech .exp-date { color: #8b949e; font-size: 0.75rem; font-family: 'Space Mono'; margin-bottom: 4px; }
.tpl-tech .exp-desc { font-size: 0.8rem; color: #8b949e; line-height: 1.6; }
.tpl-tech .commit-dot { width: 8px; height: 8px; border-radius: 50%; background: #238636; display: inline-block; margin-right: 4px; }

/* ----- TEMPLATE 6: Elegant Two-Column ----- */
.tpl-elegant .resume-paper { display: flex; flex-direction: column; }
.tpl-elegant .resume-header { display: grid; grid-template-columns: 200px 1fr; }
.tpl-elegant .header-accent { background: #2c3e50; min-height: 120px; }
.tpl-elegant .header-main { background: #ecf0f1; padding: 24px 32px; display: flex; flex-direction: column; justify-content: center; }
.tpl-elegant .resume-name { font-family: 'Playfair Display'; font-size: 2rem; font-weight: 700; color: #2c3e50; }
.tpl-elegant .resume-title { color: #7f8c8d; font-size: 0.9rem; margin-bottom: 8px; }
.tpl-elegant .resume-contact { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.78rem; color: #555; }
.tpl-elegant .resume-body { display: grid; grid-template-columns: 200px 1fr; flex: 1; }
.tpl-elegant .sidebar-col { background: #2c3e50; color: #ecf0f1; padding: 24px 20px; }
.tpl-elegant .main-col { padding: 24px 32px; }
.tpl-elegant .section-title-sidebar { font-size: 0.72rem; letter-spacing: 2px; text-transform: uppercase; color: #95a5a6; margin-bottom: 10px; }
.tpl-elegant .section-title { font-family: 'Playfair Display'; font-size: 1rem; color: #2c3e50; border-bottom: 2px solid #e74c3c; padding-bottom: 4px; margin-bottom: 12px; }
.tpl-elegant .sidebar-skill { font-size: 0.78rem; color: #bdc3c7; margin-bottom: 6px; }
.tpl-elegant .sidebar-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #e74c3c; margin-right: 6px; }

/* ----- TEMPLATE 7: Minimalist White ----- */
.tpl-minimalist .resume-header { padding: 48px; border-bottom: 1px solid #e5e5e5; }
.tpl-minimalist .resume-name { font-family: 'Cormorant Garamond'; font-size: 3rem; font-weight: 300; letter-spacing: -1px; color: #111; }
.tpl-minimalist .resume-title { font-size: 0.9rem; color: #777; margin: 6px 0 16px; letter-spacing: 2px; text-transform: uppercase; }
.tpl-minimalist .resume-contact { display: flex; gap: 24px; font-size: 0.78rem; color: #777; }
.tpl-minimalist .resume-body { padding: 36px 48px; }
.tpl-minimalist .section-title { font-family: 'Cormorant Garamond'; font-size: 1.3rem; font-weight: 300; color: #111; border-left: 3px solid #111; padding-left: 12px; margin-bottom: 16px; letter-spacing: 1px; }
.tpl-minimalist .exp-item { margin-bottom: 20px; }
.tpl-minimalist .exp-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 2px; }
.tpl-minimalist .exp-title { font-weight: 600; font-size: 0.9rem; }
.tpl-minimalist .exp-date { font-size: 0.75rem; color: #999; }
.tpl-minimalist .exp-company { color: #555; font-size: 0.82rem; margin-bottom: 4px; }
.tpl-minimalist .exp-desc { font-size: 0.8rem; color: #555; line-height: 1.6; }
.tpl-minimalist .skills-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tpl-minimalist .skill-tag-min { font-size: 0.78rem; color: #555; border-bottom: 1px solid #ccc; padding-bottom: 2px; }

/* ----- TEMPLATE 8: Bold Splash ----- */
.tpl-bold .resume-header { background: #ff3c38; padding: 36px; }
.tpl-bold .resume-name { font-family: 'Syne'; font-size: 2.8rem; font-weight: 800; color: #fff; letter-spacing: -2px; line-height: 1; margin-bottom: 8px; }
.tpl-bold .resume-title { font-size: 0.95rem; color: rgba(255,255,255,0.8); letter-spacing: 2px; text-transform: uppercase; margin-bottom: 16px; }
.tpl-bold .resume-contact { display: flex; flex-wrap: wrap; gap: 16px; font-size: 0.8rem; color: rgba(255,255,255,0.85); }
.tpl-bold .resume-body { padding: 32px 36px; display: grid; grid-template-columns: 1fr 1.8fr; gap: 32px; }
.tpl-bold .section-title { font-family: 'Syne'; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 2px; color: #ff3c38; margin-bottom: 12px; }
.tpl-bold .exp-item { margin-bottom: 14px; padding-left: 12px; border-left: 3px solid #ff3c38; }
.tpl-bold .exp-title { font-weight: 700; font-size: 0.88rem; }
.tpl-bold .exp-company { color: #666; font-size: 0.8rem; }
.tpl-bold .exp-date { color: #ff3c38; font-size: 0.75rem; margin-bottom: 4px; }
.tpl-bold .exp-desc { font-size: 0.8rem; color: #555; line-height: 1.55; }

/* ----- TEMPLATE 9: Navy Corporate ----- */
.tpl-navy .resume-header { background: #003366; color: #fff; padding: 32px 40px; display: flex; justify-content: space-between; align-items: flex-end; }
.tpl-navy .resume-name { font-family: 'DM Serif Display'; font-size: 2.2rem; font-weight: 400; margin-bottom: 4px; }
.tpl-navy .resume-title { font-size: 0.9rem; opacity: 0.8; }
.tpl-navy .contact-block { text-align: right; font-size: 0.78rem; opacity: 0.85; line-height: 1.8; }
.tpl-navy .resume-body { padding: 28px 40px; }
.tpl-navy .section-title { font-family: 'DM Serif Display'; font-size: 1.1rem; color: #003366; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 2px solid #003366; }
.tpl-navy .exp-item { display: grid; grid-template-columns: 120px 1fr; gap: 16px; margin-bottom: 14px; }
.tpl-navy .exp-date-col { text-align: right; font-size: 0.75rem; color: #003366; font-weight: 600; padding-top: 2px; }
.tpl-navy .exp-title { font-weight: 700; font-size: 0.9rem; color: #1a1a1a; }
.tpl-navy .exp-company { color: #003366; font-size: 0.82rem; margin-bottom: 4px; }
.tpl-navy .exp-desc { font-size: 0.8rem; color: #555; line-height: 1.6; }

/* ----- TEMPLATE 10: Artistic ----- */
.tpl-artistic { font-family: 'Josefin Sans', sans-serif; }
.tpl-artistic .resume-header { padding: 0; display: grid; grid-template-columns: 220px 1fr; min-height: 160px; }
.tpl-artistic .header-graphic { background: repeating-linear-gradient(45deg, #f6d365, #f6d365 10px, #fda085 10px, #fda085 20px); }
.tpl-artistic .header-text { background: #ffecd2; padding: 28px 32px; display: flex; flex-direction: column; justify-content: center; }
.tpl-artistic .resume-name { font-size: 2rem; font-weight: 700; color: #2d1b00; letter-spacing: -0.5px; }
.tpl-artistic .resume-title { font-size: 0.85rem; color: #8b5e00; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 10px; }
.tpl-artistic .resume-contact { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.75rem; color: #8b5e00; }
.tpl-artistic .resume-body { padding: 28px 32px; display: grid; grid-template-columns: 220px 1fr; gap: 24px; }
.tpl-artistic .section-title { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 2px; color: #fda085; border-bottom: 2px solid #fda085; padding-bottom: 4px; margin-bottom: 10px; }

/* ----- TEMPLATE 11-50: Generate via JS helpers ----- */
/* Additional template base styles */
.tpl-clean .resume-header { padding: 36px 44px; display: flex; gap: 20px; align-items: flex-start; }
.tpl-clean .resume-name { font-family: 'DM Sans'; font-size: 2rem; font-weight: 700; }
.tpl-clean .resume-title { color: #555; font-size: 0.88rem; margin: 4px 0 10px; }
.tpl-clean .resume-contact { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.78rem; color: #666; }
.tpl-clean .resume-body { padding: 28px 44px; display: grid; grid-template-columns: 1fr 2fr; gap: 32px; }
.tpl-clean .section-title { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: #333; border-bottom: 2px solid #4f46e5; padding-bottom: 4px; margin-bottom: 10px; }

.tpl-impact .resume-header { background: #111; color: #fff; padding: 32px; }
.tpl-impact .resume-name { font-family: 'Syne'; font-size: 2.5rem; font-weight: 800; background: linear-gradient(135deg, #fff, #aaa); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.tpl-impact .resume-title { color: #aaa; margin: 4px 0 12px; font-size: 0.9rem; }
.tpl-impact .resume-contact { display: flex; flex-wrap: wrap; gap: 16px; font-size: 0.78rem; color: #888; }
.tpl-impact .resume-body { padding: 28px 32px; display: grid; grid-template-columns: 240px 1fr; gap: 28px; }
.tpl-impact .sidebar-col { background: #f5f5f5; padding: 20px; border-radius: 8px; }
.tpl-impact .section-title { font-family: 'Syne'; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 2px; color: #111; border-left: 3px solid #111; padding-left: 8px; margin-bottom: 10px; }

/* Resume section containers */
.resume-section { margin-bottom: 20px; }
.resume-section:last-child { margin-bottom: 0; }

/* Universal exp/edu item styles per template context */
.exp-bullets { list-style: none; padding: 0; margin: 4px 0 0; }
.exp-bullets li { position: relative; padding-left: 14px; font-size: 0.8rem; color: #555; line-height: 1.6; margin-bottom: 2px; }
.exp-bullets li::before { content: '▸'; position: absolute; left: 0; color: #888; }

.edu-item { margin-bottom: 12px; }
.edu-degree { font-weight: 700; font-size: 0.88rem; }
.edu-school { font-size: 0.82rem; color: #555; }
.edu-date { font-size: 0.75rem; color: #888; }

.lang-item { margin-bottom: 6px; font-size: 0.8rem; }
.cert-item { margin-bottom: 8px; font-size: 0.8rem; }
.cert-name { font-weight: 600; }
.cert-issuer { color: #777; font-size: 0.75rem; }

.projects-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.project-card { padding: 10px; border: 1px solid #e5e5e5; border-radius: 6px; }
.project-name { font-weight: 700; font-size: 0.82rem; margin-bottom: 4px; }
.project-desc { font-size: 0.75rem; color: #666; line-height: 1.5; }
.project-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.project-tag { font-size: 0.68rem; padding: 2px 6px; background: #f0f0f0; border-radius: 3px; color: #555; }

/* References */
.ref-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ref-item { padding: 10px; background: #f8f8f8; border-radius: 6px; font-size: 0.78rem; }
.ref-name { font-weight: 700; margin-bottom: 2px; }
.ref-title { color: #666; margin-bottom: 2px; }
.ref-contact { color: #999; }

/* Awards */
.award-item { margin-bottom: 8px; }
.award-name { font-weight: 700; font-size: 0.82rem; }
.award-org { font-size: 0.75rem; color: #666; }

/* Hobbies */
.hobbies-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.hobby-tag { padding: 4px 10px; background: #f0f0f0; border-radius: 20px; font-size: 0.75rem; color: #555; }

/* Summary */
.summary-text { font-size: 0.85rem; color: #444; line-height: 1.7; }

/* ===== PDF EXPORT FIX: prevent content clipping ===== */
.resume-paper {
  width: 794px;
  max-width: 794px;
  overflow: visible !important;
  box-sizing: border-box;
}
.resume-paper * {
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: break-word;
  box-sizing: border-box;
}
/* All inner grids must be constrained */
.resume-paper > div {
  max-width: 794px;
  overflow: visible;
}

/* print styles */
@media print {
  body { background: #fff !important; }
  .header, .sidebar, .toolbar, .right-panel { display: none !important; }
  .app { display: block !important; padding: 0 !important; }
  .main { overflow: visible !important; }
  .canvas-area { padding: 0 !important; background: #fff !important; }
  .resume-wrapper { box-shadow: none !important; transform: none !important; }
  .resume-paper { width: 210mm !important; overflow: visible !important; }
}