/* Google Fonts Import - Fontes modernas */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ==========================================================================
   GERADOR DE CURRÍCULO PDF - DESIGN SYSTEM MODERNO
   ========================================================================== */

/* Modern Design System Variables */
:root {
  /* Layout */
  --header-height: 60px;
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --border-radius-lg: 16px;
  
  /* Colors - Modern gradient palette */
  --primary-50: #f0f9ff;
  --primary-100: #e0f2fe;
  --primary-200: #bae6fd;
  --primary-300: #7dd3fc;
  --primary-400: #38bdf8;
  --primary-500: #0ea5e9;
  --primary-600: #0284c7;
  --primary-700: #0369a1;
  --primary-800: #075985;
  --primary-900: #0c4a6e;
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-success: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
  
  /* Neutral colors */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  
  /* Spacing system */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  
  /* Typography */
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  
  /* Font sizes - Sistema consistente */
  --text-xs: 0.7rem;    /* 11.2px */
  --text-sm: 0.8rem;    /* 12.8px */
  --text-base: 0.875rem; /* 14px - Base padrão */
  --text-md: 0.9rem;    /* 14.4px */
  --text-lg: 1rem;      /* 16px */
  --text-xl: 1.125rem;  /* 18px */
  --text-2xl: 1.25rem;  /* 20px */
  --text-3xl: 1.5rem;   /* 24px */
  
  /* Transitions */
  --transition-fast: 0.15s ease-out;
  --transition: 0.2s ease-out;
  --transition-slow: 0.3s ease-out;
}

/* Reset e Modern Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

body {
  font-family: var(--font-sans);
  background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
  color: var(--gray-800);
  line-height: 1.6;
  font-weight: 400;
  font-size: var(--text-base); /* 14px padrão */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Prevenir scroll do body quando modal está aberto */
body.modal-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* ==========================================================================
   LAYOUT PRINCIPAL
   ========================================================================== */

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header - Modern glassmorphism design */
.header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding: var(--space-3) 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  min-height: var(--header-height);
  flex-shrink: 0;
  transition: var(--transition);
}

.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--gradient-primary);
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: 0 0 auto;
  min-width: 0;
}

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

/* Desktop language selector - discrete flag button */
.desktop-language-selector {
  display: flex;
  align-items: center;
  margin-right: 1rem;
  margin-left: 1rem;
}

.desktop-lang-toggle {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  border-radius: var(--border-radius);
  transition: var(--transition);
  opacity: 0.6;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.desktop-lang-toggle:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.05);
  transform: scale(1.05);
}

.desktop-lang-toggle:active {
  transform: scale(0.98);
}

/* Hide desktop selector on mobile */
@media (max-width: 768px) {
  .desktop-language-selector {
    display: none;
  }
}

/* Language selector - oculto no desktop, visível apenas no mobile */
.language-selector {
  position: relative;
  display: none; /* Oculto no desktop */
  align-items: center;
}

.lang-select {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-700);
  cursor: pointer;
  transition: var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1rem;
  padding-right: 2.5rem;
}

.lang-select:hover {
  border-color: var(--primary-300);
  background-color: white;
  box-shadow: var(--shadow-sm);
}

.lang-select:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.lang-select option {
  padding: var(--space-2);
  font-weight: 500;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-800);
  transition: var(--transition);
  flex: 0 0 auto;
}

.logo:hover {
  transform: translateY(-1px);
}

.logo i {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 1.5rem;
  transition: var(--transition);
}

.mobile-controls {
  display: none;
  align-items: center;
  gap: 0.5rem;
}

.mobile-view-toggle {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: #64748b;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 4px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-view-toggle:hover {
  background: #f1f5f9;
  color: #3b82f6;
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: #64748b;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
  background: #f1f5f9;
  color: #3b82f6;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
  flex: 1;
  overflow-x: auto;
  min-width: 0;
}

/* Botões do header com espaço otimizado */
.header-actions .btn {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  white-space: nowrap;
  min-width: auto;
  flex: 0 0 auto;
}

/* Main Content - Com scroll natural */
.main {
  display: flex;
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  overflow: visible;
}

/* ==========================================================================
   COMPONENTES REUTILIZÁVEIS
   ========================================================================== */

/* Buttons */
/* Modern Button System */
.btn {
  padding: var(--space-3) var(--space-6);
  border: none;
  border-radius: var(--border-radius);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-base); /* Padronizado */
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  font-family: var(--font-sans);
}

/* Mobile language button - hidden on desktop by default */
.mobile-lang-btn {
  display: none;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: var(--transition);
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

.btn-primary:active {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.9);
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--gray-300);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Botão mobile - escondido por padrão */
.mobile-toggle {
  display: none;
}

