/* Performance Enhanced CSS - Solares Global Energy */

/* Critical CSS - Above the fold */
:root {
  --primary-color: #20B2AA;
  --secondary-color: #48CAE4;
  --accent-color: #06D6A0;
  --text-dark: #2c3e50;
  --text-light: #7f8c8d;
  --bg-light: #f8f9fa;
  --shadow: 0 4px 20px rgba(0,0,0,0.1);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset e base otimizada */
*,*::before,*::after{box-sizing:border-box}
body,h1,h2,h3,h4,p,figure,blockquote,dl,dd{margin:0}
ul[role="list"],ol[role="list"]{list-style:none}
html:focus-within{scroll-behavior:smooth}
body{min-height:100vh;text-rendering:optimizeSpeed;line-height:1.5;font-family:system-ui,-apple-system,sans-serif}
a:not([class]){text-decoration-skip-ink:auto}
img,picture{max-width:100%;display:block}
input,button,textarea,select{font:inherit}

/* Layout otimizado com CSS Grid */
.container {
  display: grid;
  grid-template-columns: minmax(1rem, 1fr) minmax(0, 1200px) minmax(1rem, 1fr);
  gap: 2rem;
}

.container > * {
  grid-column: 2;
}

/* Performance - Lazy loading placeholder */
.lazy {
  opacity: 0;
  transition: opacity 0.3s;
}

.lazy.loaded {
  opacity: 1;
}

/* Critical animations - GPU accelerated */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translate3d(0, 30px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

/* Otimização de fontes */
@font-display: swap;

/* Componentes críticos */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  will-change: transform;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
}

/* Header otimizado */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Cards com performance otimizada */
.card {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 2rem;
  transition: var(--transition);
  will-change: transform;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

/* Grid responsivo otimizado */
.grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* Otimizações para mobile */
@media (max-width: 768px) {
  .container {
    grid-template-columns: 1rem 1fr 1rem;
    gap: 1rem;
  }
  
  .grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .card {
    padding: 1rem;
  }
}

/* Preload crítico */
.preload-critical {
  position: absolute;
  top: -9999px;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Otimizações específicas do site */
.hero {
  background: linear-gradient(135deg, var(--bg-light), white);
  padding: 4rem 0;
  text-align: center;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  color: var(--text-dark);
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto 2rem;
}

/* Calculadora otimizada */
.calculadora-form {
  display: grid;
  gap: 1.5rem;
  max-width: 600px;
  margin: 0 auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-input {
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* Resultados da calculadora */
.resultado-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.resultado-card {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  text-align: center;
  box-shadow: var(--shadow);
}

.resultado-valor {
  font-size: 2rem;
  font-weight: bold;
  color: var(--primary-color);
  margin: 0.5rem 0;
}

/* Otimizações de performance críticas */
.will-change-transform { will-change: transform; }
.will-change-opacity { will-change: opacity; }
.gpu-accelerated { transform: translateZ(0); }

/* Redução de repaint/reflow */
.no-select { user-select: none; }
.pointer-events-none { pointer-events: none; }

/* Otimização de scroll */
.smooth-scroll { scroll-behavior: smooth; }

/* Prevenção de layout shift */
.aspect-ratio-16-9 {
  aspect-ratio: 16 / 9;
}

.aspect-ratio-1-1 {
  aspect-ratio: 1 / 1;
}

/* Utilities de performance */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Otimização para impressão */
@media print {
  .no-print { display: none !important; }
  .print-only { display: block !important; }
}

/* Redução de motion para acessibilidade */
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

