/* ==========================================================================
   CvSnap — Editor Stylesheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Editor Layout
   -------------------------------------------------------------------------- */
.editor-page {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 600px at 15% 0%, rgba(99,102,241,0.08), transparent 55%),
    linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   2. Editor Toolbar
   -------------------------------------------------------------------------- */
.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(226,232,240,0.8);
  box-shadow: 0 8px 24px rgba(15,23,42,0.06);
  z-index: 50;
  gap: var(--space-4);
  flex-shrink: 0;
}

/* Ensure toolbar matches dark theme when data-theme="dark" is set on html */
[data-theme="dark"] .editor-toolbar {
  background: var(--bg-glass-strong);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 8px 24px rgba(2,6,23,0.6);
  color: var(--text-primary);
}

[data-theme="dark"] .toolbar-divider {
  background: var(--border-color);
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.toolbar-center {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  justify-content: center;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.toolbar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-heading);
  font-size: var(--fs-lg);
  font-weight: 800;
  color: var(--text-primary);
  text-decoration: none;
}

.toolbar-logo-icon {
  width: 32px;
  height: 32px;
  padding: 4px;
  background: linear-gradient(135deg, rgba(99,102,241,0.16), rgba(6,182,212,0.12));
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45);
  object-fit: cover;
}

.toolbar-divider {
  width: 1px;
  height: 28px;
  background: var(--border-color);
}

/* CV Name Input */
.cv-name-input {
  background: transparent;
  border: 1px solid transparent;
  padding: var(--space-1) var(--space-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-primary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  max-width: 200px;
}

.cv-name-input:hover {
  border-color: var(--border-color);
}

.cv-name-input:focus {
  border-color: var(--primary);
  background: var(--bg-secondary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

/* Template Selector */
.template-selector {
  position: relative;
}

.template-selector-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.template-selector-btn:hover {
  border-color: var(--primary);
  background: var(--bg-card);
}

.template-selector-btn .arrow {
  font-size: var(--fs-xs);
  transition: transform var(--transition-fast);
}

.template-selector-btn.open .arrow {
  transform: rotate(180deg);
}

.template-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  max-height: 500px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  padding: var(--space-4);
  display: none;
  z-index: 100;
  animation: slideDown 0.2s ease;
}

.template-dropdown.show {
  display: block;
}

.template-dropdown-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
}

.template-option {
  cursor: pointer;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-fast);
  background: white;
}

.template-option:hover {
  border-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.template-option.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.2);
}

.template-option-preview {
  height: 160px;
  overflow: hidden;
  position: relative;
  background: #fff;
  padding: 4px;
}

.template-option-preview > div {
  transform: scale(0.25);
  transform-origin: top left;
  width: 400%;
  height: 400%;
  pointer-events: none;
}

.template-option-name {
  padding: var(--space-2) var(--space-3);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-card);
  text-align: center;
  border-top: 1px solid var(--border-light);
}

/* Color Preset Selector */
.color-presets {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.color-preset {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 2px solid transparent;
  position: relative;
}

.color-preset:hover {
  transform: scale(1.2);
}

.color-preset.active {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--text-tertiary);
}

