/* ==========================================================================
   Generador de CV Profesional - Estilos Globales, Temas y Renderizado A4
   Optimizado para Móviles (Smartphones), Tablets y PC
   ========================================================================== */

/* Variables Base del Sistema */
:root {
  /* UI de la Aplicación */
  --app-bg: #f8fafc;
  --app-surface: #ffffff;
  --app-border: #e2e8f0;
  --app-text: #0f172a;
  --app-text-muted: #64748b;
  --app-primary: #2563eb;
  --app-primary-hover: #1d4ed8;
  --app-danger: #ef4444;
  --app-success: #10b981;
  --app-warning: #f59e0b;
  --app-header-h: 60px;

  /* Variables del Tema para el CV (Tema por Defecto: Neutro) */
  --cv-primary: #1e293b;
  --cv-secondary: #475569;
  --cv-accent: #2563eb;
  --cv-text: #1e293b;
  --cv-muted: #64748b;
  --cv-bg-header: #f8fafc;
  --cv-border-color: #cbd5e1;
  --cv-border-width: 1px;
  --cv-border-radius: 4px;
  --cv-font-heading: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --cv-font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --cv-header-align: left;
  --cv-divider-style: solid;
}

/* ==========================================================================
   CATÁLOGO DE ESTILOS Y TEMAS DE CV
   ========================================================================== */

/* 1. Tema: Neutro (Ejecutivo Moderno) */
[data-theme="neutro"] {
  --cv-primary: #1e293b;
  --cv-secondary: #475569;
  --cv-accent: #0284c7;
  --cv-text: #1e293b;
  --cv-muted: #64748b;
  --cv-bg-header: #f8fafc;
  --cv-border-color: #cbd5e1;
  --cv-border-width: 1px;
  --cv-border-radius: 4px;
  --cv-font-heading: 'Inter', system-ui, -apple-system, sans-serif;
  --cv-font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --cv-header-align: left;
  --cv-divider-style: solid;
}

/* 2. Tema: Masculino (Sobrio y Azul Profundo) */
[data-theme="masculino"] {
  --cv-primary: #0f2942;
  --cv-secondary: #1e3a8a;
  --cv-accent: #0369a1;
  --cv-text: #0f172a;
  --cv-muted: #475569;
  --cv-bg-header: #edf2f7;
  --cv-border-color: #94a3b8;
  --cv-border-width: 2px;
  --cv-border-radius: 2px;
  --cv-font-heading: 'Segoe UI', -apple-system, 'Roboto', 'Arial', sans-serif;
  --cv-font-body: 'Segoe UI', -apple-system, 'Roboto', 'Arial', sans-serif;
  --cv-header-align: left;
  --cv-divider-style: solid;
}

/* 3. Tema: Femenino (Elegante y Rosa Suave) */
[data-theme="femenino"] {
  --cv-primary: #701a75;
  --cv-secondary: #86198f;
  --cv-accent: #be185d;
  --cv-text: #1f2937;
  --cv-muted: #6b7280;
  --cv-bg-header: #fdf2f8;
  --cv-border-color: #fbcfe8;
  --cv-border-width: 1px;
  --cv-border-radius: 8px;
  --cv-font-heading: 'Georgia', 'Cambria', 'Times New Roman', serif;
  --cv-font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --cv-header-align: center;
  --cv-divider-style: solid;
}

/* 4. Tema: Tech / Moderno (Esmeralda) */
[data-theme="moderno"] {
  --cv-primary: #0f172a;
  --cv-secondary: #047857;
  --cv-accent: #059669;
  --cv-text: #0f172a;
  --cv-muted: #475569;
  --cv-bg-header: #ecfdf5;
  --cv-border-color: #a7f3d0;
  --cv-border-width: 2px;
  --cv-border-radius: 6px;
  --cv-font-heading: 'Inter', system-ui, -apple-system, sans-serif;
  --cv-font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --cv-header-align: left;
  --cv-divider-style: solid;
}

