/*! modern-normalize v2.0.0 | MIT License | https://github.com/sindresorhus/modern-normalize */
*,
::before,
::after {
  box-sizing: border-box;
}
html {
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
main {
  display: block;
}
h1, h2, h3 {
  margin: 0;
}
ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
a {
  background-color: transparent;
  text-decoration: none;
}
img {
  border-style: none;
  max-width: 100%;
  height: auto;
}
button {
  font-family: inherit;
  font-size: 100%;
  line-height: 1.15;
  margin: 0;
  overflow: visible;
  text-transform: none;
}

/* Variáveis CSS Otimizadas */
:root {
  --primary-color: #2563eb;
  --primary-dark: #1d4ed8;
  --text-color: #1f2937;
  --text-light: #6b7280;
  --bg-white: #ffffff;
  --bg-gray: #f8fafc;
  --border-color: #e5e7eb;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Configurações Gerais Otimizadas */
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background: var(--bg-white);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* HEADER SUPER OTIMIZADO */
.site-header {
  background: var(--bg-white);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* Top Bar Otimizada */
.top-bar {
  background: var(--bg-gray);
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
}

.social-contacts {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.social-icons {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.social-icons a {
  display: flex;
  align-items: center;
  padding: 0.25rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.social-icons a:hover {
  background: rgba(0,0,0,0.05);
}

.social-icons svg {
  flex-shrink: 0;
}

.contact-phones {
  display: flex;
  gap: 1rem;
  font-weight: 600;
}

.contact-phones a {
  color: var(--text-color);
  white-space: nowrap;
}

.contact-phones a:hover {
  color: var(--primary-color);
}

/* Navegação Principal Otimizada */
.main-navigation {
  padding: 0.75rem 0;
}

.main-navigation .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.logo img {
  height: 50px;
  width: auto;
  transition: transform 0.2s ease;
}

.logo:hover img {
  transform: scale(1.05);
}

/* Menu Principal Desktop - Layout Melhorado */
.main-nav ul {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.main-nav a {
  color: var(--text-color);
  font-weight: 500;
  padding: 0.75rem 0.5rem;
  position: relative;
  white-space: nowrap;
  font-size: 0.95rem;
}

.main-nav a:hover {
  color: var(--primary-color);
}

/* Submenus Desktop - Layout em Colunas */
.has-submenu {
  position: relative;
}

.has-submenu:hover .submenu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.submenu {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg-white);
  min-width: 280px;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  border-radius: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
  padding: 0.75rem 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

/* Submenus com múltiplas colunas para muitos itens */
.has-submenu:nth-child(3) .submenu, /* Tratamentos */
.has-submenu:nth-child(4) .submenu { /* Clínicas */
  grid-template-columns: repeat(2, 1fr);
  min-width: 500px;
}

.has-submenu:nth-child(5) .submenu { /* Internação */
  grid-template-columns: repeat(2, 1fr);
  min-width: 400px;
}

.submenu li {
  border-bottom: 1px solid var(--border-color);
}

.submenu li:last-child {
  border-bottom: none;
}

.submenu a {
  display: block;
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  line-height: 1.4;
  border: none;
}

.submenu a:hover {
  background: var(--bg-gray);
  color: var(--primary-color);
  padding-left: 1.5rem;
}

/* Menu Mobile Otimizado */
.menu-toggle {
  display: none;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  gap: 0.25rem;
  width: 44px;
  height: 44px;
}

.menu-toggle span {
  width: 20px;
  height: 2px;
  background: var(--text-color);
  transition: all 0.3s ease;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* Mobile Styles */
@media (max-width: 768px) {
  .social-contacts {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }
  
  .contact-phones {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .menu-toggle {
    display: flex;
  }
  
  .main-nav {
    position: fixed;
    top: 0;
    left: -100%;
    width: 85%;
    height: 100vh;
    background: var(--bg-white);
    transition: left 0.3s ease;
    z-index: 1001;
    padding: 2rem 1rem;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
  }
  
  .main-nav.active {
    left: 0;
  }
  
  .main-nav ul {
    flex-direction: column;
    gap: 0;
    align-items: stretch;
  }
  
  .main-nav a {
    display: block;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 1rem;
  }
  
  /* Submenus Mobile */
  .submenu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    background: var(--bg-gray);
    margin: 0.5rem 0;
    border-radius: 4px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    grid-template-columns: 1fr !important;
  }
  
  .has-submenu.submenu-open .submenu {
    max-height: 500px;
  }
  
  .submenu a {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }
  
  .submenu a:hover {
    padding-left: 1.25rem;
  }
  
  /* Indicador de submenu mobile */
  .has-submenu > a::after {
    content: '›';
    float: right;
    transition: transform 0.3s ease;
  }
  
  .has-submenu.submenu-open > a::after {
    transform: rotate(90deg);
  }
}

/* FOOTER SUPER OTIMIZADO */
.site-footer {
  background: var(--bg-white);
  border-top: 1px solid var(--border-color);
  padding: 3rem 0 1rem;
  margin-top: 4rem;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section h3 {
  color: var(--text-color);
  margin-bottom: 1rem;
  font-size: 1.125rem;
  font-weight: 600;
}

/* Logo Footer */
.footer-logo img {
  height: 50px;
  width: auto;
  margin-bottom: 1rem;
}

.footer-description {
  color: var(--text-light);
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

/* Social Footer */
.footer-social {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.footer-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-gray);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.footer-social a:hover {
  background: var(--primary-color);
  transform: translateY(-2px);
}

.footer-social a:hover svg {
  fill: white;
}

/* Links Footer */
.footer-links li {
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: var(--text-light);
  font-size: 0.875rem;
  transition: color 0.2s ease;
  display: block;
  padding: 0.25rem 0;
}

.footer-links a:hover {
  color: var(--primary-color);
  padding-left: 0.5rem;
}

/* Contatos Footer */
.contact-info p {
  margin-bottom: 0.75rem;
  color: var(--text-light);
  font-size: 0.875rem;
}

.contact-info a {
  color: inherit;
  transition: color 0.2s ease;
}

.contact-info a:hover {
  color: var(--primary-color);
}

/* Footer Bottom */
.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
  text-align: center;
  color: var(--text-light);
  font-size: 0.875rem;
  line-height: 1.5;
}

.footer-bottom a {
  color: var(--primary-color);
  font-weight: 500;
}

/* Mobile Footer */
@media (max-width: 768px) {
  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 2.5rem;
  }
  
  .footer-social {
    justify-content: center;
  }
  
  .footer-links a:hover {
    padding-left: 0;
  }
}

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

/* Focus visível para acessibilidade */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Otimizações de impressão */
@media print {
  .site-header,
  .site-footer {
    display: none;
  }
}

/* Prevenção de CLS (Cumulative Layout Shift) */
.logo img,
.footer-logo img {
  aspect-ratio: 180/60;
}

/* Otimizações de desempenho */
.site-header,
.site-footer {
  contain: layout style paint;
}

.main-nav ul {
  contain: content;
}