@media (max-width: 600px) {
  .header-actions {
    gap: 0.2rem;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100%;
    padding: 0 0.5rem;
  }
  
  .btn {
    font-size: 0.6rem;
    padding: 0.3rem 0.4rem;
    min-width: calc(33.333% - 0.133rem);
    flex: 0 0 calc(33.333% - 0.133rem);
    margin-bottom: 0.2rem;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    height: 32px;
    box-sizing: border-box;
  }
  
  /* Botões da segunda linha (últimos 2) ocupam menos espaço e ficam centralizados */
  .btn:nth-last-child(-n+2) {
    min-width: calc(40% - 0.1rem);
    flex: 0 0 calc(40% - 0.1rem);
  }
  
  .btn span {
    display: inline;
    visibility: visible;
    font-size: 0.6rem;
    line-height: 1;
  }
  
  .btn i {
    display: inline;
    visibility: visible;
    flex-shrink: 0;
    font-size: 0.65rem !important;
    width: 10px;
    text-align: center;
  }
}

.mobile-toggle.active {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

/* Section Headers */
.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.25rem;
}

.section-subtitle {
  font-size: 0.9rem;
  color: #64748b;
}

.markdown-help {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: #94a3b8;
  font-style: italic;
}

.tips-section {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tip-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #64748b;
  padding: 0.375rem 0.5rem;
  background: #f8fafc;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

.tip-item i {
  color: #3b82f6;
  font-size: 0.9rem;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}

/* ==========================================================================
   EDITOR SECTION
   ========================================================================== */

/* Modern Editor Section */
.editor-section {
  width: 50%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: visible;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.editor-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
  opacity: 0.7;
}

.editor {
  flex: 1;
  border: none;
  resize: none;
  padding: var(--space-6);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.7;
  outline: none;
  background: transparent;
  color: var(--gray-800);
  overflow-y: auto;
  transition: var(--transition);
}

.editor:focus {
  background: rgba(255, 255, 255, 0.5);
}

.editor::placeholder {
  color: var(--gray-400);
  font-style: italic;
}

.editor-control {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-6);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.75rem;
  flex-wrap: wrap;
  justify-content: space-between;
  height: 54px; /* Força altura exata igual ao margin-control */
  box-sizing: border-box;
  box-shadow: var(--shadow-sm);
}

.editor-label {
  font-weight: 500;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.editor-label i {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.editor-info {
  color: var(--gray-500);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.editor-info i {
  color: var(--gray-400);
}

.editor-counter {
  color: #64748b;
  font-weight: 500;
  margin-left: auto;
}

/* ==========================================================================
   PREVIEW SECTION
   ========================================================================== */

/* Modern Preview Section */
.preview-section {
  width: 50%;
  background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: visible;
  position: relative;
}

.preview-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-secondary);
  opacity: 0.7;
}

.margin-control {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-6);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.75rem;
  flex-wrap: wrap;
  justify-content: space-between;
  height: 54px; /* Força altura exata igual ao editor-control */
  box-sizing: border-box;
  box-shadow: var(--shadow-sm);
}

