/* ===========================================
   ARTEX RESUME BUILDER — DESIGN SYSTEM
   Premium, mobile-first, glassmorphism UI
   =========================================== */

/* --- Design Tokens --- */
:root {
  --primary: #7C3AED;
  --primary-hover: #6D28D9;
  --primary-light: #EDE9FE;
  --primary-muted: #A78BFA;
  --accent: #4F46E5;
  --success: #10B981;
  --success-light: #D1FAE5;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --danger: #EF4444;
  --danger-light: #FEE2E2;

  --bg-body: #F4F2EE;
  --bg-card: #FFFFFF;
  --bg-subtle: #F8F7F4;
  --bg-muted: #F1EFE9;

  --text-primary: #1A1A1A;
  --text-secondary: #52525B;
  --text-muted: #A1A1AA;
  --text-on-primary: #FFFFFF;

  --border: #E4E4E7;
  --border-light: #F0EDE8;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.1), 0 8px 24px rgba(0,0,0,0.06);

  --transition: 220ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

.hidden { display: none !important; }

/* --- Login Screen --- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(124,58,237,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(79,70,229,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(16,185,129,0.04) 0%, transparent 50%),
    var(--bg-body);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 48px 36px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-light);
  text-align: center;
  animation: fadeInUp 0.5s ease;
}

.login-card .logo-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-lg);
  object-fit: contain;
  margin: 0 auto 24px;
}

.login-card h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.login-card p {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.5;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 24px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  transition: var(--transition);
}

.btn-google:hover {
  background: var(--bg-subtle);
  border-color: #D4D4D8;
  box-shadow: var(--shadow-sm);
}

.btn-google svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* --- App Shell --- */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- App Header --- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
  padding: 0 24px;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.header-brand span {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-user .user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  border: 2px solid var(--primary-light);
}

.header-user .user-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.btn-sign-out {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: var(--transition);
}

.btn-sign-out:hover {
  color: var(--danger);
  border-color: var(--danger);
}

/* --- Step Progress Bar --- */
.step-progress {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 24px;
}

.step-progress-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.step-dot {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  background: var(--bg-muted);
  color: var(--text-muted);
  border: 2px solid transparent;
  transition: var(--transition);
  flex-shrink: 0;
  position: relative;
}

.step-dot.active {
  background: var(--primary);
  color: var(--text-on-primary);
  box-shadow: 0 0 0 4px rgba(124,58,237,0.15);
}

.step-dot.completed {
  background: var(--success);
  color: var(--text-on-primary);
}

.step-dot.completed::after {
  content: "✓";
  font-size: 16px;
}

.step-dot.completed span {
  display: none;
}

.step-connector {
  width: 60px;
  height: 3px;
  background: var(--bg-muted);
  transition: var(--transition);
  flex-shrink: 0;
}

.step-connector.completed {
  background: var(--success);
}

.step-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  margin-top: 6px;
}

.step-label.active {
  color: var(--primary);
  font-weight: 600;
}

.step-label.completed {
  color: var(--success);
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* --- Builder Layout --- */
.builder-layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 60px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 1024px) {
  .builder-layout {
    grid-template-columns: 1.15fr 0.85fr;
  }
}

/* --- Form Panel --- */
.form-panel {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.form-panel-inner {
  padding: 32px;
}

@media (max-width: 640px) {
  .form-panel-inner {
    padding: 20px;
  }
}

/* --- Form Sections --- */
.form-section {
  margin-bottom: 28px;
}

.form-section:last-child {
  margin-bottom: 0;
}

.form-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.form-section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section-title .icon {
  font-size: 20px;
}

.form-section-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
}

/* --- Form Grid --- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .form-grid.cols-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.form-grid .full-width {
  grid-column: 1 / -1;
}

/* --- Form Group --- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-subtle);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  color: var(--text-primary);
  transition: var(--transition);
  outline: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--primary-muted);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
  background: var(--bg-card);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

/* --- Dynamic Entry Cards --- */
.entry-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  transition: var(--transition);
}