.color-preset[data-color="ocean"] { background: #2563eb; }
.color-preset[data-color="emerald"] { background: #059669; }
.color-preset[data-color="purple"] { background: #7c3aed; }
.color-preset[data-color="sunset"] { background: #ea580c; }
.color-preset[data-color="crimson"] { background: #dc2626; }
.color-preset[data-color="teal"] { background: #0d9488; }
.color-preset[data-color="slate"] { background: #475569; }
.color-preset[data-color="rose"] { background: #e11d48; }

/* Language Selector */
.language-selector {
  position: relative;
}

.language-selector-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.language-selector-btn:hover {
  border-color: var(--primary);
  background: var(--bg-card);
}

.language-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 140px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--space-2);
  display: none;
  z-index: 100;
}

.language-dropdown.show {
  display: block;
}

.language-option {
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  font-size: var(--fs-sm);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.language-option:hover {
  background: var(--bg-secondary);
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   3. Editor Body
   -------------------------------------------------------------------------- */
.editor-body {
  display: grid;
  grid-template-columns: 430px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   4. Editor Sidebar (Form)
   -------------------------------------------------------------------------- */
.editor-sidebar {
  width: auto;
  flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) var(--bg-secondary);
}

.editor-sidebar::-webkit-scrollbar {
  width: 6px;
}

.editor-sidebar::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 3px;
}

.editor-sidebar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.editor-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* Accordion Section */
.editor-section {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--transition-fast);
  background: var(--bg-card);
  box-shadow: 0 6px 18px rgba(15,23,42,0.04);
  flex-shrink: 0;
}

.editor-section:hover {
  border-color: var(--primary-light);
  box-shadow: 0 10px 24px rgba(99,102,241,0.08);
}

.editor-section.open {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.1);
}

.editor-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  user-select: none;
  background: var(--bg-card);
  transition: all var(--transition-fast);
  font-weight: 500;
}

.editor-section-header:hover {
  background: var(--bg-tertiary);
}

.editor-section.open .editor-section-header {
  background: linear-gradient(180deg, rgba(99,102,241,0.09), rgba(99,102,241,0.04));
  border-bottom: 1px solid rgba(99,102,241,0.24);
}

[data-theme="dark"] .editor-section.open .editor-section-header {
  background: rgba(99,102,241,0.1);
  border-bottom-color: var(--primary);
}

.editor-section-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.editor-section-title .icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(6,182,212,0.08));
  color: var(--primary);
  font-size: var(--fs-base);
}

.editor-section.open .editor-section-title .icon {
  background: var(--gradient-primary);
  color: white;
  transform: scale(1.1);
}

[data-theme="dark"] .editor-section-title .icon {
  background: rgba(99,102,241,0.15);
}

[data-theme="dark"] .editor-section.open .editor-section-title .icon {
  background: var(--primary);
}

.editor-section-toggle {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  transition: transform var(--transition-fast);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.editor-section.open .editor-section-toggle {
  transform: rotate(180deg);
  color: var(--primary);
}

.editor-section-body {
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
  background: var(--bg-card);
}

.editor-section.open .editor-section-body {
  padding: var(--space-5);
  max-height: none;
  overflow: visible;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) var(--bg-secondary);
}

.editor-section.open .editor-section-body::-webkit-scrollbar {
  width: 6px;
}

.editor-section.open .editor-section-body::-webkit-scrollbar-track {
  background: transparent;
}

.editor-section.open .editor-section-body::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.editor-section.open .editor-section-body::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* Form fields in editor */
.editor-form-group {
  margin-bottom: var(--space-4);
  min-width: 0;
}

.editor-form-group:last-child {
  margin-bottom: 0;
}

.editor-form-label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.editor-form-input {
  width: 100%;
  min-width: 0;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--fs-sm);
  transition: all var(--transition-fast);
  outline: none;
}

.editor-form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
  background: var(--bg-card);
}

.editor-form-input::placeholder {
  color: var(--text-tertiary);
}

textarea.editor-form-input {
  min-height: 80px;
  resize: vertical;
  line-height: 1.6;
}

.editor-form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-3);
}

/* Repeatable items (Experience, Education) */
.editor-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  position: relative;
  animation: scaleIn 0.3s ease;
  box-shadow: 0 8px 22px rgba(15,23,42,0.04);
}

.editor-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  gap: var(--space-2);
}

.editor-item-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.editor-item-actions {
  display: flex;
  gap: var(--space-1);
}

.editor-item-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  font-size: var(--fs-xs);
  transition: all var(--transition-fast);
}

.editor-item-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.editor-item-btn.delete:hover {
  background: rgba(239,68,68,0.1);
  color: var(--error);
}

.editor-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-3);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: transparent;
}

.editor-add-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-50);
}

[data-theme="dark"] .editor-add-btn:hover {
  background: rgba(99,102,241,0.1);
}

/* Skill Level Slider */
.skill-level-group {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.skill-level-slider {
  flex: 1;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  outline: none;
}

.skill-level-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.skill-level-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.skill-level-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: var(--shadow-sm);
}

.skill-level-value {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--primary);
  min-width: 35px;
  text-align: right;
}

