/* ============================================================
   editor.css — Résumé Editor styles
   ============================================================ */

/* ── Layout shell ────────────────────────────────────────── */
html, body { height: 100%; overflow: hidden; }

body {
  display: flex;
  flex-direction: column;
}

.editor-toolbar {
  height: 52px;
  background: var(--color-surface);
  border-bottom: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  gap: 1rem;
  flex-shrink: 0;
  z-index: 50;
}

.toolbar-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.toolbar-filename {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  outline: none;
  min-width: 120px;
  text-align: center;
}

.toolbar-filename:hover { background: var(--color-surface-alt); }
.toolbar-filename:focus { background: var(--color-surface-alt); box-shadow: 0 0 0 2px var(--color-primary); }

.toolbar-actions { display: flex; gap: 0.5rem; align-items: center; }

.editor-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Sidebar layout controls (select, hints) ────────────────── */
.sidebar-field-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

.sidebar-select {
  width: 100%;
  font-size: 0.78rem;
  padding: 0.4rem 0.6rem;
}

.sidebar-hint {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-top: 0.25rem;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.editor-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 2px solid var(--color-border);
  overflow-y: auto;
  padding: 1rem 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sidebar-section { display: flex; flex-direction: column; gap: 0.5rem; }

.sidebar-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--color-border);
}

.block-palette { display: flex; flex-direction: column; gap: 0.375rem; }

.palette-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: grab;
  user-select: none;
  background: var(--color-surface);
  transition: background 0.1s, box-shadow 0.1s, transform 0.1s;
  /* gradient tape left border */
  border-left: 4px solid transparent;
  border-image: var(--gradient) 1;
}

.palette-chip:hover {
  background: var(--color-surface-alt);
  box-shadow: var(--shadow);
  transform: translateX(2px);
}

.palette-chip:active { cursor: grabbing; opacity: 0.6; }

.palette-chip.dragging { opacity: 0.4; }

.chip-grip { color: var(--color-text-muted); font-size: 1rem; line-height: 1; }
.chip-icon { font-size: 0.9rem; }

.sidebar-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 0.25rem 0;
}

.sidebar-toggle input[type="checkbox"] { accent-color: var(--color-primary); }

.sidebar-tip {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 0.75rem;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ── Canvas ──────────────────────────────────────────────── */
.editor-canvas {
  flex: 1;
  overflow-y: auto;
  background: #e8e8e8;
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.editor-canvas.dark-canvas { background: #2a2a2a; }

/* ── Right edit panel ────────────────────────────────────── */
.editor-panel {
  width: 300px;
  flex-shrink: 0;
  background: var(--color-surface);
  border-left: 2px solid var(--color-border);
  overflow-y: auto;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
}

.panel-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  gap: 0.5rem;
  padding: 2rem 1rem;
  line-height: 1.5;
}

.panel-empty-icon {
  font-size: 1.5rem;
  opacity: 0.4;
}

.panel-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.pf-type-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
}

.pf-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pf-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

.pf-input, .pf-textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  padding: 0.5rem 0.6rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: var(--color-text);
  outline: none;
  resize: vertical;
  box-sizing: border-box;
}

.pf-input:focus, .pf-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(255,51,102,0.15);
}

.pf-textarea-sm { font-size: 0.8rem; }

.pf-bullet-list { display: flex; flex-direction: column; gap: 0.5rem; }

.pf-bullet-row {
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
}

.pf-bullet-row .pf-input,
.pf-bullet-row .pf-textarea { flex: 1; }

.pf-remove-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  border-radius: 4px;
  cursor: pointer;
  color: #999;
  font-size: 11px;
}

.pf-remove-btn:hover { background: #fff0f0; color: #e00; border-color: #e00; }

.pf-add-btn {
  margin-top: 0.5rem;
  font-size: 0.78rem;
  background: none;
  border: 1px dashed var(--color-border);
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  border-radius: var(--radius-lg);
  color: var(--color-text-muted);
  font-family: inherit;
  width: 100%;
}

.pf-add-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }

.pf-hint { font-size: 0.8rem; color: var(--color-text-muted); line-height: 1.5; }

.pf-col-toggle { display: flex; gap: 0.4rem; }

.pf-col-btn {
  flex: 1;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.45rem 0.5rem;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  cursor: pointer;
  color: var(--color-text-muted);
}

.pf-col-btn.active {
  background: var(--color-primary);
  color: var(--color-primary-contrast);
  border-color: var(--color-primary);
}

/* Drop zone hint when canvas is empty */
.canvas-hint {
  width: 680px;
  max-width: 100%;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 3rem;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  background: var(--color-surface);
  pointer-events: none;
}

