/* Header CSS - Estilos específicos para o header unificado */

/* Top Header Azul - Estilos base */
.top-header {
  background: linear-gradient(135deg, #1e40af 0%, #1e40af 100%);
  background: -webkit-linear-gradient(135deg, #1e40af 0%, #1e40af 100%);
  border-bottom: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  height: 26px;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 60;
}

.top-header span {
  font-size: 0.875rem;
  font-weight: 500;
  color: #FFFFFF;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.top-header img {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
  border-radius: 2px;
}

/* Navigation - Estilos base */
.navigation {
  position: fixed;
  width: 100%;
  top: 1rem;
  z-index: 50;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid #e5e7eb;
  transition: all 0.3s ease;
}

.navigation .flex.justify-between.items-center {
  align-items: flex-end !important;
  padding-bottom: 0.5rem !important;
}

.navigation a.flex.items-center {
  align-items: flex-end !important;
  padding-bottom: 0.25rem !important;
}

.navigation a.flex.items-center div {
  align-items: flex-end !important;
}

.navigation img {
  background: transparent;
  border-radius: 12px;
  padding: 2px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  align-self: flex-end !important;
  margin-bottom: 0 !important;
  margin-top: auto !important;
}

.navigation a.flex.items-center img {
  align-self: flex-end !important;
  margin-bottom: 0 !important;
  margin-top: auto !important;
}

/* Forçar alinhamento da logo - regra mais específica */
.navigation a.flex.items-center div img.w-16.h-16 {
  align-self: flex-end !important;
  margin-bottom: 0 !important;
  margin-top: auto !important;
  vertical-align: bottom !important;
  position: relative !important;
  top: 0.5rem !important;
}

/* Regra ainda mais específica para forçar */
html body .navigation a.flex.items-center div img.w-16.h-16 {
  align-self: flex-end !important;
  margin-bottom: 0 !important;
  margin-top: auto !important;
  vertical-align: bottom !important;
  position: relative !important;
  top: 0.5rem !important;
  transform: translateY(0.5rem) !important;
}

/* Navigation scrolled state */
.navigation.scrolled {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 4px 20px -4px hsl(220 91% 29% / 0.1);
}

/* Imobify Brand Color */
.text-imobify {
  color: #0059CB !important;
}

/* Hamburger Button */
.navigation button.md\\:hidden {
  background: #f3f4f6;
  border-radius: 50%;
  padding: 0.75rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  min-width: 48px;
  min-height: 48px;
}

.navigation button.md\\:hidden:hover {
  background: #e5e7eb;
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.navigation button.md\\:hidden:active {
  transform: scale(0.95);
}

/* Nav Link */
.nav-link {
  position: relative;
  transition: color 0.3s ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -4px;
  left: 50%;
  background: #3b82f6;
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.nav-link:hover::after {
  width: 100%;
}

/* Mobile Menu */
#mobileMenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
  opacity: 0;
  padding-bottom: 1rem;
  display: block !important; /* Forçar exibição em mobile */
}

#mobileMenu.show {
  max-height: 800px;
  opacity: 1;
  transition: max-height 0.3s ease-in, opacity 0.3s ease-in;
}

#mobileMenu.hidden {
  display: none !important;
}

/* Mobile Menu Animations */
#mobileMenu .flex.flex-col > a {
  transform: translateX(-20px);
  opacity: 0;
  transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

#mobileMenu.show .flex.flex-col > a {
  transform: translateX(0);
  opacity: 1;
  transition: transform 0.3s ease-in, opacity 0.3s ease-in;
}

#mobileMenu.show .flex.flex-col > a:nth-child(1) { transition-delay: 0.1s; }
#mobileMenu.show .flex.flex-col > a:nth-child(2) { transition-delay: 0.2s; }
#mobileMenu.show .flex.flex-col > a:nth-child(3) { transition-delay: 0.3s; }
#mobileMenu.show .flex.flex-col > a:nth-child(4) { transition-delay: 0.4s; }
#mobileMenu.show .flex.flex-col > a:nth-child(5) { transition-delay: 0.5s; }
#mobileMenu.show .flex.flex-col > a:nth-child(6) { transition-delay: 0.6s; }
#mobileMenu.show .flex.flex-col > a:nth-child(7) { transition-delay: 0.7s; }