.margin-label {
  font-weight: 500;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.margin-label i {
  background: var(--gradient-secondary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  justify-content: center;
}

.control-label {
  font-weight: 500;
  color: var(--gray-600);
  font-size: 0.75rem;
}

.advanced-toggle {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius-sm);
  padding: var(--space-2);
  cursor: pointer;
  color: var(--gray-600);
  transition: all var(--transition);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.advanced-toggle:hover {
  background: rgba(255, 255, 255, 0.95);
  color: var(--primary-600);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.advanced-toggle.active {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
}

.advanced-options {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  overflow: hidden;
  max-height: 0;
  transition: all 0.3s ease;
}

.advanced-options.open {
  max-height: 60px;
}

.advanced-content {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.font-label {
  font-weight: 500;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.font-label i {
  color: #3b82f6;
}

/* Mobile PDF Controls - Escondido por padrão */
.mobile-pdf-controls {
  display: none;
}

@media (min-width: 769px) {
  .desktop-controls {
    display: flex !important;
  }
  
  .mobile-pdf-controls {
    display: none !important;
  }
}

.mobile-pdf-toggle {
  width: 100%;
  background: white;
  border: none;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 500;
  color: #1e293b;
  transition: all 0.2s;
  min-height: 49px;
  box-sizing: border-box;
}

.mobile-pdf-toggle:hover {
  background: #f8fafc;
}

.mobile-pdf-toggle.active {
  background: #f1f5f9;
  color: #3b82f6;
}

.mobile-pdf-toggle .toggle-arrow {
  transition: transform 0.3s ease;
  font-size: 0.7rem;
  color: #64748b;
}

.mobile-pdf-toggle.active .toggle-arrow {
  transform: rotate(180deg);
  color: #3b82f6;
}

.mobile-pdf-content {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: all 0.3s ease;
}

.mobile-pdf-content.open {
  max-height: 160px;
  opacity: 1;
}

.mobile-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.mobile-control-row:last-child {
  border-bottom: none;
}

.mobile-control-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
  flex: 1;
}

.mobile-control-buttons {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.mobile-control-buttons .margin-btn {
  width: 20px;
  height: 20px;
  font-size: 0.7rem;
}

.mobile-control-buttons .margin-value,
.mobile-control-buttons .font-size-value {
  font-size: 0.7rem;
  min-width: 22px;
  text-align: center;
}

.mobile-font-selector {
  padding: 0.3rem 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: white;
  color: #64748b;
  font-size: 0.7rem;
  cursor: pointer;
  min-width: 120px;
}

.font-separator {
  color: var(--gray-300);
  margin: 0 var(--space-2);
  font-weight: 300;
}

/* Modern Form Controls */
.font-selector {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  color: var(--gray-700);
  font-size: 0.85rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right var(--space-2) center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: var(--space-8);
}

.font-selector:hover {
  border-color: var(--primary-400);
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.font-selector:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Modern Control Buttons */
.margin-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius-sm);
  background: rgba(255, 255, 255, 0.9);
  color: var(--gray-600);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.margin-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: var(--gradient-primary);
  border-radius: 50%;
  transition: all var(--transition-fast);
  transform: translate(-50%, -50%);
  z-index: 0;
}

.margin-btn:hover::before {
  width: 100%;
  height: 100%;
}

.margin-btn:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--primary-400);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  z-index: 1;
}

.margin-btn span,
.margin-btn:hover span {
  position: relative;
  z-index: 2;
}

.margin-value,
.font-size-value {
  min-width: 45px;
  text-align: center;
  font-weight: 600;
  color: var(--gray-700);
  background: rgba(255, 255, 255, 0.7);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--border-radius-sm);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  transition: var(--transition);
}

.preview-container {
  flex: 1;
  overflow-y: auto;
  background: #e5e7eb;
  min-height: 0;
}

.preview-pages {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  width: 100%;
  min-height: min-content;
  padding-bottom: 1rem;
}

/* ==========================================================================
   PAPER PREVIEW (A4 Pages)
   ========================================================================== */

/* Modern Preview Paper */
.preview-paper {
  max-width: 100%;
  width: 210mm;
  min-height: 297mm;
  background: white;
  margin: var(--space-8) auto;
  box-shadow: var(--shadow-2xl);
  border-radius: var(--border-radius);
  font-family: var(--font-sans);
  font-size: 11px;
  line-height: 1.5;
  color: var(--gray-800);
  transition: all var(--transition-slow);
  position: relative;
  page-break-inside: avoid;
  box-sizing: border-box;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.preview-paper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
  opacity: 0.8;
}

.preview-paper:hover {
  transform: translateY(-2px);
  box-shadow: 0 32px 64px -12px rgb(0 0 0 / 0.25);
}

.preview-paper > div:first-child {
  padding: var(--pdf-margin, 4mm);
  box-sizing: border-box;
  min-height: calc(297mm - (var(--pdf-margin, 4mm) * 2));
  /* Mesmos estilos que o PDF */
  font-family: inherit;
  font-size: inherit; /* Herda do .preview-paper */
  line-height: 1.5;
  color: #1e293b;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.preview-paper * {
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* ==========================================================================
   FONT FAMILIES - CURRICULUM STYLES
   ========================================================================== */

.font-system {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.font-times {
  font-family: 'Times New Roman', Times, serif !important;
}

.font-georgia {
  font-family: Georgia, serif !important;
}

.font-arial {
  font-family: Arial, sans-serif !important;
}

.font-helvetica {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
}

.font-calibri {
  font-family: Calibri, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

.font-garamond {
  font-family: 'EB Garamond', Garamond, serif !important;
}

.font-playfair {
  font-family: 'Playfair Display', Georgia, serif !important;
}

.font-lato {
  font-family: 'Lato', 'Helvetica Neue', Arial, sans-serif !important;
}

.font-opensans {
  font-family: 'Open Sans', -apple-system, sans-serif !important;
}

.font-montserrat {
  font-family: 'Montserrat', 'Helvetica Neue', sans-serif !important;
}

.font-sourceserif {
  font-family: 'Source Serif Pro', Georgia, serif !important;
}

.font-roboto {
  font-family: 'Roboto', -apple-system, sans-serif !important;
}

.font-inter {
  font-family: 'Inter', -apple-system, sans-serif !important;
}

.font-crimson {
  font-family: 'Crimson Text', Georgia, serif !important;
}

.page-indicator {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(107, 114, 128, 0.9);
  color: white;
  padding: 3px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 500;
  backdrop-filter: blur(4px);
  z-index: 10;
}

.page-overflow-warning {
  background: #fef3c7;
  border: 2px solid #f59e0b;
  border-radius: 8px;
  padding: 1rem;
  margin-top: 1rem;
  text-align: center;
  color: #92400e;
  font-weight: 500;
}

.page-overflow-warning i {
  margin-right: 0.5rem;
  color: #f59e0b;
}

/* ==========================================================================
   TYPOGRAPHY - CV CONTENT STYLES (Sincronizado com PDF)
   ========================================================================== */

.preview-paper h1 {
  font-size: 18px; /* Mesmo que o PDF */
  font-weight: 700;
  color: #111827;
  margin: 0 0 8px 0;
  border-bottom: 2px solid #3b82f6; /* Mesma cor do PDF */
  padding-bottom: 6px;
  line-height: 1.2;
  page-break-after: avoid;
}

.preview-paper h2 {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 16px 0 8px 0;
  border-bottom: 1px solid #d1d5db;
  padding-bottom: 4px;
  line-height: 1.2;
  page-break-after: avoid;
  page-break-inside: avoid;
}

.preview-paper h3 {
  font-size: 12px;
  font-weight: 600;
  color: #111827;
  margin: 12px 0 4px 0;
  line-height: 1.3;
  page-break-after: avoid;
  page-break-inside: avoid;
}

.preview-paper p {
  margin: 6px 0; /* Mesmo que o PDF */
  text-align: justify;
  line-height: 1.5;
}

.preview-paper ul {
  margin: 8px 0 12px 20px;
  padding: 0;
  list-style-type: disc;
  page-break-inside: avoid;
}

.preview-paper ol {
  margin: 8px 0 12px 20px;
  padding: 0;
  page-break-inside: avoid;
}

.preview-paper li {
  margin: 3px 0;
  padding-left: 2px;
  line-height: 1.4;
  page-break-inside: avoid;
}

.preview-paper li p {
  margin: 2px 0;
}

.preview-paper strong,
.preview-paper b {
  font-weight: 600;
  color: #111827;
}

.preview-paper em,
.preview-paper i {
  color: #4b5563; /* Mesma cor do PDF */
  font-style: italic;
}

.preview-paper a {
  color: #3b82f6;
  text-decoration: none;
}

.preview-paper a:hover {
  text-decoration: underline;
}

.preview-paper hr {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 16px 0;
}

.preview-paper blockquote {
  margin: 12px 0;
  padding: 8px 16px;
  border-left: 4px solid #d1d5db;
  background-color: #f9fafb;
  color: #4b5563;
  font-style: italic;
}

.preview-paper code {
  background-color: #f3f4f6;
  color: #374151;
  padding: 2px 4px;
  border-radius: 3px;
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 10px;
}

.preview-paper pre {
  background-color: #f3f4f6;
  color: #374151;
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 12px 0;
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 10px;
  line-height: 1.4;
}

.preview-paper table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}

.preview-paper th,
.preview-paper td {
  border: 1px solid #d1d5db;
  padding: 6px 8px;
  text-align: left;
}

.preview-paper th {
  background-color: #f3f4f6;
  font-weight: 600;
}

/* ==========================================================================
   LOADING MODAL
   ========================================================================== */

.loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading.show {
  display: flex;
}

.loading-content {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f3f4f6;
  border-top: 3px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ==========================================================================
   SCROLLBAR CUSTOMIZATION
   ========================================================================== */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 1024px) {
  .main {
    flex-direction: column;
  }
  
  .editor-section,
  .preview-section {
    width: 100%;
  }
  
  .editor-section {
    min-height: 50vh;
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
  }
  
  .preview-section {
    min-height: 50vh;
  }
  
  .preview-container {
    padding: 1rem;
    max-height: none;
  }
  
  .preview-pages {
    gap: 1.5rem;
  }
  
  .preview-paper {
    width: 100% !important;
    height: 0 !important;
    padding-bottom: 141.42% !important; /* Força proporção A4: 297/210 = 141.42% */
  }

  .preview-paper > div:first-child {
    top: var(--pdf-margin, 8mm);
    left: var(--pdf-margin, 8mm);
    right: var(--pdf-margin, 8mm);
    bottom: var(--pdf-margin, 8mm);
  }

  /* Esconder o botão mobile em tablets */
  .mobile-toggle {
    display: none;
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 60px;
  }
  
  .header-content {
    padding: 0 1rem;
    gap: 0;
    flex-direction: column;
  }
  
  .header-top {
    width: 100%;
    justify-content: space-between;
  }
  
  .logo {
    font-size: 1.1rem;
  }
  
  .logo i {
    font-size: 1rem;
  }
  
  .mobile-controls {
    display: flex;
  }
  
  .header-controls {
    gap: var(--space-2);
  }
  
  .lang-select {
    font-size: var(--text-xs);
    padding: var(--space-1) var(--space-2);
    padding-right: 1.5rem;
  }
  
  .mobile-menu-toggle {
    display: block;
  }
  
  .header-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.2rem;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: all 0.3s ease;
    padding: 0;
  }
  
  .header-actions.mobile-open {
    max-height: 200px; /* Reduzido já que não tem mais language selector */
    opacity: 1;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
    margin-top: 0.5rem;
  }
  
  /* Quando o menu está aberto, ajustar altura das seções */
  body.mobile-menu-open .main {
    min-height: calc(100vh - var(--header-height) - 180px);
  }
  
  .preview-container {
    padding: 0;
    background: #f8fafc;
  }

  .preview-pages {
    padding: 0.5rem 0;
    gap: 0;
  }

  /* Mostrar botão mobile apenas no celular */
  .mobile-toggle {
    display: inline-flex !important;
    order: -1; /* Coloca o botão primeiro */
    flex-shrink: 0;
  }

  /* Botões pequenos e compactos no mobile - 3 por linha */
  .header-actions .btn {
    font-size: 0.6rem !important;
    padding: 0.3rem 0.4rem !important;
    min-width: calc(33.333% - 0.133rem) !important;
    flex: 0 0 calc(33.333% - 0.133rem) !important;
    margin-bottom: 0.2rem !important;
    height: 32px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.25rem !important;
    box-sizing: border-box !important;
  }

  .header-actions .btn span {
    display: inline !important;
    visibility: visible !important;
    font-size: 0.6rem !important;
    line-height: 1 !important;
  }

  .header-actions .btn i {
    font-size: 0.65rem !important;
    flex-shrink: 0 !important;
    width: 10px !important;
    text-align: center !important;
  }

  /* Botão toggle (visualizar/editar) - texto visível */
  .mobile-toggle #toggleText {
    display: inline !important;
  }

  /* Mobile language button - visible only on mobile */
  .mobile-lang-btn {
    display: inline-flex !important;
  }

  /* Layout mobile - seções com altura natural */
  .main {
    flex-direction: column;
    min-height: calc(100vh - var(--header-height));
    position: relative;
    overflow: hidden;
  }
  
  /* Controles do editor no mobile */
  .editor-control {
    font-size: 0.7rem;
    padding: 0.4rem 0.8rem;
    min-height: 44px;
  }
  
  .editor-info {
    display: none; /* Oculta a dica no mobile para economizar espaço */
  }
  
  /* Controles do preview no mobile */
  .desktop-controls {
    display: none; /* Oculta controles desktop no mobile */
  }
  
  .mobile-pdf-controls {
    display: block; /* Mostra controles mobile */
  }
  
  .advanced-options {
    display: none; /* Oculta opções avançadas desktop no mobile */
  }
  
  .editor-section,
  .preview-section {
    width: 100%;
    height: calc(100vh - var(--header-height));
    border-right: none;
    border-bottom: none;
    transition: opacity 0.3s ease-in-out;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
  }
  
  /* Estado inicial - mostrar apenas editor */
  .editor-section {
    display: flex;
    opacity: 1;
    z-index: 2;
    pointer-events: auto;
  }

  .preview-section {
    display: flex;
    opacity: 0;
    z-index: 1;
    pointer-events: none;
  }

  /* Classes para controlar visibilidade com animação */
  .mobile-show-editor .editor-section {
    opacity: 1;
    z-index: 2;
    pointer-events: auto;
  }

  .mobile-show-editor .preview-section {
    opacity: 0;
    z-index: 1;
    pointer-events: none;
  }

  .mobile-show-preview .editor-section {
    opacity: 0;
    z-index: 1;
    pointer-events: none;
  }

  .mobile-show-preview .preview-section {
    opacity: 1;
    z-index: 2;
    pointer-events: auto;
  }
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  body {
    background: white !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  .header, 
  .editor-section, 
  .margin-control, 
  .page-overflow-warning {
    display: none !important;
  }
  
  .main {
    max-width: none !important;
    margin: 0 !important;
    display: block !important;
  }
  
  .preview-section {
    width: 100% !important;
    background: white !important;
    display: block !important;
  }
  
  .preview-container {
    padding: 0 !important;
    background: white !important;
    overflow: visible !important;
  }
  
  .preview-pages {
    gap: 0 !important;
    align-items: flex-start !important;
  }
  
  .preview-paper {
    width: 100% !important;
    max-width: none !important;
    min-height: auto !important;
    margin: 0 !important;
    padding: 15mm !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    background: white !important;
    page-break-inside: avoid !important;
    position: static !important;
  }
  
  .page-indicator {
    display: none !important;
  }
  
  @page {
    margin: 0;
    size: A4;
  }
}

/* ==========================================================================
   NOTIFICATION SYSTEM
   ========================================================================== */

.notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.notification {
  background: white;
  border-radius: 8px;
  padding: 16px;
  min-width: 320px;
  max-width: 400px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  border-left: 4px solid;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  pointer-events: all;
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s ease-out;
}

.notification.show {
  transform: translateX(0);
  opacity: 1;
}

.notification.success {
  border-left-color: #10b981;
}

.notification.error {
  border-left-color: #ef4444;
}

.notification.warning {
  border-left-color: #f59e0b;
}

.notification.info {
  border-left-color: #3b82f6;
}

.notification-icon {
  font-size: 20px;
  margin-top: 2px;
  flex-shrink: 0;
}

.notification.success .notification-icon {
  color: #10b981;
}

.notification.error .notification-icon {
  color: #ef4444;
}

.notification.warning .notification-icon {
  color: #f59e0b;
}

.notification.info .notification-icon {
  color: #3b82f6;
}

.notification-content {
  flex: 1;
}

.notification-title {
  font-weight: 600;
  margin-bottom: 4px;
  color: #1e293b;
}

.notification-message {
  color: #64748b;
  font-size: 14px;
  line-height: 1.4;
}

.notification-close {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.notification-close:hover {
  background: #f1f5f9;
  color: #475569;
}

/* ==========================================================================
   MODAL DE AJUDA
   ========================================================================== */

/* Modern Modal System */
.help-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: none;
  z-index: 2000;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: modalFadeIn var(--transition-slow) ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    backdrop-filter: blur(0px);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(8px);
  }
}

.help-modal.show {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-4);
}

