/* ========================================
   MELHORIAS ADICIONAIS PARA MOBILE
   ======================================== */

/* Previne zoom indesejado em inputs no iOS */
input[type="radio"] {
  -webkit-tap-highlight-color: rgba(150, 84, 255, 0.3);
  tap-highlight-color: rgba(150, 84, 255, 0.3);
}

/* Smooth scroll para toda a página */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Melhora performance de animações */
* {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

/* Container responsivo */
.container-fluid {
  padding-left: 15px;
  padding-right: 15px;
}

@media (min-width: 768px) {
  .container-fluid {
    padding-left: 30px;
    padding-right: 30px;
  }
}

/* Imagens responsivas */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Tipografia responsiva */
body {
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (min-width: 768px) {
  body {
    font-size: 17px;
  }
}

@media (min-width: 1200px) {
  body {
    font-size: 18px;
  }
}

/* Headings responsivos */
h1 {
  font-size: 2em;
  line-height: 1.2;
  margin-bottom: 0.5em;
}

h2 {
  font-size: 1.5em;
  line-height: 1.3;
  margin-bottom: 0.5em;
}

h3 {
  font-size: 1.25em;
  line-height: 1.4;
  margin-bottom: 0.5em;
}

@media (min-width: 768px) {
  h1 {
    font-size: 2.5em;
  }

  h2 {
    font-size: 2em;
  }

  h3 {
    font-size: 1.5em;
  }
}

/* Espaçamento vertical responsivo */
.section-spacing {
  padding-top: 40px;
  padding-bottom: 40px;
}

@media (min-width: 768px) {
  .section-spacing {
    padding-top: 60px;
    padding-bottom: 60px;
  }
}

@media (min-width: 1200px) {
  .section-spacing {
    padding-top: 80px;
    padding-bottom: 80px;
  }
}

/* Cards responsivos */
.card-mobile {
  margin-bottom: 20px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

@media (min-width: 768px) {
  .card-mobile {
    margin-bottom: 30px;
  }
}

/* Botões touch-friendly */
button,
.btn,
.button,
a.button {
  -webkit-tap-highlight-color: rgba(150, 84, 255, 0.3);
  tap-highlight-color: rgba(150, 84, 255, 0.3);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* Previne seleção de texto em elementos interativos */
.rad-label,
.option-input,
.button {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Loader para melhor UX */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

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

/* Estados de foco melhorados para acessibilidade */
a:focus,
button:focus,
input:focus {
  outline: 2px solid #9654FF;
  outline-offset: 2px;
}

/* Ocultar elementos visualmente mas manter para screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Grid responsivo customizado */
.grid-mobile {
  display: grid;
  gap: 15px;
  grid-template-columns: 1fr;
}

@media (min-width: 576px) {
  .grid-mobile {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}

@media (min-width: 992px) {
  .grid-mobile {
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
  }
}

/* Scroll suave para iOS */
.scroll-container {
  -webkit-overflow-scrolling: touch;
  overflow-y: auto;
}

/* Fix para inputs em iOS */
input,
textarea,
select {
  font-size: 16px;
}

/* Prevenção de overflow horizontal */
body,
html {
  overflow-x: hidden;
  position: relative;
}

/* Animações otimizadas para performance */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Container do gráfico otimizado */
#chartdiv {
  touch-action: pan-y pinch-zoom;
  -webkit-user-select: none;
  user-select: none;
}

/* Estilo para dispositivos com notch (iPhone X+) */
@supports (padding: max(0px)) {
  .header {
    padding-left: max(15px, env(safe-area-inset-left));
    padding-right: max(15px, env(safe-area-inset-right));
  }

  .container-fluid {
    padding-left: max(15px, env(safe-area-inset-left));
    padding-right: max(15px, env(safe-area-inset-right));
  }
}

/* Modo landscape para mobile */
@media (max-height: 500px) and (orientation: landscape) {
  #hero {
    min-height: auto;
    padding: 20px 15px;
  }

  .header {
    height: 4em;
  }

  .img-header {
    max-width: 100px;
  }
}

/* Preload de fontes */
@font-display swap;

/* Otimização para telas de alta densidade */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Skeleton loading para o gráfico */
.chart-skeleton {
  width: 100%;
  height: 400px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 50%;
}

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

/* Melhorias de contraste para acessibilidade */
@media (prefers-contrast: high) {
  .button {
    border: 2px solid #fff;
  }

  .rad-label:hover {
    background-color: #e0e0e0;
  }
}

/* Dark mode support (preparação futura) */
@media (prefers-color-scheme: dark) {
  /* Estilos para dark mode serão adicionados aqui */
}

/* Print styles */
@media print {
  .button,
  .header,
  #footer {
    display: none;
  }

  #chartdiv {
    page-break-inside: avoid;
  }
}

