.header {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "logo search"
    "nav nav";
  gap: 12px;
  align-items: center;

  margin: 12px auto 0;
  max-width: 1180px;
  padding: 14px 16px;
  border-radius: 14px;

  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--aff-border);
  box-shadow: var(--aff-shadow);
  backdrop-filter: blur(10px);
}

/* Logo */
.logo {
  grid-area: logo;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.logo img {
  width: 60px;
  height: 60px;
  border-radius: 10px;
}

/* Busca */
.aff-search {
  grid-area: search;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.aff-search-input {
  width: 100%;
  min-width: 180px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--aff-text);
  font-size: 1rem;
  padding: 8px 10px;
}
.aff-search-input::placeholder {
  color: rgba(234, 243, 255, 0.62);
}
.aff-search-btn {
  border: none;
  cursor: pointer;
  border-radius: 5px;
  color: #0b1d2e;
  font-weight: 800;
  padding: 5px;
}
.aff-search-btn img {
  width: 24px;
  height: 24px;
}
.aff-search-btn:hover {
  filter: brightness(1.03);
}

/* Navegação */
.header nav {
  grid-area: nav;
  width: 100%;
}
.header nav ul {
  display: flex;
  list-style: none;
  gap: 8px;
  padding: 2px;
  justify-content: space-between;
  align-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.header nav ul li {
  margin-left: 0;
}
.header nav ul a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  color: #06315b;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 10px;
  transition: background 0.2s ease, transform 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}
.header nav ul a:hover {
  background: rgba(11, 94, 215, 0.10);
  color: #0b5ed7;
  transform: translateY(-1px);
}

/* Hamburguer */
.menu {
  grid-area: burger;
  display: none;
  flex-direction: column;
  cursor: pointer;
  justify-content: center;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
}
.menu span {
  height: 3px;
  width: 25px;
  background: white;
  margin: 3px 0;
  border-radius: 5px;
  transition: 0.3s;
}

/* Animação hamburguer em X */
.menu.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.menu.open span:nth-child(2) {
  opacity: 0;
}
.menu.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

.aff-nav-only-desktop {
  display: list-item;
}

/* Responsividade */
@media (max-width: 1024px) {
  .aff-products-grid { grid-template-columns: repeat(2, 1fr); }
  .aff-categories { grid-template-columns: repeat(3, 1fr); }
  .aff-banners { grid-template-columns: 1fr; }
  .aff-nav-only-desktop { display: none; }
}

@media (max-width: 768px) {
  .header {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "logo burger"
      "search search"
      "nav nav";
  }

  .logo { font-size: 1.1rem; }
  .menu { display: flex; }

  /* Troca logo no mobile */
  .logo img {
    display: none; /* esconde a imagem padrão */
  }
  .logo span {
    display: none; /* esconde o texto */
  }
  .logo {
    width: 100px;   /* largura fixa */
    height: 100px;  /* altura fixa */
    border-radius: 10px;
    border: solid red;

    background-image: url("/img/logo.srpromocoes.PNG");
    background-size: contain;   /* mostra a imagem inteira */
    background-repeat: no-repeat;
    background-position: center; /* centraliza a imagem */
  }

  /* Menu escondido por padrão */
  .header nav ul {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 8px;
    max-height: 0;
    overflow: hidden;
    padding: 0 10px;
    border-radius: 14px;
    transition: max-height 0.3s ease, padding 0.3s ease;
  }

  /* Menu visível quando toggleMenu adiciona .show */
  .header nav ul.show {
    max-height: 500px;
    padding: 10px;
  }

  .header nav ul a {
    justify-content: flex-start;
  }
}