.help-modal-content {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: var(--border-radius-lg);
  max-width: 800px;
  width: 100%;
  max-height: calc(100vh - var(--space-8));
  overflow-y: auto;
  margin: auto;
  position: relative;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-2xl);
  border: 1px solid rgba(255, 255, 255, 0.2);
  animation: modalSlideIn var(--transition-slow) ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.help-modal-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.help-modal-header {
  padding: var(--space-6) var(--space-8);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--gray-50);
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.help-modal-header h2 {
  color: var(--gray-800);
  font-size: var(--text-2xl); /* Reduzido de 1.5rem para 1.25rem */
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.help-modal-header h2 i {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.help-modal-close {
  background: none;
  border: none;
  font-size: var(--text-xl); /* Reduzido */
  color: var(--gray-500);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
  transition: all 0.2s;
}

.help-modal-close:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.help-modal-body {
  padding: var(--space-8);
  font-size: var(--text-base);
}

.help-section {
  margin-bottom: var(--space-10);
}

.help-section:last-child {
  margin-bottom: 0;
}

.help-section h3 {
  color: var(--gray-800);
  font-size: var(--text-xl); /* Reduzido de 1.25rem para 1.125rem */
  font-weight: 600;
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--gray-200);
}

.help-section h3 i {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.help-section p {
  color: var(--gray-600);
  line-height: 1.6;
  margin-bottom: var(--space-4);
  font-size: var(--text-base);
}

/* Benefícios */
.help-benefits {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-4);
  flex-wrap: wrap;
}

.help-benefit {
  background: var(--primary-50);
  border: 1px solid var(--primary-200);
  border-radius: var(--border-radius);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--primary-800);
  font-weight: 500;
  font-size: var(--text-sm); /* Reduzido */
}

