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

:root {
  --bg: #f0f4f8;
  --surface: #ffffff;
  --surface2: #f8fafc;
  --border: #e2e8f0;
  --accent: #7c3aed;        /* violet — distinct from all other products */
  --accent2: #6d28d9;
  --accent-light: #f5f3ff;
  --success: #059669;
  --text: #1e293b;
  --muted: #64748b;
  --label: #475569;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

/* NAV */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}
.nav-logo { font-size: 18px; font-weight: 800; color: var(--accent); text-decoration: none; }
.nav-logo span { color: var(--text); }

/* LAYOUT: editor left, preview right */
.app-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  min-height: calc(100vh - 56px);
}
@media (max-width: 860px) { .app-layout { grid-template-columns: 1fr; } .preview-pane { display: none; } }

/* EDITOR PANE */
.editor-pane {
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  height: calc(100vh - 56px);
  position: sticky;
  top: 56px;
}
.editor-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--accent-light);
}
.editor-header h1 { font-size: 16px; font-weight: 700; color: var(--accent); }
.editor-header p { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* TABS */
.tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--surface); }
.tab { padding: 10px 16px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; transition: all .15s; white-space: nowrap; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab:hover:not(.active) { color: var(--text); }

.tab-content { display: none; padding: 20px; }
.tab-content.active { display: block; }

/* FIELD */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--label); margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface2);
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); background: var(--surface); }
.field textarea { resize: vertical; min-height: 70px; }
.half { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* REPEATABLE SECTION */
.rep-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  background: var(--surface2);
  position: relative;
}
.rep-item-remove { position: absolute; top: 8px; right: 10px; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 16px; }
.rep-item-remove:hover { color: #ef4444; }
.add-btn { width: 100%; padding: 8px; border: 1px dashed var(--border); border-radius: 8px; background: none; color: var(--muted); cursor: pointer; font-size: 13px; margin-top: 4px; }
.add-btn:hover { border-color: var(--accent); color: var(--accent); }

/* TEMPLATE SELECTOR */
.template-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.tmpl-card { border: 2px solid var(--border); border-radius: 10px; padding: 10px; cursor: pointer; text-align: center; transition: border-color .15s; }
.tmpl-card.selected { border-color: var(--accent); background: var(--accent-light); }
.tmpl-card:hover:not(.selected) { border-color: var(--muted); }
.tmpl-preview { height: 60px; border-radius: 4px; margin-bottom: 6px; display: flex; flex-direction: column; gap: 3px; padding: 6px; }
.tmpl-name { font-size: 11px; font-weight: 600; color: var(--label); }

/* COLOR PICKER */
.color-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.color-dot { width: 24px; height: 24px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: transform .1s; }
.color-dot:hover { transform: scale(1.2); }
.color-dot.selected { border-color: var(--text); }

/* ACTIONS */
.editor-actions { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.btn { padding: 9px 18px; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .15s; }
.btn-primary { background: var(--accent); color: #fff; flex: 1; }
.btn-primary:hover { background: var(--accent2); }
.btn-secondary { background: var(--surface2); color: var(--label); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

/* PREVIEW PANE */
.preview-pane {
  padding: 32px;
  overflow-y: auto;
  height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.preview-label { font-size: 11px; color: var(--muted); margin-bottom: 12px; text-transform: uppercase; letter-spacing: .05em; }

/* RESUME PAPER */
.resume-paper {
  background: white;
  width: 100%;
  max-width: 680px;
  min-height: 940px;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
  font-family: 'Times New Roman', serif;
  font-size: 11pt;
  color: #1a1a1a;
  overflow: hidden;
}

/* ──────── TEMPLATE: CLASSIC ──────── */
.tmpl-classic .resume-head { padding: 28px 32px 20px; text-align: center; }
.tmpl-classic .resume-name { font-size: 24pt; font-weight: 700; letter-spacing: 1px; margin-bottom: 4px; }
.tmpl-classic .resume-contact { font-size: 9pt; color: #555; }
.tmpl-classic .resume-contact span + span::before { content: " · "; }
.tmpl-classic .resume-body { padding: 0 32px 28px; }
.tmpl-classic .section { margin-bottom: 16px; }
.tmpl-classic .section-title { font-size: 11pt; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; padding-bottom: 4px; border-bottom: 2px solid; margin-bottom: 10px; }
.tmpl-classic .item { margin-bottom: 10px; }
.tmpl-classic .item-head { display: flex; justify-content: space-between; font-weight: 600; font-size: 10.5pt; }
.tmpl-classic .item-sub { font-size: 9.5pt; color: #555; margin-bottom: 3px; }
.tmpl-classic .item-desc { font-size: 9.5pt; color: #333; }
.tmpl-classic .skills-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.tmpl-classic .skill-tag { background: #f1f5f9; padding: 2px 10px; border-radius: 20px; font-size: 9pt; font-family: sans-serif; }

/* ──────── TEMPLATE: MODERN ──────── */
.tmpl-modern { display: grid; grid-template-columns: 200px 1fr; }
.tmpl-modern .side { padding: 28px 18px; color: white; }
.tmpl-modern .side-name { font-size: 16pt; font-weight: 700; margin-bottom: 4px; line-height: 1.2; }
.tmpl-modern .side-role { font-size: 9pt; opacity: .85; margin-bottom: 18px; }
.tmpl-modern .side-section { margin-bottom: 16px; }
.tmpl-modern .side-label { font-size: 8pt; text-transform: uppercase; letter-spacing: 1px; opacity: .7; margin-bottom: 6px; font-weight: 700; }
.tmpl-modern .side-item { font-size: 9pt; opacity: .9; margin-bottom: 3px; }
.tmpl-modern .side-skill { background: rgba(255,255,255,.2); border-radius: 20px; padding: 2px 8px; font-size: 8.5pt; display: inline-block; margin: 2px 2px 2px 0; }
.tmpl-modern .main { padding: 28px 24px; }
.tmpl-modern .section { margin-bottom: 18px; }
.tmpl-modern .section-title { font-size: 10pt; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; padding-bottom: 4px; border-bottom: 2px solid; margin-bottom: 10px; font-family: sans-serif; }
.tmpl-modern .item { margin-bottom: 10px; }
.tmpl-modern .item-head { display: flex; justify-content: space-between; font-weight: 700; font-size: 10.5pt; }
.tmpl-modern .item-sub { font-size: 9pt; color: #666; }
.tmpl-modern .item-desc { font-size: 9pt; color: #444; margin-top: 3px; }

/* ──────── TEMPLATE: MINIMAL ──────── */
.tmpl-minimal .resume-head { padding: 32px 36px 16px; border-bottom: 1px solid #e2e8f0; }
.tmpl-minimal .resume-name { font-size: 26pt; font-weight: 300; letter-spacing: 2px; color: #1e293b; }
.tmpl-minimal .resume-role { font-size: 10pt; color: #94a3b8; margin-top: 2px; letter-spacing: 1px; }
.tmpl-minimal .resume-contact { font-size: 8.5pt; color: #64748b; margin-top: 8px; }
.tmpl-minimal .resume-contact span + span::before { content: " | "; }
.tmpl-minimal .resume-body { padding: 16px 36px 32px; }
.tmpl-minimal .section { margin-bottom: 18px; }
.tmpl-minimal .section-title { font-size: 8pt; font-weight: 700; text-transform: uppercase; letter-spacing: 2px; color: #94a3b8; margin-bottom: 10px; }
.tmpl-minimal .item { margin-bottom: 10px; padding-left: 12px; border-left: 2px solid #e2e8f0; }
.tmpl-minimal .item-head { display: flex; justify-content: space-between; font-weight: 600; font-size: 10pt; }
.tmpl-minimal .item-sub { font-size: 9pt; color: #94a3b8; }
.tmpl-minimal .item-desc { font-size: 9pt; color: #475569; margin-top: 3px; }
.tmpl-minimal .skills-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.tmpl-minimal .skill-tag { border: 1px solid #e2e8f0; padding: 2px 10px; border-radius: 4px; font-size: 9pt; color: #475569; font-family: sans-serif; }

/* FOOTER */
footer { text-align: center; padding: 16px; color: var(--muted); font-size: 11px; border-top: 1px solid var(--border); background: var(--surface); }
