/* ================================
   MELHORIAS DE RESPONSIVIDADE MOBILE
   ================================ */

/* Reset melhorado para mobile */
* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  max-width: 100vw;
  margin: 0;
  padding: 0;
}

/* Prevenir overflow horizontal */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}

/* Container responsivo */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 576px) {
  .container {
    padding: 0 1.5rem;
  }
}

@media (min-width: 768px) {
  .container {
    padding: 0 2rem;
  }
}

/* Tipografia responsiva */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  margin-bottom: 1rem;
}

h1 {
  font-size: clamp(1.8rem, 5vw, 3rem);
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
}

h3 {
  font-size: clamp(1.3rem, 3vw, 2rem);
}

p {
  margin-bottom: 1rem;
  line-height: 1.6;
}

/* Botões responsivos */
.btn, .cta-button, button {
  touch-action: manipulation;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 8px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.btn:active, .cta-button:active, button:active {
  transform: scale(0.98);
}

/* Seções responsivas */
.section {
  padding: 3rem 0;
}

@media (max-width: 768px) {
  .section {
    padding: 2rem 0;
  }
}

@media (max-width: 480px) {
  .section {
    padding: 1.5rem 0;
  }
}

/* Grids responsivos */
.grid {
  display: grid;
  gap: 2rem;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {
  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid {
    gap: 1.5rem;
  }
}

@media (max-width: 480px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
  
  .grid {
    gap: 1rem;
  }
}

/* Flex responsivo */
.flex {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.flex-center {
  justify-content: center;
  align-items: center;
}

.flex-between {
  justify-content: space-between;
  align-items: center;
}

@media (max-width: 768px) {
  .flex-mobile-column {
    flex-direction: column;
  }
}

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

.img-responsive {
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* Header melhorado para mobile */
@media (max-width: 768px) {
  header {
    padding: 0.5rem 0;
  }
  
  nav {
    padding: 0.5rem 1rem;
  }
  
  .logo img {
    max-width: 100px;
    height: auto;
  }
}

/* Formulários responsivos */
input, textarea, select {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
  -webkit-appearance: none;
  appearance: none;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #c9b037;
  box-shadow: 0 0 0 3px rgba(201, 176, 55, 0.1);
}

@media (max-width: 768px) {
  input, textarea, select {
    padding: 0.7rem;
    font-size: 16px; /* Evita zoom no iOS */
  }
}

/* Modais responsivos */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
}

.modal-content {
  max-width: 90vw;
  max-height: 90vh;
  margin: 5vh auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .modal-content {
    max-width: 95vw;
    max-height: 95vh;
    margin: 2.5vh auto;
  }
}

/* Spacing utilities responsivos */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

@media (max-width: 768px) {
  .mt-mobile-2 { margin-top: 1rem; }
  .mb-mobile-2 { margin-bottom: 1rem; }
  .p-mobile-1 { padding: 0.5rem; }
}

/* Text utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

@media (max-width: 768px) {
  .text-mobile-center { text-align: center; }
  .text-mobile-left { text-align: left; }
}

/* Display utilities */
.hidden { display: none; }
.visible { display: block; }

@media (max-width: 768px) {
  .hidden-mobile { display: none; }
  .visible-mobile { display: block; }
}

@media (min-width: 769px) {
  .hidden-desktop { display: none; }
  .visible-desktop { display: block; }
}

/* Accessibility melhorias */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus melhorado para navegação por teclado */
*:focus-visible {
  outline: 2px solid #c9b037;
  outline-offset: 2px;
}

/* Touch targets mínimos (44px) */
button, .btn, a, input[type="button"], input[type="submit"] {
  min-height: 44px;
  min-width: 44px;
}

/* Scroll suave */
html {
  scroll-behavior: smooth;
}

/* Melhorias específicas para iPhone */
@supports (-webkit-touch-callout: none) {
  .ios-safe-area {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

/* Prevenção de overflow horizontal */
* {
  max-width: 100%;
}

/* Otimizações para performance */
.gpu-accelerated {
  transform: translateZ(0);
  will-change: transform;
}

/* Carregamento de imagens lazy */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
  opacity: 1;
}