/* 5. Tema: Creativo / Marketing (Cálido Coral) */
[data-theme="creativo"] {
  --cv-primary: #1c1917;
  --cv-secondary: #c2410c;
  --cv-accent: #ea580c;
  --cv-text: #292524;
  --cv-muted: #78716c;
  --cv-bg-header: #fff7ed;
  --cv-border-color: #fed7aa;
  --cv-border-width: 1.5px;
  --cv-border-radius: 12px;
  --cv-font-heading: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  --cv-font-body: 'Inter', system-ui, sans-serif;
  --cv-header-align: left;
  --cv-divider-style: solid;
}

/* 6. Tema: Editorial de Lujo (Serif) */
[data-theme="editorial"] {
  --cv-primary: #18181b;
  --cv-secondary: #27272a;
  --cv-accent: #b45309;
  --cv-text: #18181b;
  --cv-muted: #71717a;
  --cv-bg-header: #fafaf9;
  --cv-border-color: #d4d4d8;
  --cv-border-width: 1px;
  --cv-border-radius: 0px;
  --cv-font-heading: 'Georgia', 'Baskerville', 'Times New Roman', serif;
  --cv-font-body: 'Georgia', 'Baskerville', 'Times New Roman', serif;
  --cv-header-align: center;
  --cv-divider-style: solid;
}

/* 7. Tema: Académico / Formal (Verde Oxford) */
[data-theme="academico"] {
  --cv-primary: #1e3a5f;
  --cv-secondary: #14532d;
  --cv-accent: #15803d;
  --cv-text: #1e293b;
  --cv-muted: #64748b;
  --cv-bg-header: #f0fdf4;
  --cv-border-color: #bbf7d0;
  --cv-border-width: 1px;
  --cv-border-radius: 2px;
  --cv-font-heading: 'Palatino', 'Palatino Linotype', 'Book Antiqua', 'Georgia', serif;
  --cv-font-body: 'Palatino', 'Palatino Linotype', 'Book Antiqua', 'Georgia', serif;
  --cv-header-align: left;
  --cv-divider-style: solid;
}

/* 8. Tema: Nórdico / Minimalista (Azul Hielo) */
[data-theme="nordic"] {
  --cv-primary: #334155;
  --cv-secondary: #64748b;
  --cv-accent: #0284c7;
  --cv-text: #334155;
  --cv-muted: #94a3b8;
  --cv-bg-header: #f0f9ff;
  --cv-border-color: #e2e8f0;
  --cv-border-width: 1px;
  --cv-border-radius: 4px;
  --cv-font-heading: 'Inter', system-ui, -apple-system, sans-serif;
  --cv-font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --cv-header-align: left;
  --cv-divider-style: solid;
}

/* Toques de Layout por tema */
[data-theme="moderno"] .cv-header {
  border-left: 4px solid var(--cv-accent);
  padding-left: 14px;
}

[data-theme="editorial"] .cv-name {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

[data-theme="academico"] .cv-section-title {
  font-variant: small-caps;
  letter-spacing: 0.08em;
}

/* ==========================================================================
   RESET Y REGLAS BASE
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--app-bg);
  color: var(--app-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  width: 100%;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   CABECERA PRINCIPAL (HEADER)
   ========================================================================== */
.app-header {
  height: var(--app-header-h);
  background: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #ffffff;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.brand-text {
  min-width: 0;
}

.brand-text h1 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--app-text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-text p {
  font-size: 0.72rem;
  color: var(--app-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.badge-privacy {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 5px;
  background-color: #ecfdf5;
  color: #065f46;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.counter-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: #475569;
  background: #f8fafc;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
}

.counter-badge strong {
  color: #2563eb;
}

.btn-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   BOTONES
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--app-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--app-primary-hover);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-outline {
  background: transparent;
  border-color: var(--app-border);
  color: var(--app-text);
}

.btn-outline:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-danger {
  background: #fee2e2;
  border-color: #fecaca;
  color: #b91c1c;
}

.btn-danger:hover {
  background: #fca5a5;
  color: #991b1b;
}

.btn-sm {
  padding: 5px 8px;
  font-size: 0.78rem;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ==========================================================================
   PESTAÑAS MÓVILES (TABS FORM / PREVIEW)
   ========================================================================== */
.mobile-tabs {
  display: none;
  background: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
  padding: 6px 12px;
  gap: 8px;
  position: sticky;
  top: var(--app-header-h);
  z-index: 45;
  width: 100%;
}

.tab-btn {
  flex: 1;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--app-border);
  background: #f8fafc;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--app-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.tab-btn.active {
  background: var(--app-primary);
  color: #ffffff;
  border-color: var(--app-primary);
}

/* ==========================================================================
   CONTENEDOR PRINCIPAL SPLIT-SCREEN
   ========================================================================== */
.app-main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: calc(100vh - var(--app-header-h));
  height: calc(100dvh - var(--app-header-h));
  overflow: hidden;
  width: 100%;
}

/* ==========================================================================
   PANEL IZQUIERDO: FORMULARIO Y WIZARD
   ========================================================================== */
.form-pane {
  background: var(--app-surface);
  border-right: 1px solid var(--app-border);
  overflow-y: auto;
  padding: 24px;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  -webkit-overflow-scrolling: touch;
}

/* Stepper de Pasos */
.stepper-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  background: #f1f5f9;
  padding: 6px;
  border-radius: 10px;
  margin-bottom: 20px;
}