/* Hamburger Animation */
.navigation button.md\\:hidden {
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.navigation button.md\\:hidden.hide {
  opacity: 0;
  transform: scale(0.8);
}

/* Desktop Responsive */
@media (min-width: 1024px) {
  .navigation {
    backdrop-filter: blur(16px);
  }

  .navigation .btn-primary {
    padding: 12px 16px !important;
    font-size: 18px;
  }

  .navigation a {
    font-size: .95rem;
  }
}

/* Garantir que o header mantenha o tamanho correto em desktop */
@media (min-width: 769px) {
  .navigation .flex.justify-between.items-center {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
  }
  
  .navigation img {
    width: 4rem !important;
    height: 4rem !important;
  }
  
  .navigation span {
    font-size: 1.5rem !important;
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  /* Top Header Mobile */
  .top-header {
    padding: 0.375rem 0.75rem !important;
  }
  
  .top-header span {
    font-size: 0.75rem !important;
    text-align: center;
  }
  
  .top-header img {
    width: 1rem !important;
    height: 0.75rem !important;
  }
  
  /* Navigation Mobile */
  .navigation {
    top: 1rem !important;
  }
  
  .navigation .flex.justify-between.items-center {
    align-items: flex-end !important;
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
  }
  
  .navigation a.flex.items-center {
    align-items: flex-end !important;
    padding-bottom: 0.25rem !important;
  }
  
  .navigation a.flex.items-center div {
    align-items: flex-end !important;
  }
  
  .navigation img {
    width: 4rem !important;
    height: 4rem !important;
    transform: none !important;
    align-self: flex-end !important;
    margin-bottom: 0 !important;
    margin-top: auto !important;
  }
  
  .navigation a.flex.items-center img {
    align-self: flex-end !important;
    margin-bottom: 0 !important;
    margin-top: auto !important;
  }
  
  /* Forçar alinhamento da logo - regra mais específica mobile */
  .navigation a.flex.items-center div img.w-16.h-16 {
    align-self: flex-end !important;
    margin-bottom: 0 !important;
    margin-top: auto !important;
    vertical-align: bottom !important;
    position: relative !important;
    top: 0.5rem !important;
  }
  
  /* Regra ainda mais específica para forçar mobile */
  html body .navigation a.flex.items-center div img.w-16.h-16 {
    align-self: flex-end !important;
    margin-bottom: 0 !important;
    margin-top: auto !important;
    vertical-align: bottom !important;
    position: relative !important;
    top: 0.5rem !important;
    transform: translateY(0.5rem) !important;
  }
  
  .navigation span {
    font-size: 1.5rem !important;
    transform: none !important;
  }
  
  .navigation button {
    transform: none !important;
  }
  
  /* Garantir que o menu móvel seja sempre visível em mobile */
  #mobileMenu {
    display: block !important;
    max-height: none !important;
    opacity: 1 !important;
  }
}

/* Mobile para telas muito pequenas */
@media (max-width: 480px) {
  /* Top header very small screens */
  .top-header span {
    font-size: 0.7rem !important;
  }
  
  .top-header img {
    width: 0.875rem !important;
    height: 0.625rem !important;
  }
}

/* Mobile Menu para resoluções ≤ 1060px */
@media (max-width: 1060px) {
  /* Esconder navegação horizontal - forçar override do md:flex */
  .navigation nav.hidden.md\\:flex {
    display: none !important;
  }
  
  /* Mostrar botão do menu hambúrguer - forçar override do md:hidden */
  .navigation button.md\\:hidden {
    display: block !important;
  }
  
  /* Garantir que o menu móvel seja exibido corretamente apenas quando aberto */
  #mobileMenu {
    display: none !important;
    max-height: 0 !important;
    opacity: 0 !important;
  }
  
  #mobileMenu.show {
    display: block !important;
    max-height: 800px !important;
    opacity: 1 !important;
  }
  
  /* Forçar esconder navegação horizontal */
  .navigation .flex.justify-between nav {
    display: none !important;
  }
  
  /* Forçar mostrar botão hambúrguer */
  .navigation .flex.justify-between button {
    display: block !important;
  }
  
  /* Ajustes do logo para telas menores */
  .navigation img {
    width: 3rem;
    height: 3rem;
  }
  
  .navigation span {
    font-size: 1.5rem;
  }
  
  /* Estilos do menu mobile expandido */
  #mobileMenu {
    background: #f9fafb;
    border-radius: 0;
    box-shadow: none;
    margin-top: 0;
    position: relative;
    z-index: 50;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
  }
  
  /* Override do Tailwind hidden class */
  #mobileMenu.hidden {
    display: none !important;
  }
  
  /* Mostrar o menu quando não estiver hidden */
  #mobileMenu:not(.hidden) {
    display: block !important;
  }
  
  /* Remover qualquer overlay ou backdrop */
  .navigation::after,
  .navigation::before {
    display: none !important;
  }
  
  /* Garantir que não haja fundo escuro */
  body:has(#mobileMenu:not(.hidden)) {
    background: #f9fafb !important;
  }
  
  /* Quando o menu estiver aberto, deixar o header gray-50 também */
  .navigation:has(+ #mobileMenu:not(.hidden)),
  .navigation:has(#mobileMenu:not(.hidden)) {
    background: #f9fafb !important;
  }
  
  /* Forçar header gray-50 quando menu mobile estiver visível */
  body:has(#mobileMenu:not(.hidden)) .navigation {
    background: #f9fafb !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  
  /* Quando menu estiver aberto, deixar tudo gray-50 */
  body.menu-open {
    background: #f9fafb !important;
  }
  
  body.menu-open .navigation {
    background: #f9fafb !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  
  #mobileMenu .flex.flex-col.space-y-4 {
    padding: 0;
    gap: 0;
    background: #f9fafb;
  }
  
  #mobileMenu a {
    padding: 0.75rem 1rem;
    border-radius: 0;
    transition: none;
    font-weight: 500;
    color: #374151;
    background: #f9fafb;
  }
  
  #mobileMenu a:hover {
    background-color: #f9fafb;
    color: #374151;
  }
  
  #mobileMenu .btn-primary {
    background: #1e40af !important;
    color: white !important;
    padding: 0.75rem 1.5rem !important;
    border-radius: 8px !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    text-align: center !important;
    justify-content: center !important;
    margin-top: 0.5rem !important;
  }
  
  #mobileMenu .btn-primary:hover {
    background: #1e3a8a !important;
    transform: translateY(-1px);
  }
}