/* Tags Input */
.tags-input-container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-primary);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  min-height: 40px;
  transition: all var(--transition-fast);
  cursor: text;
}

.tags-input-container:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
  background: var(--bg-card);
}

.tag-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 8px;
  background: var(--primary-50);
  color: var(--primary);
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  font-weight: 500;
  animation: scaleIn 0.2s ease;
}

[data-theme="dark"] .tag-item {
  background: rgba(99,102,241,0.15);
}

.tag-remove {
  cursor: pointer;
  font-size: 10px;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
  padding: 2px;
  line-height: 1;
}

.tag-remove:hover {
  opacity: 1;
}

.tags-input {
  border: none;
  outline: none;
  background: transparent;
  font-size: var(--fs-sm);
  color: var(--text-primary);
  min-width: 100px;
  flex: 1;
  padding: 2px 0;
}

.tags-input::placeholder {
  color: var(--text-tertiary);
}

/* Checkbox in editor */
.editor-checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  cursor: pointer;
  margin-top: var(--space-2);
}

.editor-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   5. Preview Area
   -------------------------------------------------------------------------- */
.editor-preview-area {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: var(--space-8);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background:
    radial-gradient(circle at 20% 20%, rgba(99,102,241,0.06) 0%, transparent 28%),
    var(--bg-primary);
  position: relative;
}

.editor-preview-area::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 50%, rgba(99,102,241,0.03) 0%, transparent 50%);
  pointer-events: none;
}

.preview-container {
  width: min(100%, 210mm);
  height: auto;
  background: white;
  box-shadow: 0 18px 55px rgba(15,23,42,0.16);
  border: 1px solid rgba(226,232,240,0.9);
  margin: 0 auto;
  position: relative;
  overflow: visible;
  display: flex;
  flex-direction: column;
  font-size: 11px;
  line-height: 1.5;
  z-index: 1;
}

/* For PDF generation - exact A4 */
.preview-container.pdf-mode {
  width: 794px;
  height: auto;
  min-height: auto;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
}

/* --------------------------------------------------------------------------
   6. My CVs Panel (Slide-in)
   -------------------------------------------------------------------------- */
.mycvs-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.mycvs-overlay.active {
  opacity: 1;
  visibility: visible;
}

.mycvs-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  background: var(--bg-card);
  border-left: 1px solid rgba(226,232,240,0.9);
  box-shadow: -20px 0 60px rgba(15,23,42,0.14);
  z-index: 201;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
  display: flex;
  flex-direction: column;
}

.mycvs-overlay.active + .mycvs-panel,
.mycvs-panel.active {
  transform: translateX(0);
}

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

.mycvs-header h3 {
  font-size: var(--fs-lg);
  font-weight: 700;
}

.mycvs-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.mycvs-empty {
  text-align: center;
  padding: var(--space-10);
  color: var(--text-tertiary);
}

.mycvs-empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.mycvs-empty p {
  font-size: var(--fs-sm);
}

.mycv-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mycv-card:hover {
  border-color: var(--primary-light);
  background: var(--bg-secondary);
}

.mycv-card.active {
  border-color: var(--primary);
  background: var(--primary-50);
}

[data-theme="dark"] .mycv-card.active {
  background: rgba(99,102,241,0.1);
}

.mycv-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.mycv-card-info {
  flex: 1;
  min-width: 0;
}

.mycv-card-name {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mycv-card-meta {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  margin-top: 2px;
}

.mycv-card-actions {
  display: flex;
  gap: var(--space-1);
}

.mycv-action-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  font-size: var(--fs-sm);
  transition: all var(--transition-fast);
}

.mycv-action-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.mycv-action-btn.delete:hover {
  background: rgba(239,68,68,0.1);
  color: var(--error);
}

.mycvs-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-color);
}

.mycvs-footer .btn {
  width: 100%;
}

/* --------------------------------------------------------------------------
   7. Toast Notifications
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  font-size: var(--fs-sm);
  color: var(--text-primary);
  animation: slideInRight 0.3s ease;
  min-width: 280px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }
.toast.info { border-left: 3px solid var(--info); }

.toast-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--error); }
.toast.info .toast-icon { color: var(--info); }

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(60px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* --------------------------------------------------------------------------
   8. PDF Download Progress
   -------------------------------------------------------------------------- */