.entry-card:hover {
  border-color: var(--border);
}

.entry-card .form-grid {
  gap: 12px;
}

.btn-remove-entry {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--danger-light);
  color: var(--danger);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-remove-entry:hover {
  background: var(--danger);
  color: white;
}

.btn-add-entry {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1.5px dashed var(--primary-muted);
  background: var(--primary-light);
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
  margin-top: 12px;
}

.btn-add-entry:hover {
  background: var(--primary);
  color: var(--text-on-primary);
  border-style: solid;
}

/* --- Entries List --- */
.entries-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* --- Photo Upload --- */
.photo-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 40px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
}

.photo-upload-area:hover {
  border-color: var(--primary-muted);
  background: var(--primary-light);
}

.photo-upload-area.has-photo {
  border-style: solid;
  border-color: var(--success);
  background: var(--success-light);
}

.photo-upload-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.photo-preview-img {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 4px solid var(--bg-card);
  box-shadow: var(--shadow-md);
  transition: border-radius 0.3s ease;
}

.photo-preview-img.square-shape {
  border-radius: var(--radius-md);
}

.photo-upload-text h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.photo-upload-text p {
  font-size: 13px;
  color: var(--text-muted);
}

.btn-skip-photo {
  padding: 10px 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

.btn-skip-photo:hover {
  background: var(--bg-muted);
}

/* --- Template Selection --- */
.template-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 640px) {
  .template-grid {
    grid-template-columns: 1fr;
  }
}

.tpl-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
  background: var(--bg-card);
  position: relative;
}

.tpl-card:hover {
  border-color: var(--primary-muted);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.tpl-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}

.tpl-card.selected::after {
  content: "✓";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  z-index: 2;
}

.tpl-card-preview {
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  position: relative;
  overflow: hidden;
}

.tpl-card-info {
  padding: 14px 16px;
  border-top: 1px solid var(--border-light);
}

.tpl-card-info h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.tpl-card-info p {
  font-size: 12px;
  color: var(--text-muted);
}

