/* ===== CSS OTIMIZADO - SHORTPAGE (FIXED) ===== */
/* Versão: 2.1.1 | Data: 2024 | Autor: ShortPage (ajustes 2025) */

/* ===== VARIÁVEIS CSS ===== */
:root {
  /* Cores Principais */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;

  /* Cores Neutras */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-400: #9ca3af;
  --gray-600: #4b5563;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Cores Semânticas */
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;

  /* Espaçamentos */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;

  /* Bordas */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;

  /* Sombras */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);

  /* Transições */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* Z-index stack (consistente) */
  --z-skip-link: 10010;
  --z-notification: 10000;
  --z-modal: 10500;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.6;
  color: var(--gray-800);
  background-color: #ffffff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* Botões Base */
.btn {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-md);
  border: none;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.875rem;
  transition: transform var(--transition-base), background-color var(--transition-base), box-shadow var(--transition-base), color var(--transition-base);
  cursor: pointer;
  text-decoration: none;
  justify-content: center;
}

/* Primary */
.btn-primary {
  background: var(--primary-500);
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--transition-base), transform var(--transition-base), box-shadow var(--transition-base);
}

.btn-primary:hover {
  background: var(--primary-600);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary-lg {
  padding: var(--space-sm) var(--space-lg);
  font-size: 1rem;
}

/* Outline white (base) */
.btn-outline-white {
  background: transparent;
  color: white;
  border: 2px solid white;
  border-radius: var(--radius-md);
  transition: background-color var(--transition-base), color var(--transition-base), transform var(--transition-base);
}

.btn-outline-white:hover {
  background: white;
  color: var(--gray-800);
  transform: translateY(-1px);
}

/* Large outline white - sem `composes` (CSS puro) */
.btn-outline-white-lg {
  background: transparent;
  color: white;
  border: 2px solid white;
  padding: var(--space-sm) var(--space-lg);
  font-size: 1rem;
  border-radius: var(--radius-md);
  transition: background-color var(--transition-base), color var(--transition-base), transform var(--transition-base);
}

/* Cards */
.feature-card {
  background: var(--gray-50);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-100);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  text-align: center;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.feature-icon {
  width: 4rem;
  height: 4rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-md);
  font-size: 1.5rem;
  transition: transform var(--transition-base);
}

.card-hover {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

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

/* Navegação */
.nav-link {
  color: white;
  text-decoration: none;
  position: relative;
  transition: color var(--transition-fast);
}

.nav-link::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background: var(--primary-500);
  transition: width var(--transition-base);
}

.nav-link:hover::after,
.nav-link:focus::after {
  width: 100%;
}