.pdf-progress-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.pdf-progress-overlay.active {
  opacity: 1;
  visibility: visible;
}

.pdf-progress-card {
  background: var(--bg-card);
  border-radius: var(--radius-2xl);
  padding: var(--space-10);
  text-align: center;
  box-shadow: var(--shadow-2xl);
  min-width: 300px;
}


/* Font Selector */
.font-selector {
  position: relative;
}

.font-size-selector {
  position: relative;
}

.font-selector-input {
  padding: var(--space-2) var(--space-3);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  max-width: 180px;
}

#fontSizeSelector {
  max-width: 100px !important;
}

.font-selector-input:hover {
  border-color: var(--primary);
  background: var(--bg-card);
}

.font-selector-input:focus {
  border-color: var(--primary);
  background: var(--bg-card);
  outline: none;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.pdf-progress-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto var(--space-5);
}

.pdf-progress-text {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.pdf-progress-sub {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-2);
}

/* --------------------------------------------------------------------------
   9. PDF Mode Styling
   -------------------------------------------------------------------------- */
.pdf-mode {
  box-shadow: none !important;
  border: none !important;
  margin: 0 !important;
  padding: 0 !important;
  background: white !important;
  min-height: auto !important;
  display: block !important;
  page-break-after: auto !important;
  line-height: 1.5 !important;
  overflow: visible !important;
}

.pdf-mode * {
  background-clip: padding-box !important;
  box-shadow: none !important;
  page-break-inside: auto !important;
}

/* Allow dark backgrounds to render in PDF */
.pdf-mode div[style*="background:#1a1a2e"] {
  page-break-inside: avoid !important;
  page-break-before: auto !important;
}

.pdf-mode [style*="grid-template-columns"] {
  page-break-inside: avoid !important;
}

/* --------------------------------------------------------------------------
   10. Responsive Editor
   -------------------------------------------------------------------------- */
@media (max-width: 1200px) {
  .editor-body {
    grid-template-columns: 400px minmax(0, 1fr);
  }
}

@media (max-width: 1024px) {
  .editor-body {
    grid-template-columns: 360px minmax(0, 1fr);
  }

  .template-dropdown {
    width: 550px;
  }

  .template-dropdown-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .editor-preview-area {
    padding: var(--space-4);
  }
}

@media (max-width: 920px) {
  .editor-body {
    grid-template-columns: 1fr;
  }

  .editor-sidebar {
    width: 100%;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .editor-preview-area {
    min-height: 58vh;
    padding: var(--space-4);
  }

  .preview-container {
    width: min(100%, 794px);
    transform: none;
  }

  .toolbar-center {
    display: none;
  }
}

@media (max-width: 768px) {
  .template-dropdown {
    width: calc(100vw - 40px);
    left: 20px;
    transform: none;
  }

  .template-dropdown-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .mycvs-panel {
    width: 100%;
  }

  .color-presets {
    display: none;
  }
}

@media (max-width: 480px) {
  .editor-toolbar {
    padding: var(--space-2) var(--space-3);
    gap: var(--space-2);
  }

  .editor-toolbar {
    position: sticky;
    top: 0;
  }

  .toolbar-logo span {
    display: none;
  }

  .toolbar-left {
    gap: var(--space-2);
  }

  .cv-name-input {
    max-width: 120px;
  }

  .editor-sidebar {
    max-height: none;
  }

  .editor-section.open .editor-section-body {
    max-height: none;
  }
}

/* --------------------------------------------------------------------------
   10. Print Styles for PDF
   -------------------------------------------------------------------------- */
@media print {
  .editor-toolbar,
  .editor-sidebar,
  .toast-container,
  .mycvs-panel,
  .mycvs-overlay,
  .pdf-progress-overlay {
    display: none !important;
  }

  .editor-page {
    height: auto;
    overflow: visible;
  }

  .editor-body {
    display: block;
  }

  .editor-preview-area {
    padding: 0;
    overflow: visible;
  }

  .preview-container {
    width: 100%;
    box-shadow: none;
    border-radius: 0;
  }
}