/* Drop indicator line */
.drop-indicator {
  width: 680px;
  max-width: 100%;
  height: 3px;
  background: var(--gradient);
  border-radius: 2px;
  display: none;
  pointer-events: none;
  margin: 0 auto;
}

.drop-indicator.visible { display: block; }

/* ── Resume paper ────────────────────────────────────────── */
.resume-paper {
  width: 680px;
  max-width: 100%;
  min-height: 880px;
  background: white;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  padding: 52px 60px;
  font-family: 'Times New Roman', Times, serif;
  color: #111;
  position: relative;
}

.resume-paper.show-guides .resume-block { outline: 1px dashed rgba(255,51,102,0.3); }

/* Two-column layout: a flex row of two .col-track containers,
   each holding its own ordered list of .resume-block elements. */
.col-wrap {
  display: flex;
  gap: 28px;
  align-items: flex-start;
}

.col-track {
  display: flex;
  flex-direction: column;
  min-height: 60px;
}

.col-track.col-main { flex: 1; min-width: 0; }
.col-track.col-side { flex: 0 0 var(--side-width, 32%); min-width: 0; }

.resume-paper.is-two-col .col-track {
  min-height: 120px;
}

.resume-paper.show-guides .col-track {
  outline: 1px dotted rgba(124,77,255,0.35);
  outline-offset: 4px;
}

/* ── Resume block wrapper ────────────────────────────────── */
.resume-block {
  position: relative;
  transition: opacity 0.15s, transform 0.12s ease;
  cursor: pointer;
  border-radius: 4px;
}

.resume-block.is-dragging { opacity: 0.3; }

