/* ═══════════════════════════════════════════════════════════
   EchoWork – CV Builder Stylesheet
   Split layout: editor left | preview right
   ═══════════════════════════════════════════════════════════ */

/* ── Layout ──────────────────────────────────────────────── */
.cvb-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  min-height: calc(100vh - 64px);
}
.cvb-editor {
  background: #f8fffe;
  overflow-y: auto;
  padding: 24px 20px 80px;
  border-right: 1px solid #e5e7eb;
}
.cvb-preview-pane {
  background: #f0f4f8;
  overflow-y: auto;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
}

/* ── Editor Header ────────────────────────────────────────── */
.cvb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}
.cvb-header h1 { font-size: 20px; font-weight: 800; color: #111827; margin: 0; }
.cvb-meta { font-size: 12px; color: #9ca3af; margin-top: 2px; }
.cvb-status-bar {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
  background: #d1fae5; color: #065f46;
}
.cvb-status-bar.saving  { background: #fef3c7; color: #92400e; }
.cvb-status-bar.error   { background: #fee2e2; color: #991b1b; }

/* ── Template Selector ────────────────────────────────────── */
.template-scroll {
  display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px;
  margin-bottom: 20px; scrollbar-width: thin;
}
.tpl-card {
  flex-shrink: 0; width: 80px; padding: 10px 6px; border: 2px solid #e5e7eb;
  border-radius: 10px; text-align: center; cursor: pointer; font-size: 11px;
  font-weight: 600; color: #6b7280; transition: all 0.18s;
  background: white;
}
.tpl-card:hover { border-color: #00b894; color: #065f46; }
.tpl-card.active { border-color: #00b894; background: #f0fdf4; color: #065f46; }
.tpl-card .tpl-icon { font-size: 22px; display: block; margin-bottom: 4px; }

/* ── Section Cards ────────────────────────────────────────── */
.cv-section {
  background: white; border-radius: 14px; border: 1.5px solid #e5e7eb;
  box-shadow: 0 2px 8px rgba(0,0,0,.05); margin-bottom: 14px;
  overflow: hidden; transition: box-shadow 0.2s;
}
.cv-section:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.cv-section.dragging { opacity: 0.5; border: 2px dashed #00b894; }
.cv-section.drag-over { border-color: #00b894; box-shadow: 0 0 0 3px rgba(0,184,148,.2); }

.section-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; cursor: pointer; user-select: none;
  background: white; transition: background 0.15s;
}
.section-header:hover { background: #f9fafb; }
.section-drag-handle {
  color: #d1d5db; cursor: grab; font-size: 16px; flex-shrink: 0;
  touch-action: none;
}
.section-drag-handle:active { cursor: grabbing; }
.section-icon { font-size: 18px; flex-shrink: 0; }
.section-title { font-size: 14px; font-weight: 700; color: #111827; flex: 1; }
.section-toggle {
  color: #9ca3af; font-size: 12px; transition: transform 0.2s; flex-shrink: 0;
}
.cv-section.collapsed .section-toggle { transform: rotate(-90deg); }
.section-body {
  padding: 0 18px 18px;
  border-top: 1px solid #f3f4f6;
}
.cv-section.collapsed .section-body { display: none; }

/* ── Form Fields ──────────────────────────────────────────── */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-group { margin-bottom: 14px; }
.field-group label {
  display: block; font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 5px;
}
.field-group input,
.field-group textarea,
.field-group select {
  width: 100%; padding: 9px 12px; border: 1.5px solid #e5e7eb; border-radius: 9px;
  font-size: 13.5px; font-family: 'Inter', sans-serif; color: #111827; outline: none;
  transition: border-color 0.18s, box-shadow 0.18s; background: white;
}
.field-group input:focus,
.field-group textarea:focus,
.field-group select:focus {
  border-color: #00b894; box-shadow: 0 0 0 3px rgba(0,184,148,.1);
}
.field-group textarea { resize: vertical; line-height: 1.6; }
.field-hint { font-size: 11px; color: #9ca3af; margin-top: 4px; }

/* ── List Items (Education, Experience, etc.) ─────────────── */
.list-items { margin-bottom: 10px; }
.list-item {
  border: 1.5px solid #f3f4f6; border-radius: 10px; padding: 14px;
  margin-bottom: 10px; background: #fafafa; position: relative;
}
.list-item-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;
}
.list-item-title { font-size: 13px; font-weight: 600; color: #374151; }
.btn-remove-item {
  background: none; border: none; color: #ef4444; cursor: pointer;
  font-size: 18px; padding: 0 4px; line-height: 1; border-radius: 4px;
  transition: background 0.15s;
}
.btn-remove-item:hover { background: #fee2e2; }
.btn-add-item {
  width: 100%; padding: 9px; border: 2px dashed #d1d5db; border-radius: 9px;
  background: none; color: #6b7280; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: 'Inter', sans-serif; transition: all 0.18s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-add-item:hover { border-color: #00b894; color: #00b894; background: #f0fdf4; }

/* ── Skills Tags ──────────────────────────────────────────── */
.skills-wrap {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 10px;
  border: 1.5px solid #e5e7eb; border-radius: 9px; min-height: 44px; background: white;
}
.skills-wrap:focus-within { border-color: #00b894; box-shadow: 0 0 0 3px rgba(0,184,148,.1); }
.skill-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: #d1fae5; color: #065f46; padding: 4px 10px; border-radius: 20px;
  font-size: 12.5px; font-weight: 600;
}
.skill-tag button {
  background: none; border: none; cursor: pointer; color: #6b7280;
  font-size: 14px; padding: 0; line-height: 1;
}
.skill-tag button:hover { color: #ef4444; }
.skill-input {
  border: none; outline: none; font-size: 13px; font-family: 'Inter', sans-serif;
  min-width: 120px; flex: 1; background: transparent; padding: 2px 4px;
}

/* ── Sticky Action Bar ────────────────────────────────────── */
.cvb-actions {
  position: sticky; bottom: 0; background: white; padding: 14px 20px;
  border-top: 1px solid #e5e7eb; display: flex; gap: 10px; z-index: 10;
  box-shadow: 0 -4px 20px rgba(0,0,0,.06);
}
.btn-save-cv {
  flex: 1; padding: 11px 20px; background: #00b894; color: white;
  border: none; border-radius: 10px; font-size: 14px; font-weight: 700;
  cursor: pointer; font-family: 'Inter', sans-serif;
  transition: background 0.18s, transform 0.15s; display: flex;
  align-items: center; justify-content: center; gap: 6px;
}
.btn-save-cv:hover { background: #00a381; transform: translateY(-1px); }
.btn-save-cv:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }
.btn-download-cv {
  padding: 11px 18px; background: white; color: #374151;
  border: 2px solid #e5e7eb; border-radius: 10px; font-size: 14px; font-weight: 700;
  cursor: pointer; font-family: 'Inter', sans-serif;
  transition: border-color 0.18s; display: flex; align-items: center; gap: 6px;
}
.btn-download-cv:hover { border-color: #00b894; color: #00b894; }
.btn-download-cv:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Preview Pane ─────────────────────────────────────────── */
.preview-header {
  padding: 12px 18px; background: white; border-bottom: 1px solid #e5e7eb;
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.preview-header span { font-size: 12px; font-weight: 600; color: #6b7280; }
.preview-scroll { flex: 1; overflow-y: auto; padding: 20px; }

/* ── CV Preview Document ──────────────────────────────────── */
.cv-doc {
  background: white; width: 100%; max-width: 680px; margin: 0 auto;
  box-shadow: 0 4px 24px rgba(0,0,0,.12); border-radius: 4px;
  min-height: 900px; font-size: 12px; line-height: 1.6; color: #1a1a1a;
  font-family: 'Inter', sans-serif;
}
.cv-doc-inner { padding: 40px 36px; }

/* Template: default */
.cv-doc.tpl-default .cv-header-doc {
  text-align: center; padding-bottom: 20px; border-bottom: 2px solid #00b894; margin-bottom: 20px;
}
.cv-doc.tpl-default .cv-header-doc h2 { font-size: 22px; font-weight: 800; color: #111827; }
.cv-doc.tpl-default .cv-header-doc .cv-contact {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 12px;
  margin-top: 6px; font-size: 11px; color: #6b7280;
}

/* Template: modern */
.cv-doc.tpl-modern .cv-header-doc {
  background: linear-gradient(135deg, #00b894, #00cec9);
  padding: 24px 36px; margin: -40px -36px 24px; color: white;
}
.cv-doc.tpl-modern .cv-header-doc h2 { font-size: 22px; font-weight: 800; color: white; }
.cv-doc.tpl-modern .cv-header-doc .cv-contact { color: rgba(255,255,255,.8); font-size:11px; gap: 12px; display:flex; flex-wrap:wrap; margin-top: 6px; }

/* Template: elegant */
.cv-doc.tpl-elegant .cv-header-doc {
  padding-bottom: 16px; border-bottom: 1px solid #e5e7eb; margin-bottom: 20px;
}
.cv-doc.tpl-elegant .cv-header-doc h2 { font-size: 20px; font-weight: 700; color: #1a1a1a; letter-spacing: 1px; }

/* Shared doc sections */
.cv-section-doc { margin-bottom: 18px; }
.cv-section-doc h3 {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px;
  color: #00b894; margin-bottom: 8px; padding-bottom: 4px; border-bottom: 1.5px solid #e5e7eb;
}
.cv-section-doc p { font-size: 12px; color: #374151; margin-bottom: 6px; }
.cv-entry { margin-bottom: 12px; }
.cv-entry-title { font-size: 12.5px; font-weight: 700; color: #111827; }
.cv-entry-sub { font-size: 11.5px; color: #6b7280; margin-bottom: 2px; }
.cv-entry-desc { font-size: 11.5px; color: #374151; }
.cv-skills-doc { display: flex; flex-wrap: wrap; gap: 6px; }
.cv-skill-chip {
  background: #d1fae5; color: #065f46; padding: 3px 9px;
  border-radius: 12px; font-size: 11px; font-weight: 600;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .cvb-shell { grid-template-columns: 1fr; }
  .cvb-preview-pane { display: none; }
  .cvb-preview-pane.show-mobile { display: flex; height: 60vh; position: fixed; bottom: 0; left: 0; right: 0; z-index: 100; border-top: 2px solid #00b894; }
  .field-row { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .cvb-editor { padding: 16px 14px 100px; }
}