.step-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 4px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  background: transparent;
  border: none;
  transition: all 0.2s ease;
  user-select: none;
}

.step-item:hover {
  color: var(--app-text);
  background: rgba(255, 255, 255, 0.6);
}

.step-item.active {
  background: #ffffff;
  color: var(--app-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.step-item.completed .step-number {
  background-color: #10b981;
  color: #ffffff;
}

.step-number {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: #cbd5e1;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.step-item.active .step-number {
  background-color: var(--app-primary);
}

/* Paneles de cada Paso */
.step-pane {
  display: none;
  animation: fadeInStep 0.25s ease-out;
}

.step-pane.active {
  display: block;
}

@keyframes fadeInStep {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.step-header {
  margin-bottom: 18px;
  border-bottom: 1px solid var(--app-border);
  padding-bottom: 10px;
}

.step-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--app-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-subtitle {
  font-size: 0.82rem;
  color: var(--app-text-muted);
  margin-top: 4px;
}

/* Botones de Navegación de Pasos */
.step-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--app-border);
  gap: 10px;
}

/* ==========================================================================
   GALERÍA DE PLANTILLAS (PASO 1)
   ========================================================================== */
.theme-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 10px;
}

.theme-card {
  background: #ffffff;
  border: 2px solid var(--app-border);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  user-select: none;
}

.theme-card:hover {
  border-color: #93c5fd;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.theme-card.active {
  border-color: var(--app-primary);
  background: #f8fbff;
  box-shadow: 0 0 0 1px var(--app-primary), 0 4px 12px rgba(37, 99, 235, 0.12);
}

.theme-card-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--app-primary);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  display: none;
}

.theme-card.active .theme-card-badge {
  display: block;
}

/* Miniaturas Gráficas */
.mini-mockup {
  width: 100%;
  height: 105px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  position: relative;
  overflow: hidden;
}

.mini-bar {
  height: 6px;
  border-radius: 3px;
  margin-bottom: 5px;
}

.mini-line {
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  margin-bottom: 4px;
}

.mini-line.half { width: 55%; }
.mini-line.quarter { width: 35%; }
.mini-line.full { width: 85%; }