/* Template preview colors */
.tpl-preview-classic { background: #F8FAFC; color: #64748B; }
.tpl-preview-modern { background: linear-gradient(135deg, #EDE9FE, #E0E7FF); color: #6366F1; }
.tpl-preview-creative { background: linear-gradient(135deg, #FEE2E2, #FECDD3); color: #E11D48; }
.tpl-preview-minimal { background: linear-gradient(135deg, #E0F2FE, #DBEAFE); color: #0284C7; }
.tpl-preview-executive { background: #1E293B; color: #CBD5E1; }

/* Mini resume skeleton in template card */
.tpl-mini-resume {
  width: 90px;
  padding: 10px;
  background: white;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.tpl-mini-resume .mini-line {
  height: 3px;
  border-radius: 2px;
  background: #E2E8F0;
  margin-bottom: 4px;
}

.tpl-mini-resume .mini-line.title {
  width: 60%;
  height: 5px;
  background: #94A3B8;
}

.tpl-mini-resume .mini-line.short { width: 40%; }
.tpl-mini-resume .mini-line.medium { width: 70%; }
.tpl-mini-resume .mini-line.long { width: 90%; }

/* --- Preview Panel (Desktop Side) --- */
.preview-panel {
  display: none;
  position: sticky;
  top: 88px;
  align-self: start;
}

@media (min-width: 1024px) {
  .preview-panel {
    display: block;
  }
}

.preview-wrapper {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.preview-header .label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.preview-header .badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--success-light);
  color: var(--success);
  font-weight: 600;
}

.preview-scale-container {
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  aspect-ratio: 210 / 297;
  position: relative;
  background: white;
}

.preview-scale-inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 794px;
  transform-origin: top left;
}

/* --- Step 4 Full Preview --- */
.full-preview-container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  aspect-ratio: 210 / 297;
  position: relative;
  background: white;
}

.full-preview-inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 794px;
  min-height: 1123px;
  overflow: visible;
  transform-origin: top left;
}

/* The customer preview can contain two physical A4 page frames. */
.full-preview-inner .print-preview-page + .print-preview-page {
  border-top: 1px solid #CBD5E1;
}

.page-indicator {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 12;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

/* --- Navigation Buttons --- */
.step-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-subtle);
}

@media (max-width: 640px) {
  .step-nav {
    padding: 16px 20px;
  }
}

.btn-prev,
.btn-next,
.btn-generate {
  padding: 12px 28px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  border: none;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-prev {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
}

.btn-prev:hover {
  background: var(--bg-muted);
  border-color: #D4D4D8;
}

.btn-next {
  background: var(--text-primary);
  color: var(--text-on-primary);
}

.btn-next:hover {
  background: #333;
}

.btn-generate {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: var(--text-on-primary);
  padding: 14px 32px;
  font-size: 16px;
}

.btn-generate:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(124,58,237,0.3);
}

.btn-generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* --- Ref ID Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

.ref-modal {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  text-align: center;
  box-shadow: var(--shadow-xl);
  animation: scaleIn 0.3s ease;
}

.ref-modal .success-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: var(--success-light);
  color: var(--success);
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.ref-modal h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 8px;
}

.ref-modal .ref-description {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.6;
}

.ref-id-display {
  font-size: 36px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 2px;
  padding: 16px 24px;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-family: 'Inter', monospace;
}

.btn-copy-ref {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 24px;
}

.btn-copy-ref:hover {
  background: var(--bg-subtle);
}

.ref-instructions {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  padding: 16px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.btn-close-modal {
  padding: 12px 32px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--text-primary);
  color: var(--text-on-primary);
  font-size: 15px;
  font-weight: 600;
  transition: var(--transition);
}

.btn-close-modal:hover {
  background: #333;
}

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  color: white;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--accent); }

/* --- Auto-save Indicator --- */
.auto-save-badge {
  position: fixed;
  top: 76px;
  right: 24px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background: var(--success);
  color: white;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 60;
  animation: fadeInRight 0.3s ease, fadeOut 0.3s ease 1.7s forwards;
  box-shadow: var(--shadow-md);
}

/* --- Cooldown Timer --- */
.cooldown-text {
  font-size: 13px;
  color: var(--warning);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* --- Rate Limit Banner --- */
.rate-limit-banner {
  padding: 16px 24px;
  background: var(--warning-light);
  border: 1px solid #FCD34D;
  border-radius: var(--radius-md);
  color: #92400E;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  margin-bottom: 20px;
}

/* --- Honeypot --- */
.hp-field {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  width: 0;
  overflow: hidden;
}

/* --- Resume Page (template render) --- */
.resume-page {
  width: 794px;
  min-height: 1123px;
  background: white;
  font-family: 'Inter', sans-serif;
  color: #1A1A1A;
  line-height: 1.5;
}

/* --- Step Content Animation --- */
.step-content {
  animation: fadeInUp 0.3s ease;
}

/* --- Step Title --- */
.step-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.step-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* --- Keyframes --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: var(--radius-full);
  animation: spin 0.7s linear infinite;
}

/* --- Mobile Preview Toggle --- */
.btn-mobile-preview {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: white;
  border: none;
  font-size: 22px;
  box-shadow: var(--shadow-lg);
  z-index: 40;
  transition: var(--transition);
}

.btn-mobile-preview:hover {
  transform: scale(1.05);
}

@media (max-width: 1023px) {
  .btn-mobile-preview {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* --- Mobile Preview Modal --- */
.mobile-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

.mobile-preview-content {
  width: 100%;
  max-width: 360px;
  max-height: 80vh;
  overflow-y: auto;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  position: relative;
}

.mobile-preview-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: none;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  cursor: pointer;
}

/* --- Print Styles --- */
@media print {
  body * { visibility: hidden; }
  .resume-page, .resume-page * { visibility: visible; }
  .resume-page {
    position: absolute;
    left: 0;
    top: 0;
    width: 210mm;
    min-height: 297mm;
  }
}

/* ============================================
   NEW FEATURES — AI SCAN, PHOTO CONTROLS,
   COLOR THEMES
   ============================================ */

/* --- AI Scan Section (Step 1) --- */
.ai-scan-section {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(124,58,237,0.06), rgba(79,70,229,0.06));
  border: 1.5px solid rgba(124,58,237,0.15);
  border-radius: var(--radius-lg);
}

.btn-ai-scan {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: var(--transition);
  box-shadow: 0 2px 12px rgba(124,58,237,0.25);
}

.btn-ai-scan:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(124,58,237,0.35);
}