.help-benefit i {
  color: #0284c7;
}

/* Passos */
.help-steps {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1rem;
}

.help-step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.step-number {
  background: #3b82f6;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.step-content h4 {
  color: #1e293b;
  font-weight: 600;
  margin: 0 0 0.25rem 0;
}

.step-content p {
  color: #64748b;
  margin: 0;
  line-height: 1.5;
}

/* Exemplos Markdown */
.markdown-examples {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.markdown-example {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

.markdown-code {
  background: #1e293b;
  color: #e2e8f0;
  padding: 0.75rem 1rem;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.85rem;
}

.markdown-result {
  padding: 0.75rem 1rem;
  background: white;
}

/* Prompt de IA */
.ai-prompt-example {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1rem 0;
}

.ai-prompt-example h4 {
  color: #15803d;
  margin: 0 0 1rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.prompt-text {
  background: white;
  border: 1px solid #d1fae5;
  border-radius: 6px;
  padding: 1rem;
  font-style: italic;
  color: #374151;
  line-height: 1.6;
}

/* Passos da IA */
.ai-steps {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.ai-step {
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #92400e;
  font-weight: 500;
  font-size: 0.85rem;
  flex: 1;
  min-width: 200px;
}

.ai-step i {
  background: #f59e0b;
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* Dicas */
.help-tips {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.help-tip {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 1rem;
  background: #fefce8;
  border: 1px solid #fef3c7;
  border-radius: 8px;
}

.help-tip i {
  color: #15803d;
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.help-tip span {
  color: #374151;
  line-height: 1.5;
}

/* ==========================================================================
   HISTORY MODAL STYLES
   ========================================================================== */

.history-section {
  margin: 0;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.history-header p {
  color: #64748b;
  margin: 0;
}

.btn-sm {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.history-item {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  transition: all 0.2s ease;
}

.history-item:hover {
  border-color: #3b82f6;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.history-item-header {
  display: flex;
  justify-content: between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
  gap: 1rem;
}

.history-item-title {
  flex: 1;
  font-weight: 600;
  color: #1e293b;
  font-size: 0.95rem;
  line-height: 1.4;
  cursor: pointer;
}

.history-item-title:hover {
  color: #3b82f6;
}

.history-item-actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.history-item:hover .history-item-actions {
  opacity: 1;
}

.history-action-btn {
  background: none;
  border: none;
  padding: 0.25rem;
  border-radius: 4px;
  color: #64748b;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.history-action-btn:hover {
  background: #f1f5f9;
  color: #374151;
}

.history-action-btn.danger:hover {
  background: #fef2f2;
  color: #dc2626;
}

.history-item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #64748b;
  font-size: 0.8rem;
}

.history-item-date {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.history-item-preview {
  background: #f8fafc;
  border-radius: 4px;
  padding: 0.5rem;
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.4;
  max-height: 3.6em;
  overflow: hidden;
  position: relative;
}

.history-item-preview::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  background: linear-gradient(to right, transparent, #f8fafc 70%);
  width: 30%;
  height: 100%;
  pointer-events: none;
}

.empty-history {
  text-align: center;
  padding: 3rem 1rem;
  color: #64748b;
}

.empty-history i {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: #cbd5e1;
}

.empty-history h3 {
  color: #374151;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
}

/* ==========================================================================
   IMPORT MODAL STYLES
   ========================================================================== */

.import-section {
  margin: 0;
}

.import-drop-zone {
  border: 3px dashed #cbd5e1;
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  background: #f8fafc;
  transition: all 0.3s ease;
  cursor: pointer;
  margin-bottom: 2rem;
}

.import-drop-zone:hover,
.import-drop-zone.drag-over {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.05);
}

.import-drop-content i.fas {
  font-size: 3rem;
  color: #64748b;
  margin-bottom: 1rem;
  transition: all 0.3s ease;
}

.import-drop-zone:hover .import-drop-content i.fas,
.import-drop-zone.drag-over .import-drop-content i.fas {
  color: #3b82f6;
  transform: scale(1.1);
}

.import-drop-content h3 {
  font-size: 1.25rem;
  color: #1e293b;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.import-drop-content p {
  color: #64748b;
  margin-bottom: 1.5rem;
}

.import-supported-files {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin: 1.5rem 0;
}

.file-type {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  min-width: 80px;
}

.file-type i {
  font-size: 1.5rem;
  color: #3b82f6;
}

.file-type span {
  font-size: 0.8rem;
  color: #64748b;
  text-align: center;
}

.import-browse-btn {
  margin-top: 1rem;
}

.import-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 2rem 0;
}

.import-divider::before,
.import-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

.import-divider span {
  padding: 0 1rem;
  color: #64748b;
  font-weight: 500;
  background: #f8fafc;
}

.import-quick-actions h4 {
  color: #374151;
  margin-bottom: 1rem;
  font-size: 1rem;
  font-weight: 600;
}

.quick-action-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.quick-action-buttons .btn {
  flex: 1;
  min-width: 150px;
  justify-content: center;
}

/* ==========================================================================
   STATS MODAL STYLES
   ========================================================================== */

.stats-modal-content {
  max-width: 800px;
  width: 90vw;
  font-size: var(--text-base);
}

.stats-section {
  margin: 0;
}

.stats-overview h3,
.quality-score h3,
.insights-section h3,
.analysis-details h3 {
  color: var(--gray-700);
  margin-bottom: var(--space-6);
  font-size: var(--text-lg); /* Reduzido de 1.1rem para 1rem */
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.stats-overview h3 i {
  color: #3b82f6;
}

.quality-score h3 i {
  color: #f59e0b;
}

.insights-section h3 i {
  color: #10b981;
}

.analysis-details h3 i {
  color: #8b5cf6;
}

/* Statistics Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  padding: var(--space-6) var(--space-4);
  text-align: center;
  transition: all var(--transition-slow);
  box-shadow: var(--shadow-sm);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  margin-bottom: var(--space-3);
}

.stat-icon i {
  font-size: var(--text-2xl);
  color: var(--gray-500);
}

.stat-number {
  font-size: var(--text-3xl); /* Reduzido de 2rem para 1.5rem */
  font-weight: 700;
  color: var(--gray-800);
  line-height: 1;
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--gray-500);
  margin-top: var(--space-1);
  font-weight: 500;
}

/* Quality Score */
.quality-score {
  margin-bottom: 2rem;
}

.score-container {
  display: flex;
  align-items: center;
  gap: 2rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 2rem;
  border-radius: 12px;
}

.score-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 100px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.score-value {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
}

.score-max {
  font-size: 0.875rem;
  opacity: 0.8;
}

.score-description {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.4;
}

/* Insights */
.insights-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.insight-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 8px;
  border-left: 4px solid #e2e8f0;
}

.insight-item.positive {
  background: #f0f9f4;
  border-left-color: #10b981;
}

.insight-item.warning {
  background: #fef3c7;
  border-left-color: #f59e0b;
}

.insight-item.negative {
  background: #fef2f2;
  border-left-color: #ef4444;
}

.insight-icon {
  font-size: 1.1rem;
  margin-top: 0.1rem;
}

.insight-item.positive .insight-icon {
  color: #10b981;
}

.insight-item.warning .insight-icon {
  color: #f59e0b;
}

.insight-item.negative .insight-icon {
  color: #ef4444;
}

.insight-content {
  flex: 1;
}

.insight-title {
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.25rem;
}

.insight-description {
  font-size: 0.9rem;
  color: #6b7280;
  line-height: 1.4;
}

/* Analysis Details */
.analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.analysis-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 1rem;
}

.analysis-label {
  font-size: 0.875rem;
  color: #64748b;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.analysis-value {
  font-size: 1rem;
  color: #1e293b;
  font-weight: 600;
}

/* Responsividade do modal */
@media (max-width: 768px) {
  .help-modal {
    padding: 0;
    -webkit-overflow-scrolling: touch;
  }
  
  .help-modal.show {
    padding: 0.5rem;
    align-items: stretch;
  }
  
  .help-modal-content {
    max-height: calc(100vh - 1rem);
    height: auto;
    margin: 0;
    border-radius: 8px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  
  .help-modal-header {
    padding: 1rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f8fafc;
  }
  
  .help-modal-header h2 {
    font-size: 1.25rem;
  }
  
  .help-modal-body {
    padding: 1.5rem;
    overflow-y: visible;
  }
  
  .help-benefits,
  .ai-steps {
    flex-direction: column;
  }
  
  .ai-step {
    min-width: auto;
  }
  
  .markdown-examples .markdown-code {
    font-size: 0.8rem;
  }

  /* History Modal Mobile */
  .history-header {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
    text-align: center;
  }
  
  .history-item-header {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .history-item-actions {
    opacity: 1;
    justify-content: center;
  }
  
  .history-action-btn {
    padding: 0.5rem;
    font-size: 1rem;
  }

  /* Import Modal Mobile */
  .import-supported-files {
    flex-direction: column;
    gap: 1rem;
  }
  
  .file-type {
    flex-direction: row;
    justify-content: center;
    min-width: auto;
  }
  
  .quick-action-buttons {
    flex-direction: column;
  }
  
  .quick-action-buttons .btn {
    flex: none;
    min-width: auto;
  }

  /* Stats Modal Mobile */
  .stats-modal-content {
    width: 95vw;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  
  .stat-card {
    padding: 1rem 0.75rem;
  }
  
  .stat-number {
    font-size: 1.5rem;
  }
  
  .score-container {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .analysis-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

/* ==========================================================================
   ANIMAÇÕES DE ENTRADA E POLISH FINAL
   ========================================================================== */

/* Loading state para elementos principais */
.main .editor-section,
.main .preview-section {
  animation: fadeInUp 0.6s ease-out;
}

.main .editor-section {
  animation-delay: 0.1s;
}

.main .preview-section {
  animation-delay: 0.2s;
}

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

/* Animação suave para o header */
.app .header {
  animation: fadeInDown 0.5s ease-out;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   FOOTER STYLES
   ========================================================================== */
.site-footer {
  background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-800) 100%);
  color: var(--gray-300);
  padding: 2rem 0 1rem;
  margin-top: 2rem;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.footer-section {
  margin-bottom: 1.5rem;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-400);
}

.footer-logo i {
  font-size: 1.5rem;
}

.footer-section h4 {
  color: white;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.footer-section p {
  color: var(--gray-400);
  line-height: 1.6;
  margin: 0;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: var(--gray-400);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--primary-400);
}

.social-links {
  display: flex;
  gap: 1rem;
}

.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--gray-800);
  color: var(--gray-400);
  border-radius: 50%;
  text-decoration: none;
  transition: all 0.2s;
}

.social-links a:hover {
  background: var(--primary-600);
  color: white;
  transform: translateY(-2px);
}

.footer-bottom {
  border-top: 1px solid var(--gray-700);
  padding-top: 1.5rem;
  text-align: center;
  color: var(--gray-500);
}

.footer-bottom p {
  margin: 0.5rem 0;
  font-size: var(--text-sm);
}

.footer-bottom a {
  color: var(--primary-400);
  text-decoration: none;
}

.footer-bottom a:hover {
  text-decoration: underline;
}

.footer-bottom i.fa-heart {
  color: #ef4444;
  animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.footer-disclaimer {
  font-size: var(--text-xs);
  opacity: 0.8;
  margin-top: 1rem;
}

@media (max-width: 768px) {
  .site-footer {
    padding: 1.5rem 0 1rem;
  }
  
  .footer-content {
    padding: 0 1rem;
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  
  .footer-section {
    margin-bottom: 1rem;
    text-align: center;
  }

  .footer-section:first-child {
    text-align: center;
    margin-bottom: 1.5rem;
  }

  .footer-logo {
    justify-content: center;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
  }

  .footer-section p {
    font-size: var(--text-sm);
    line-height: 1.5;
    margin: 0;
    color: var(--gray-400);
  }

  .footer-section h4 {
    font-size: var(--text-base);
    margin-bottom: 0.75rem;
    color: var(--primary-300);
  }

  .footer-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }

  .footer-links a {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: var(--text-sm);
  }

  .footer-links a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-300);
  }

  .social-links {
    justify-content: center;
    gap: 1rem;
  }

  .social-links a {
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
  }

  .footer-bottom {
    margin-top: 1.5rem;
    padding-top: 1rem;
    text-align: center;
    border-top: 1px solid var(--gray-700);
  }

  .footer-bottom p {
    font-size: var(--text-xs);
    line-height: 1.5;
    margin: 0.5rem 0;
    color: var(--gray-500);
  }

  .footer-disclaimer {
    margin-top: 0.75rem !important;
  }
}

/* Mobile extra pequeno (menos de 480px) */
@media (max-width: 480px) {
  .site-footer {
    padding: 1rem 0;
  }

  .footer-content {
    padding: 0 0.75rem;
    gap: 1rem;
  }

  .footer-section:first-child {
    margin-bottom: 1.25rem;
  }

  .footer-logo {
    font-size: 1rem;
  }

  .footer-logo span {
    font-size: 1rem;
  }

  .footer-section p {
    font-size: var(--text-xs);
    padding: 0 0.5rem;
  }

  .footer-section h4 {
    font-size: var(--text-sm);
    margin-bottom: 0.5rem;
  }

  .social-links a {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .footer-bottom {
    margin-top: 1rem;
    padding-top: 0.75rem;
  }

  .footer-bottom p {
    font-size: 11px;
    padding: 0 0.5rem;
  }
}

/* Selection styling */
::selection {
  background: var(--primary-200);
  color: var(--gray-800);
}

::-moz-selection {
  background: var(--primary-200);
  color: var(--gray-800);
}

/* Focus outline personalizado */
button:focus,
select:focus,
input:focus {
  outline: 2px solid var(--primary-400);
  outline-offset: 2px;
}

/* Disable outline para elementos que já têm estilo de focus */
.btn:focus,
.font-selector:focus,
.margin-btn:focus {
  outline: none;
}

/* Final polish */
html {
  scroll-behavior: smooth;
}