.resume-block.block-selected {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

/* Block controls (appear on hover) */
.block-controls {
  position: absolute;
  right: -48px;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  opacity: 0;
  transition: opacity 0.15s;
}

.resume-block:hover > .block-controls,
.resume-block.block-selected > .block-controls { opacity: 1; }

.bc-btn {
  width: 30px; height: 30px;
  border: 1.5px solid var(--color-border);
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  transition: background 0.1s, color 0.1s;
}

.bc-btn:hover { background: #fff0f3; color: var(--color-primary); border-color: var(--color-primary); }
.bc-btn.move:hover { background: #f0f0ff; color: var(--color-secondary); border-color: var(--color-secondary); }
.bc-btn.col { color: var(--color-secondary); }
.bc-btn.col:hover { background: #f0f0ff; border-color: var(--color-secondary); }
.bc-btn.col.active { background: var(--color-secondary); color: #fff; }

/* ── Block styles (résumé typography) ───────────────────── */


/* Header */
.rb-header { text-align: center; margin-bottom: 4px; }
.rb-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
  outline: none;
  min-height: 28px;
  display: block;
}
.rb-contact {
  font-size: 11px;
  color: #444;
  margin-top: 4px;
  outline: none;
  min-height: 16px;
  display: block;
}

/* Section title */
.rb-section-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1.5px solid #111;
  padding-bottom: 2px;
  margin-top: 12px;
  margin-bottom: 6px;
  outline: none;
  min-height: 18px;
  display: block;
}

/* Experience */
.rb-experience { margin-bottom: 8px; }
.rb-exp-row { display: flex; justify-content: space-between; align-items: baseline; }
.rb-company { font-weight: 700; font-size: 12px; min-width: 40px; }
.rb-dates   { font-size: 11px; color: #444; min-width: 40px; text-align: right; }
.rb-role    { font-size: 12px; font-style: italic; min-width: 40px; }
.rb-loc     { font-size: 11px; color: #444; min-width: 40px; text-align: right; }
.rb-bullets { margin-top: 3px; padding-left: 16px; font-size: 11.5px; line-height: 1.55; }
.rb-bullet  { margin-bottom: 1px; }

/* Education */
.rb-education { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 12px; gap: 0.75rem; }
.rb-edu-left  {}
.rb-edu-school { font-weight: 700; display: block; }
.rb-edu-degree { font-style: italic; display: block; }
.rb-edu-right  { text-align: right; font-size: 11px; color: #444; flex-shrink: 0; }

/* Skills */
.rb-skills { font-size: 11.5px; line-height: 1.6; }
.rb-skills-label { font-weight: 700; }
.rb-skills-list { min-height: 16px; display: inline; }

/* Text */
.rb-text {
  font-size: 11.5px;
  line-height: 1.65;
  min-height: 16px;
  display: block;
}

/* Links */
.rb-links { font-size: 11.5px; }
.rb-links-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 2px; }
.rb-link-item { color: #1a0dab; text-decoration: underline; }

/* Spacer */
.rb-spacer { height: 14px; }

/* Empty-field placeholder text shown on the document preview */
.rb-placeholder { color: #bbb; font-style: italic; }

/* ── Publish modal ───────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-box {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  width: 400px;
  max-width: 90vw;
}

.modal-box h2 { font-size: 1.25rem; margin-bottom: 0.4rem; }
.modal-sub { font-size: 0.8rem; color: var(--color-text-muted); margin-bottom: 1.25rem; }

.modal-fields { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.5rem; }

.modal-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.modal-field input[type="checkbox"] { accent-color: var(--color-primary); }

.modal-hint { font-size: 0.7rem; color: var(--color-text-muted); margin-left: 0.25rem; }

.modal-category { margin-top: 0.5rem; }

.modal-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  outline: none;
  border-radius: var(--radius-lg);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%231A1A1A' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  cursor: pointer;
}

.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1100px) {
  .editor-panel { width: 260px; }
}

@media (max-width: 900px) {
  .editor-sidebar { width: 180px; }
  .editor-panel { width: 230px; }
  .resume-paper { padding: 32px 28px; }
  .block-controls { right: -36px; }
  .bc-btn { width: 26px; height: 26px; }
}

@media (max-width: 640px) {
  .editor-sidebar { display: none; }
  .editor-panel { display: none; }
  .editor-canvas { padding: 1rem 0.5rem; }
  .resume-paper { padding: 24px 18px; }
  .block-controls { display: none; }
}

/* ── Drag-to-reorder: physical lifted card ───────────────────── */
.resume-block.block-lifted {
  box-shadow: 6px 8px 0 0 rgba(0,0,0,0.15), 0 16px 28px rgba(0,0,0,0.22);
  transform: rotate(-1.5deg) scale(1.015);
  background: white;
  border-radius: 4px;
}

.resume-block-placeholder {
  border: 2px dashed var(--color-primary);
  border-radius: 4px;
  background: rgba(255,51,102,0.05);
  margin: 4px 0;
}

.bc-drag-handle {
  width: 30px; height: 30px;
  border: 1.5px solid var(--color-border);
  background: white;
  border-radius: 4px;
  cursor: grab;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  margin-bottom: 2px;
  user-select: none;
  touch-action: none;
}
.bc-drag-handle:hover { background: #f0f0ff; color: var(--color-secondary); border-color: var(--color-secondary); }
.bc-drag-handle:active { cursor: grabbing; }
.bc-btn.del:hover { background: #fff0f0; color: #e00; border-color: #e00; }

/* ── Portfolio modal ─────────────────────────────────────────── */
.modal-box-wide {
  width: 880px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.theme-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.theme-card {
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
}

.theme-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.theme-card.theme-selected { border-color: var(--color-primary); box-shadow: 0 0 0 2px rgba(255,51,102,0.2); }

.theme-swatch {
  height: 72px;
}
.theme-swatch-minimal { background: #fff; border-bottom: 1px solid #eee; display: flex; align-items: center; justify-content: center; }
.theme-swatch-minimal::after { content: 'Aa'; font-family: Georgia, serif; font-size: 1.8rem; color: #111; }
.theme-swatch-bold { background: #0a0a0a; display: flex; align-items: center; justify-content: center; }
.theme-swatch-bold::after { content: 'Aa'; font-family: sans-serif; font-size: 1.8rem; font-weight: 900; background: linear-gradient(135deg,#FF3366,#7C4DFF); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.theme-swatch-warm { background: #FDF6EE; display: flex; align-items: center; justify-content: center; }
.theme-swatch-warm::after { content: 'Aa'; font-family: Georgia, serif; font-size: 1.8rem; color: #8B4513; }
.theme-swatch-neon { background: #050510; display: flex; align-items: center; justify-content: center; }
.theme-swatch-neon::after { content: 'Aa'; font-family: monospace; font-size: 1.8rem; color: #00E5B0; }

.theme-info {
  padding: 0.6rem 0.75rem;
  background: var(--color-surface);
}
.theme-info strong { font-size: 0.8rem; font-weight: 700; display: block; }
.theme-info span { font-size: 0.7rem; color: var(--color-text-muted); }

.portfolio-preview-wrap {
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #fff;
}

.portfolio-preview-frame {
  width: 100%;
  height: 420px;
  border: none;
  display: block;
  transform-origin: top left;
}

@media print {
  .editor-toolbar, .editor-sidebar, .editor-panel, .block-controls { display: none !important; }
  .editor-layout { display: block; overflow: visible; }
  .editor-canvas { padding: 0; background: none; overflow: visible; }
  .resume-paper { box-shadow: none; width: 100%; max-width: 100%; }
  .resume-block.block-selected { outline: none; }
}