.ai-scan-hint {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

@media (max-width: 640px) {
  .ai-scan-section {
    flex-direction: column;
    text-align: center;
  }
}

/* --- AI Scan Modal --- */
.ai-scan-modal-card {
  width: 100%;
  max-width: 520px;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  box-shadow: var(--shadow-xl);
  animation: scaleIn 0.3s ease;
  position: relative;
}

.ai-scan-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.ai-scan-close:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.ai-scan-modal-header {
  text-align: center;
  margin-bottom: 24px;
}

.ai-scan-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-light), rgba(79,70,229,0.15));
  color: var(--primary);
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.ai-scan-modal-header h2 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 6px;
}

.ai-scan-modal-header p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.ai-scan-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-subtle);
  position: relative;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-scan-upload-area:hover {
  border-color: var(--primary-muted);
  background: var(--primary-light);
}

.ai-scan-upload-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ai-scan-upload-inner h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.ai-scan-upload-inner p {
  font-size: 13px;
  color: var(--text-muted);
}

.ai-scan-preview {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius-md);
  object-fit: contain;
}

.ai-scan-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  margin-top: 16px;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--primary);
  font-weight: 500;
}

.ai-scan-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(124,58,237,0.2);
  border-top-color: var(--primary);
  border-radius: var(--radius-full);
  animation: spin 0.7s linear infinite;
}

.ai-scan-error {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--danger-light);
  border-radius: var(--radius-md);
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
}

.ai-scan-actions {
  margin-top: 20px;
  text-align: center;
}

.btn-start-scan {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  transition: var(--transition);
}

.btn-start-scan:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(124,58,237,0.3);
}

.btn-start-scan:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* --- Photo Controls (Step 2) --- */
.photo-controls {
  margin-top: 24px;
  padding: 20px 24px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
}

.photo-control-group {
  margin-bottom: 16px;
}

.photo-control-group:last-child {
  margin-bottom: 0;
}

.photo-control-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: block;
}

.photo-slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slider-label-sm {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.photo-size-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
}

.photo-size-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(124,58,237,0.3);
  transition: var(--transition);
}

.photo-size-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.photo-size-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  min-width: 44px;
  text-align: right;
}

.photo-shape-toggle {
  display: flex;
  gap: 8px;
}

.shape-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
}

.shape-btn:hover {
  border-color: var(--primary-muted);
}

.shape-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.shape-icon {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  display: inline-block;
}

.shape-icon.circle-icon {
  border-radius: var(--radius-full);
}

.shape-icon.square-icon {
  border-radius: 3px;
}

/* --- Color Theme Picker (Step 3) --- */
.color-theme-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}

.color-theme-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.color-theme-title i {
  color: var(--primary-muted);
}

.color-swatch-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 3px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.color-swatch:hover {
  transform: scale(1.12);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.color-swatch.selected {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.1);
  transform: scale(1.1);
}

.color-swatch.selected::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
