/* ============================================================
   POLISH RESPONSIVO - LABORMED SOROCABA
   Otimizações para iPhone, Android, tablet e desktop
   ============================================================ */

/* ---------- Base / Reset de performance ---------- */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Remove highlight azul em mobile ao tocar */
button, a, input, textarea, select, [role="button"] {
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Header Mobile ---------- */
@media (max-width: 1023px) {
  header > div {
    height: 56px !important;
    min-height: 56px !important;
  }

  .header-logo-img {
    height: 1.75rem !important;
  }

  .logo-seal-divider,
  .dicq-seal-header {
    height: 1.25rem !important;
  }

  /* aumenta touch target dos icones da direita */
  header .flex.items-center.gap-1 button,
  header .flex.items-center.gap-2 button,
  header .flex.items-center.gap-3 button {
    min-width: 44px;
    min-height: 44px;
  }
}

/* Header Tablet */
@media (min-width: 768px) and (max-width: 1023px) {
  header > div {
    height: 72px !important;
    min-height: 72px !important;
  }

  .header-logo-img {
    height: 2.5rem !important;
  }

  .logo-seal-divider,
  .dicq-seal-header {
    height: 2rem !important;
  }
}

/* ---------- Hero Mobile ---------- */
@media (max-width: 639px) {
  #home > div:first-child,
  section[data-section="hero"],
  .hero-section,
  [class*="hero"] {
    min-height: 100svh !important;
  }

  /* reduz tamanho dos textos do hero em mobile */
  #home h1,
  .hero-section h1,
  [class*="hero"] h1 {
    font-size: clamp(1.75rem, 7vw, 2.25rem) !important;
    line-height: 1.1 !important;
    margin-bottom: 0.75rem !important;
  }

  #home h2,
  .hero-section h2,
  [class*="hero"] h2 {
    font-size: clamp(1.125rem, 4.5vw, 1.375rem) !important;
    line-height: 1.3 !important;
  }

  #home p,
  .hero-section p,
  [class*="hero"] p {
    font-size: clamp(0.8125rem, 3.2vw, 0.9375rem) !important;
  }

  /* container do conteudo do hero - alinha na parte inferior */
  #home > div:first-child > div,
  .hero-content {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
    padding-top: 5rem !important;
    padding-bottom: 6rem !important;
    min-height: 100svh !important;
  }

  /* botao agendar do hero */
  #home button,
  .hero-section button,
  [class*="hero"] button {
    min-height: 48px;
    padding-left: 1.25rem !important;
    padding-right: 1.25rem !important;
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
    font-size: 0.9375rem !important;
    align-self: flex-start;
    width: auto !important;
    min-width: 140px !important;
    max-width: 220px !important;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  #home h1,
  .hero-section h1,
  [class*="hero"] h1 {
    font-size: clamp(2.5rem, 6vw, 3.5rem) !important;
  }

  #home > div:first-child > div,
  .hero-content {
    padding-top: 7rem !important;
  }
}

/* ---------- Ajuste fino desktop medio (1024px - 1399px) ---------- */
@media (min-width: 1024px) and (max-width: 1399px) {
  header > div {
    height: 72px !important;
    min-height: 72px !important;
  }

  .header-logo-img {
    height: 2.75rem !important;
  }

  .logo-seal-divider,
  .dicq-seal-header {
    height: 2rem !important;
  }
}

/* ---------- WhatsApp Flutuante ---------- */
@media (max-width: 639px) {
  a[aria-label="Contato via WhatsApp"],
  .whatsapp-float,
  [class*="whatsapp"] {
    width: 48px !important;
    height: 48px !important;
    bottom: 0.75rem !important;
    right: 0.75rem !important;
  }

  a[aria-label="Contato via WhatsApp"] svg,
  .whatsapp-float svg {
    width: 24px !important;
    height: 24px !important;
  }
}

@media (min-width: 640px) {
  a[aria-label="Contato via WhatsApp"],
  .whatsapp-float {
    width: 60px !important;
    height: 60px !important;
  }
}

/* ---------- Tipografia mobile geral ---------- */
@media (max-width: 639px) {
  h1, .text-4xl, .text-5xl, .text-6xl {
    font-size: clamp(1.875rem, 7vw, 2.25rem) !important;
    line-height: 1.15 !important;
  }

  h2, .text-3xl {
    font-size: clamp(1.5rem, 6vw, 1.875rem) !important;
    line-height: 1.2 !important;
  }

  h3, .text-2xl {
    font-size: clamp(1.25rem, 5vw, 1.5rem) !important;
  }

  p, li, span {
    font-size: clamp(0.9375rem, 3.8vw, 1rem) !important;
    line-height: 1.6 !important;
  }

  section {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
  }
}

/* ---------- Botoes / Touch targets ---------- */
button, a {
  touch-action: manipulation;
}

button {
  min-height: 44px;
  min-width: 44px;
}

/* ---------- Formularios Mobile ---------- */
@media (max-width: 639px) {
  input, textarea, select {
    font-size: 16px !important; /* evita zoom no iOS */
    min-height: 48px;
  }

  form button[type="submit"],
  form button:last-child {
    min-height: 52px;
    width: 100%;
  }
}

/* ---------- Cards ---------- */
@media (max-width: 639px) {
  .card, [class*="card"] {
    border-radius: 0.75rem !important;
  }

  .grid > div {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
}

/* ---------- Modal Resultados Mobile ---------- */
@media (max-width: 639px) {
  [role="dialog"] > div,
  [data-state="open"] > div,
  .modal-content {
    max-width: calc(100vw - 2rem) !important;
    margin: 1rem !important;
    border-radius: 1rem !important;
  }

  [role="dialog"] h2,
  .modal-content h2 {
    font-size: 1.5rem !important;
  }
}

/* ---------- Menu Mobile ---------- */
@media (max-width: 1023px) {
  [data-state="open"] nav,
  .mobile-menu,
  [role="dialog"][aria-label="Menu"] {
    max-width: 300px !important;
    width: 82vw !important;
  }
}

/* ---------- Botao fechar do menu (todas as resolucoes) ---------- */
button.absolute.right-4.top-4.rounded-sm.opacity-70 {
  right: 0.25rem !important;
  top: 0.25rem !important;
  width: 28px !important;
  height: 28px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  min-width: 28px !important;
  min-height: 28px !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
  --tw-ring-offset-width: 0px !important;
  --tw-ring-width: 0px !important;
}

button.absolute.right-4.top-4.rounded-sm.opacity-70:focus,
button.absolute.right-4.top-4.rounded-sm.opacity-70:focus-visible {
  outline: none !important;
  box-shadow: none !important;
  --tw-ring-offset-width: 0px !important;
  --tw-ring-width: 0px !important;
}

button.absolute.right-4.top-4.rounded-sm.opacity-70 svg {
  width: 16px !important;
  height: 16px !important;
}

/* ---------- Footer ---------- */
@media (max-width: 639px) {
  footer {
    text-align: center;
  }

  footer .grid > div {
    margin-bottom: 1.5rem;
  }
}

/* ---------- iOS / Safari especifico ---------- */
@supports (-webkit-touch-callout: none) {
  /* evita o zoom automatico em inputs no iOS */
  input, textarea, select {
    font-size: 16px !important;
  }

  /* safe area para iPhone com notch / Dynamic Island */
  header {
    padding-top: env(safe-area-inset-top) !important;
  }

  footer {
    padding-bottom: env(safe-area-inset-bottom) !important;
  }

  a[aria-label="Contato via WhatsApp"],
  .whatsapp-float {
    bottom: calc(0.75rem + env(safe-area-inset-bottom)) !important;
  }

  /* altura real do viewport no Safari mobile */
  #home > div:first-child,
  .hero-section,
  [class*="hero"] {
    min-height: -webkit-fill-available !important;
  }

  #home > div:first-child > div,
  .hero-content {
    min-height: -webkit-fill-available !important;
  }
}

/* ---------- Windows / Chrome-Edge especifico ---------- */
@media screen and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) {
  ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }

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

  ::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 5px;
    border: 2px solid #f1f5f9;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
  }
}

/* ---------- Android / Chrome especifico ---------- */
@supports not (-webkit-touch-callout: none) {
  a[aria-label="Contato via WhatsApp"],
  .whatsapp-float {
    bottom: 0.75rem !important;
  }
}

/* ---------- Selecoes ---------- */
::selection {
  background-color: rgba(0, 136, 204, 0.25);
  color: inherit;
}

/* ---------- Loading ---------- */
#root:empty {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#root:empty::after {
  content: "";
  width: 40px;
  height: 40px;
  border: 3px solid rgba(0, 136, 204, 0.2);
  border-top-color: #0088cc;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

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

/* ---------- Container geral ---------- */
@media (min-width: 1920px) {
  .max-w-\[1600px\] {
    max-width: 1800px !important;
  }
}

/* ---------- Evita texto muito grande em telas pequenas ---------- */
@media (max-width: 374px) {
  h1, .text-4xl, .text-5xl, .text-6xl {
    font-size: 1.75rem !important;
  }

  #home h1,
  .hero-section h1 {
    font-size: 1.875rem !important;
  }
}