.nav-link-mobile {
  display: block;
  padding: var(--space-xs) 0;
  color: white;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.nav-link-mobile:hover {
  color: var(--primary-500);
}

/* Links do Footer */
.footer-link {
  color: var(--gray-400);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: white;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background: var(--primary-500);
  color: white;
  border-radius: 50%;
  transition: transform var(--transition-base), background-color var(--transition-base), color var(--transition-base);
}

.social-link:hover {
  background: white;
  color: var(--primary-500);
  transform: scale(1.1);
}

/* ===== ANIMAÇÕES ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translate3d(0, 30px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

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

@keyframes pulseSlow {
  0%, 100% {
    opacity: 0.2;
  }
  50% {
    opacity: 0.3;
  }
}

@keyframes gradientShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

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

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

.fade-in-up {
  opacity: 0;
  animation: fadeInUp 0.6s ease forwards;
}

.fade-in {
  opacity: 0;
  animation: fadeIn 0.5s ease forwards;
}

.animate-pulse-slow {
  animation: pulseSlow 3s ease-in-out infinite;
}

/* ===== COMPONENTES ESPECÍFICOS ===== */

/* Skip Link */
.skip-link {
  position: absolute;
  top: -40px;
  left: var(--space-sm);
  background: var(--primary-500);
  color: white;
  padding: var(--space-xs) var(--space-sm);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  text-decoration: none;
  font-weight: 500;
  z-index: var(--z-skip-link);
  transition: top var(--transition-base);
}

.skip-link:focus {
  top: 0;
}

/* Gradient Background */
.gradient-bg {
  background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #475569 100%);
  background-size: 200% 200%;
  animation: gradientShift 8s ease infinite;
}

/* Botões Flutuantes */
.floating-btn {
  position: fixed;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border: none;
  border-radius: 50%;
  box-shadow: var(--shadow-lg);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  cursor: pointer;
}

.floating-btn:hover {
  transform: scale(1.1);
}

.back-to-top {
  bottom: var(--space-lg);
  right: var(--space-lg);
  background: var(--primary-500);
  color: white;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.whatsapp-float {
  bottom: var(--space-lg);
  left: var(--space-lg);
}

.whatsapp-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: #25d366;
  color: white;
  border-radius: 50%;
  text-decoration: none;
}

/* Modal */
.template-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.template-modal[aria-hidden="false"] {
  display: flex;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-container {
  position: relative;
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 1200px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.3s ease-out;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  background: var(--gray-800);
  color: white;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
  transition: background 0.2s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.modal-body {
  padding: 2rem;
  overflow-y: auto;
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.template-preview {
  background: #f8fafc;
  border-radius: 8px;
  padding: 1.5rem;
  border: 1px solid #e2e8f0;
}

.template-info {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.info-section h4 {
  color: #1e293b;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
}

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

.features-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
}

.features-list li:before {
  content: "✓";
  color: var(--success);
  font-weight: bold;
  margin-right: 0.5rem;
}

.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.tech-tag {
  background: var(--primary-500);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  padding: 1.5rem;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.btn-outline {
  background: white;
  color: var(--primary-500);
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--primary-500);
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--transition-base), color var(--transition-base), transform var(--transition-base);
}

.btn-outline:hover {
  background: var(--primary-500);
  color: white;
}

/* Estados de loading */
.preview-loading {
  text-align: center;
  padding: 3rem;
  color: #6b7280;
}

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

/* Preview do template */
.preview-container {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.browser-bar {
  background: #f8fafc;
  padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.browser-dots {
  display: flex;
  gap: 6px;
}

.browser-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.browser-dot.red { background: #ef4444; }
.browser-dot.yellow { background: #f59e0b; }
.browser-dot.green { background: #10b981; }

.browser-url {
  flex: 1;
  background: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  color: #6b7280;
  border: 1px solid #e2e8f0;
  font-family: 'Courier New', monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-iframe {
  width: 100%;
  height: 400px;
  border: none;
  background: white;
  display: block;
}

/* Notificações */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 16px 20px;
  border-radius: 12px;
  color: white;
  z-index: var(--z-notification);
  max-width: 400px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  transform: translateX(150%);
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(10px);
}

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

.notification.hide {
  transform: translateX(150%);
}

.notification--success {
  background: linear-gradient(135deg, var(--success), #059669);
  border-left: 4px solid #047857;
}

.notification--error {
  background: linear-gradient(135deg, var(--error), #dc2626);
  border-left: 4px solid #b91c1c;
}

.notification--warning {
  background: linear-gradient(135deg, var(--warning), #d97706);
  border-left: 4px solid #b45309;
}

.notification--info {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  border-left: 4px solid var(--primary-700);
}

.notification__content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.notification__icon {
  font-size: 1.2em;
}

.notification__message {
  font-weight: 500;
  line-height: 1.4;
}

.notification__close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  margin-left: 10px;
  transition: background 0.3s ease;
}

.notification__close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ===== UTILITÁRIOS ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* Estados de loading nos botões */
button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.fa-spinner {
  margin-right: 8px;
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 768px) {
  :root {
    font-size: 14px;
  }

  .container {
    padding: 0 var(--space-sm);
  }

  .floating-btn {
    width: 2.5rem;
    height: 2.5rem;
  }

  .back-to-top {
    bottom: var(--space-md);
    right: var(--space-md);
  }

  .whatsapp-float {
    bottom: var(--space-md);
    left: var(--space-md);
  }

  .modal-body {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .modal-actions {
    flex-direction: column;
  }

  .template-preview {
    order: 2;
  }

  .template-info {
    order: 1;
  }

  .notification {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .preview-iframe {
    height: 300px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .no-print {
    display: none !important;
  }

  .floating-btn {
    display: none !important;
  }

  body {
    font-size: 12pt;
    line-height: 1.4;
    color: black;
  }
}

/* ===== FOCUS ACCESSIBILITY HELPERS ===== */
:focus {
  outline: none;
}
:focus-visible {
  outline: 3px solid var(--primary-500);
  outline-offset: 3px;
  border-radius: calc(var(--radius-sm) + 2px);
}
/* ===== CRITICAL CSS OPTIMIZATIONS ===== */

/* Preload key animations */
@media (prefers-reduced-motion: no-preference) {
  .gradient-bg {
    will-change: background-position;
  }
  
  .card-hover {
    will-change: transform;
  }
}

/* Optimize scrolling performance */
.scroll-smooth {
  scroll-behavior: smooth;
}

/* Reduce layout shifts */
img {
  aspect-ratio: attr(width) / attr(height);
}

/* Optimize font loading */
body {
  font-display: swap;
}

/* Better focus management */
.skip-link:focus {
  top: 0;
  outline: 3px solid var(--primary-500);
  outline-offset: 2px;
}