.mini-mockup[data-mockup="neutro"] .mini-bar { background: #1e293b; width: 65%; }
.mini-mockup[data-mockup="neutro"] { border-top: 3px solid #0284c7; }

.mini-mockup[data-mockup="masculino"] { border-top: 4px solid #0f2942; background: #fafbfc; }
.mini-mockup[data-mockup="masculino"] .mini-bar { background: #1e3a8a; width: 70%; height: 7px; }

.mini-mockup[data-mockup="femenino"] { border-top: 3px solid #be185d; text-align: center; }
.mini-mockup[data-mockup="femenino"] .mini-bar { background: #701a75; width: 50%; margin: 0 auto 5px; }
.mini-mockup[data-mockup="femenino"] .mini-line.half { margin: 0 auto 4px; }

.mini-mockup[data-mockup="moderno"] { border-left: 4px solid #059669; }
.mini-mockup[data-mockup="moderno"] .mini-bar { background: #0f172a; width: 60%; }

.mini-mockup[data-mockup="creativo"] { border: 1px solid #fed7aa; background: #fffaf5; border-radius: 8px; }
.mini-mockup[data-mockup="creativo"] .mini-bar { background: #ea580c; width: 65%; }

.mini-mockup[data-mockup="editorial"] { border: 1px solid #18181b; }
.mini-mockup[data-mockup="editorial"] .mini-bar { background: #18181b; width: 55%; margin: 0 auto 5px; }
.mini-mockup[data-mockup="editorial"] .mini-line.half { margin: 0 auto 4px; }

.mini-mockup[data-mockup="academico"] { border-bottom: 3px solid #14532d; }
.mini-mockup[data-mockup="academico"] .mini-bar { background: #1e3a5f; width: 70%; }

.mini-mockup[data-mockup="nordic"] { background: #f0f9ff; border: 1px solid #e0f2fe; }
.mini-mockup[data-mockup="nordic"] .mini-bar { background: #334155; width: 50%; }

.theme-card-info {
  display: flex;
  flex-direction: column;
}

.theme-card-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--app-text);
}

.theme-card-desc {
  font-size: 0.72rem;
  color: var(--app-text-muted);
  margin-top: 2px;
  line-height: 1.3;
}

/* Toolbar de utilidades */
.form-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--app-border);
}

.form-toolbar-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--app-text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.toolbar-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Placeholders de AdSense */
.adsense-placeholder {
  margin: 16px 0;
  padding: 14px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  text-align: center;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #64748b;
  position: relative;
  overflow: hidden;
}

.adsense-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  margin-bottom: 4px;
  font-weight: 600;
}

.adsense-content {
  font-size: 0.78rem;
  color: #64748b;
}

/* Secciones del Formulario */
.form-section {
  background: #ffffff;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--app-text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-desc {
  font-size: 0.78rem;
  color: var(--app-text-muted);
  margin-top: 2px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  margin-bottom: 12px;
}

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

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 4px;
}

/* Inputs y Textareas (con font-size 16px en mobile para prevenir zoom de Safari) */
.form-input, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--app-text);
  background-color: #ffffff;
  outline: none;
  font-family: inherit;
  transition: all 0.2s;
  box-sizing: border-box;
}

.form-input:focus, .form-textarea:focus {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

/* Dinámicos */
.dynamic-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dynamic-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 14px;
  position: relative;
  transition: border-color 0.2s;
}

.dynamic-card:hover {
  border-color: #cbd5e1;
}

.card-remove-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s;
}

.card-remove-btn:hover {
  color: var(--app-danger);
}

/* Tags de Habilidades */
.skills-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.skill-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e2e8f0;
  color: #1e293b;
  padding: 4px 9px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
}

.skill-tag-remove {
  cursor: pointer;
  color: #64748b;
  font-size: 1rem;
  line-height: 1;
}

.skill-tag-remove:hover {
  color: #ef4444;
}

/* Tarjeta Destacada de Descarga */
.final-download-card {
  background: linear-gradient(135deg, #eff6ff, #f0fdf4);
  border: 2px solid #bfdbfe;
  border-radius: 10px;
  padding: 20px 16px;
  text-align: center;
  margin-top: 18px;
}

.final-download-card h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #1e3a8a;
  margin-bottom: 6px;
}

.final-download-card p {
  font-size: 0.82rem;
  color: #475569;
  margin-bottom: 16px;
}

.final-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* SEO & Guía */
.seo-guide-section {
  background: #ffffff;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 20px 16px;
  margin-top: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.seo-guide-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--app-text);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.seo-guide-intro {
  font-size: 0.82rem;
  color: var(--app-text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.seo-accordion {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.seo-card {
  border: 1px solid var(--app-border);
  border-radius: 6px;
  overflow: hidden;
  background: #f8fafc;
}

.seo-card summary {
  padding: 10px 14px;
  font-weight: 600;
  font-size: 0.85rem;
  color: #1e293b;
  cursor: pointer;
  background: #f1f5f9;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.seo-card summary::-webkit-details-marker {
  display: none;
}

.seo-card summary::after {
  content: '▾';
  font-size: 1rem;
  color: #64748b;
  transition: transform 0.2s;
}

.seo-card[open] summary::after {
  transform: rotate(180deg);
}

.seo-card-content {
  padding: 14px;
  font-size: 0.82rem;
  color: #334155;
  line-height: 1.55;
  background: #ffffff;
}

.seo-card-content p {
  margin-bottom: 8px;
}

.seo-card-content ul {
  padding-left: 18px;
  margin-bottom: 8px;
}

.seo-card-content li {
  margin-bottom: 4px;
}

.seo-footer-links {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--app-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--app-text-muted);
}

.link-btn {
  background: none;
  border: none;
  color: var(--app-primary);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 500;
}

/* Modal de Privacidad */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-dialog {
  background: #ffffff;
  border-radius: 12px;
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--app-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--app-text);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  font-size: 0.82rem;
  line-height: 1.55;
  color: #334155;
}

.modal-body h4 {
  font-size: 0.9rem;
  color: #0f172a;
  margin: 12px 0 4px;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--app-border);
  display: flex;
  justify-content: flex-end;
}

/* ==========================================================================
   PANEL DERECHO: PREVISUALIZACIÓN EN VIVO (A4)
   ========================================================================== */
.preview-pane {
  background: #e2e8f0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: 100%;
  max-width: 100%;
}

.preview-controls {
  width: 100%;
  max-width: 210mm;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-size: 0.82rem;
  color: #475569;
}

.preview-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #ffffff;
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.zoom-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 3px 7px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.75rem;
  cursor: pointer;
}

.zoom-btn:hover {
  background: #f1f5f9;
}

.cv-paper-wrapper {
  transform-origin: top center;
  transition: transform 0.2s ease-out;
  margin: 0 auto;
  width: 210mm;
  display: flex;
  justify-content: center;
}

/* Documento A4 */
#cv-preview {
  width: 210mm;
  min-height: 297mm;
  padding: 20mm 18mm;
  margin: 0 auto;
  background: #ffffff;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  color: var(--cv-text);
  font-family: var(--cv-font-body);
  position: relative;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.cv-header {
  border-bottom: var(--cv-border-width) var(--cv-divider-style) var(--cv-border-color);
  padding-bottom: 16px;
  margin-bottom: 20px;
  text-align: var(--cv-header-align);
  transition: all 0.2s ease;
}

.cv-name {
  font-family: var(--cv-font-heading);
  font-size: 26pt;
  font-weight: 800;
  color: var(--cv-primary);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
  word-break: break-word;
  transition: color 0.2s ease;
}

.cv-title {
  font-family: var(--cv-font-heading);
  font-size: 13pt;
  font-weight: 600;
  color: var(--cv-secondary);
  margin-bottom: 12px;
  letter-spacing: 0.01em;
  transition: color 0.2s ease;
}

.cv-contact-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 9pt;
  color: var(--cv-muted);
  justify-content: var(--cv-header-align);
}

.cv-contact-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.cv-contact-item svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.cv-section {
  margin-bottom: 18px;
}

.cv-section-title {
  font-family: var(--cv-font-heading);
  font-size: 12pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--cv-primary);
  border-bottom: var(--cv-border-width) var(--cv-divider-style) var(--cv-border-color);
  padding-bottom: 4px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s ease;
}

.cv-section-title::after {
  content: '';
  flex: 1;
  height: var(--cv-border-width);
  background-color: var(--cv-border-color);
  display: inline-block;
}

.cv-summary {
  font-size: 9.5pt;
  line-height: 1.55;
  color: var(--cv-text);
  white-space: pre-line;
}

.cv-item {
  margin-bottom: 14px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.cv-item:last-child {
  margin-bottom: 0;
}

.cv-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}

.cv-item-title {
  font-size: 10.5pt;
  font-weight: 700;
  color: var(--cv-primary);
  transition: color 0.2s ease;
}

.cv-item-subtitle {
  font-size: 9.5pt;
  font-weight: 600;
  color: var(--cv-secondary);
  transition: color 0.2s ease;
}

.cv-item-date {
  font-size: 8.5pt;
  font-weight: 500;
  color: var(--cv-muted);
  white-space: nowrap;
}

.cv-item-desc {
  font-size: 9pt;
  line-height: 1.5;
  color: var(--cv-text);
  margin-top: 4px;
  white-space: pre-line;
}

.cv-skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.cv-skill-pill {
  font-size: 8.5pt;
  font-weight: 500;
  padding: 3px 10px;
  background-color: var(--cv-bg-header);
  border: 1px solid var(--cv-border-color);
  border-radius: var(--cv-border-radius);
  color: var(--cv-text);
  display: inline-block;
  transition: all 0.2s ease;
}

/* Overlay de Carga */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  color: #ffffff;
  backdrop-filter: blur(4px);
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 14px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   CSS ESPECÍFICO PARA IMPRESIÓN (PRINT)
   ========================================================================== */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .app-header,
  .mobile-tabs,
  .form-pane,
  .preview-controls,
  .loading-overlay,
  .adsense-placeholder,
  .seo-guide-section,
  .modal-overlay {
    display: none !important;
  }

  .app-main {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
  }

  .preview-pane {
    padding: 0 !important;
    background: transparent !important;
    overflow: visible !important;
  }

  .cv-paper-wrapper {
    transform: none !important;
  }

  #cv-preview {
    width: 210mm !important;
    min-height: 297mm !important;
    padding: 15mm !important;
    margin: 0 !important;
    box-shadow: none !important;
    border: none !important;
  }

  .cv-item {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  @page {
    size: A4 portrait;
    margin: 0;
  }
}

/* ==========================================================================
   OPTIMIZACIONES MÓVILES EXCLUSIVAS (< 1024px)
   Elimina cualquier descuadre, scroll horizontal o zoom no deseado
   ========================================================================== */
@media (max-width: 1024px) {
  :root {
    --app-header-h: 56px;
  }

  /* Cabecera compacta */
  .app-header {
    padding: 0 12px;
  }

  .brand-icon {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }

  .brand-text h1 {
    font-size: 0.95rem;
  }

  .brand-text p {
    display: none; /* Ocultar subtítulo para dar aire a los botones */
  }

  .counter-badge {
    display: none;
  }

  .btn-group .btn {
    padding: 6px 10px;
    font-size: 0.78rem;
  }

  /* Pestañas fijas de navegación móvil */
  .mobile-tabs {
    display: flex;
  }

  /* Contenedor sin scroll global trabado */
  .app-main {
    grid-template-columns: 1fr;
    height: calc(100vh - var(--app-header-h) - 49px);
    height: calc(100dvh - var(--app-header-h) - 49px);
  }

  /* Alternar vistas limpiamente */
  .form-pane {
    display: block;
    border-right: none;
    padding: 14px 12px 60px 12px;
    width: 100%;
    overflow-x: hidden;
  }

  .preview-pane {
    display: none;
    padding: 16px 8px 60px 8px;
    width: 100%;
    overflow-x: hidden;
  }

  body.view-preview .form-pane {
    display: none;
  }

  body.view-preview .preview-pane {
    display: flex;
  }

  /* Prevenir auto-zoom en iOS Safari asignando 16px a inputs */
  .form-input, .form-textarea {
    font-size: 16px !important;
    padding: 8px 10px;
  }

  /* Stepper optimizado para pantallas táctiles */
  .stepper-nav {
    gap: 4px;
    padding: 4px;
  }

  .step-item {
    padding: 6px 2px;
    font-size: 0.75rem;
    flex-direction: column;
    gap: 2px;
  }

  .step-text {
    font-size: 0.68rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .step-number {
    width: 20px;
    height: 20px;
    font-size: 0.72rem;
  }

  /* Galería de temas en cuadrícula exacta de 2 columnas */
  .theme-gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .mini-mockup {
    height: 85px;
    padding: 6px;
  }

  .theme-card {
    padding: 8px;
  }

  .theme-card-name {
    font-size: 0.78rem;
  }

  .theme-card-desc {
    font-size: 0.68rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Barra de herramientas compacta en 2x2 */
  .form-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .toolbar-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    width: 100%;
  }

  .toolbar-buttons .btn {
    padding: 6px 8px;
    font-size: 0.75rem;
    justify-content: center;
  }

  /* Botones de pasos cómodos para el pulgar */
  .step-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .step-actions .btn {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9rem;
  }

  .grid-2 {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .form-section {
    padding: 14px 12px;
    margin-bottom: 12px;
  }

  .final-actions {
    flex-direction: column;
    width: 100%;
  }

  .final-actions .btn {
    width: 100%;
  }
}
