/*
========================================
  TABELA DE CONTEÚDOS
========================================
1. RESET & ESTILOS GERAIS
2. CLASSES UTILITÁRIAS
3. HEADER
   - Estrutura Principal do Header
   - Topo do Header (Logo & Título)
   - Ícones Sociais
4. NAVEGAÇÃO & MENU
   - Navegação Principal (Desktop)
   - Menu Hambúrguer & Mobile/Tablet (Slide-in)
5. SEÇÃO HERO & BARRA DE BUSCA
   - Estrutura da Seção Hero
   - Barra de Busca (Desktop)
   - Barra de Busca (Mobile/Tablet)
6. CONTEÚDO PRINCIPAL (MAIN)
   - Estrutura da Página e Botão de Voltar
   - Grid de Produtos
   - Cards de Produto
   - Indicadores de Carregamento
7. SEÇÃO SOBRE
8. FOOTER (RODAPÉ)
========================================
*/

/* ========================================
   1. RESET & ESTILOS GERAIS
   ======================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background-color: #efefef;
  color: #333;
}

/* ========================================
   2. CLASSES UTILITÁRIAS
   ======================================== */

.search-hidden {
  display: none !important;
}

/* Em telas maiores (desktop), mudamos o comportamento da MESMA classe */
@media (min-width: 1025px) {
  .search-hidden {
    display: inline-block !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

.hide-section {
  display: none !important;
}

/* ========================================
   3. HEADER
   ======================================== */

header {
  background-color: #d9e4dd;
  padding: 10px 20px;
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: center;
  border-bottom: transparent;
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: box-shadow 0.3s ease-in-out;
}

header.scrolled {
  box-shadow: 0px 7px 4px 0px rgba(0,0,0,0.2);
}

.header-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 40px;
}

.logo {
  width: 100px;
  height: auto;
  flex-shrink: 0;
}

.site-title {
  font-size: 1.6rem;
  font-weight: bold;
  color: #000;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.social-icons {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  max-width: 1200px;
  margin-bottom: 10px;
}

.social-icons img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  cursor: pointer;
  transition: transform 0.2s;
}

.social-icons img:hover {
  transform: translateY(-2px);
}

/* ========================================
   4. NAVEGAÇÃO & MENU
   ======================================== */

nav {
  width: 100%;
  max-width: 1200px;
  display: flex;
  justify-content: center;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 20px;
  padding: 0;
  margin: 0;
}

nav ul li a {
  text-decoration: none;
  color: #333;
  font-weight: 500;
  padding-bottom: 10px;
  border-bottom: 20px solid transparent;
}

nav ul li a:hover {
  border-color: #000;
}

/* Menu no desktop (min-width: 1025px) */
@media (min-width: 1025px) {
  .menu-content {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .menu-content .social-icons {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
  }

  .menu-content nav ul li a {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 0 10px;
    border-bottom: 2px solid transparent;
    position: relative;
  }

  .menu-content nav ul li a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 10px;
    right: 10px;
    height: 2px;
    background-color: transparent;
    transition: background-color 0.3s ease;
  }

  .menu-content nav ul li a:not(.active):hover::after,
  .menu-content nav ul li a:not(.active):active::after {
    background-color: #000;
  }

  .menu-content nav ul li a.active {
    color: #000;
    border-bottom: 2px solid #000;
  }
}

.menu-toggle {
  display: none !important;
}

.close-button {
  display: none;
}

/* Layout Mobile e Tablet (max-width: 1024px) */
@media (max-width: 1024px) {
  header {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .header-top {
    width: 100%;
    flex-wrap: nowrap;
    margin-bottom: 10px;
  }

  .logo {
    width: 70px;
  }

  .site-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  /* Esconde o menu de desktop */
  .menu-content nav {
    display: none;
  }
  
  .menu-toggle {
    display: block !important;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #000;
    margin-top: -2px;
    margin-left: auto;
    flex-shrink: 0;
  }
  
  /* Estiliza o menu lateral que aparece */
  .menu-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background-color: #ffffff;
    border-left: 1px solid #ddd;
    position: fixed;
    top: 0;
    left: -250px;
    width: 250px;
    height: 100%;
    z-index: 999;
    padding: 20px;
    box-shadow: 4px 0 10px rgba(0,0,0,0.1);
    transition: left 0.3s ease;
    border-radius: 0 20px 20px 0;
  }
  
  .menu-content.show {
    left: 0;
  }

  .close-button {
    display: block;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #000;
    align-self: flex-end;
    margin-bottom: 10px;
  }
  
  /* Reativa a navegação dentro do menu lateral */
  .menu-content nav {
    display: flex;
    flex: 0;
  }

  .menu-content nav ul {
    flex-direction: column;
    gap: 15px;
    width: 100%;
    align-items: flex-start;
  }
  
  .menu-content .social-icons {
    margin-top: 20px;
    width: 100%;
    justify-content: space-around;
  }

  .menu-content nav ul li a {
    border-bottom: none;
    position: relative;
    padding-bottom: 5px;
  }

  .menu-content nav ul li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background-color: transparent;
    transition: background-color 0.3s ease;   
  }

  .menu-content nav ul li a.active::after,
  .menu-content nav ul li a:hover::after,
  .menu-content nav ul li a:focus::after {
    background-color: #000;
  }
}

/* ========================================
   5. SEÇÃO HERO & BARRA DE BUSCA
   ======================================== */

.hero {
  text-align: center;
  margin: 20px 0;
  width: 100%;
}

.hero-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding: 0 20px;
  gap: 20px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.hero h1 {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2.5rem;
  margin: 0;
  color: #141414;
}

.search-bar {
  position: relative;
  display: inline-block;
  width: 300px;
}

.search-bar input {
  width: 100%;
  padding: 8px 40px 8px 12px;
  border: 1px solid #ccc;
  border-radius: 20px;
  outline: none;
  font-size: 1rem;
}

.search-bar button {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  background-color: transparent;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: #333;
}

.search-bar.sticky {
  position: fixed;
  top: 150px;
  right: 375px;
  left: auto;
  z-index: 1000;
  background-color: #d9e4dd;
  padding: 8px 0px;
  border-radius: 20px;
  width: 300px;
  transition: all 0.3s ease;
}

.search-toggle {
  display: none !important;
}

/* Oculta a lupa no desktop */
@media (min-width: 1025px) {
  .search-toggle {
    display: none !important;
  }
}

/* Layout de Hero e Busca para Mobile/Tablet (max-width: 1024px) */
@media (max-width: 1024px) {
  .hero {
    padding: 0 20px;
    max-width: 90%;
    margin: 0 auto;
  }

  .hero-header {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
  }
  
  .hero h1 {
    position: static;
    transform: none;
    font-size: 2rem;
    text-align: center;
  }

  /* Esconde a barra de busca do desktop */
  .hero .search-bar,
  .search-bar.sticky {
    display: none;
  }

  /* Exibe e estiliza a barra de busca de mobile/tablet */
  .search-toggle {
    display: block !important;
    position: relative;
    width: 100%;
    height: 40px;
    margin: 15px 0;
    border: 1px solid #ccc;
    border-radius: 20px;
    background-color: #fff;
  }

  .search-toggle input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 1px 50px 1px 20px; 
    border: none;
    background-color: transparent;
    outline: none;
    font-size: 1rem;
    z-index: 1;
  }

  .search-toggle .search-icon {
    position: absolute;
    top: 0;
    right: 0;
    width: 50px; 
    height: 100%;
    border: none;
    background-color: transparent;
    cursor: pointer;
    font-size: 1.2rem;
    color: #333;
    z-index: 2;
  }
}

/* ========================================
   6. CONTEÚDO PRINCIPAL (MAIN)
   ======================================== */

main {
  flex: 1;
  padding: 20px 0;
  width: 100%;
  display: flex;
  justify-content: center;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.back-button {
  background-color: #000000;
  color: #fff;
  padding: 10px 20px;
  border: none;
  border-radius: 20px;
  font-size: 1rem;
  cursor: pointer;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  column-gap: 0px;
  row-gap: 25px;
  margin: 0 auto;
  max-width: 1200px;
  padding: 0 10px;
}

@media (min-width: 600px) {
  .grid {
    grid-template-columns: repeat(auto-fit, minmax(266px, 1fr));
  }
}

@media (max-width: 1200px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1024px) {
  .grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    grid-template-columns: repeat(2, 50%);
  }
}

.card {
  background-color: #ffffff;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 15px;
  text-align: center;
  box-shadow: 0 0 10px rgba(0,0,0,0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  transform: scale(0.95);
}

.card:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.card-image img {
  max-width: 100%;
  max-height: 160px;
  height: auto;
  object-fit: contain;
   aspect-ratio: 1/1; /* <-- ADICIONE ESTA LINHA (use 4/3, 16/9 ou 1/1 dependendo do formato das suas imagens) */
}

.card h3 {
  font-size: 1rem; /* 2º mais importante: Título */
  margin: 10px 0;
  min-height: 2.4em; 
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.description {
  font-size: 0.85rem; /* 3º mais importante: Texto de apoio (o menor) */
  color: #555;       /* Cor um pouco mais suave para diminuir o peso visual */
  line-height: 1.5;   /* Melhora a legibilidade do texto menor */
}

.price {
  font-size: 1.2rem;  /* 1º mais importante: Preço (o maior) */
  font-weight: bold;
  color: #e53935;
}

.offer-button {
  display: inline-block;
  background-color: #FFA500;
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  text-decoration: none;
  font-size: 1rem;
  margin-top: 10px;
}

/* VERSÃO COMPLETA DO BLOCO ATUALIZADO */
@media (max-width: 1024px) {
  .card {
    width: calc(50% - 0px);
    height: auto;
    padding: clamp(8px, 2vw, 15px);
  }

  .card h3 {
    font-size: clamp(0.8rem, 3vw, 1rem);
  }

  .description {
    /* O texto da descrição agora é responsivo e menor que os outros */
    font-size: clamp(0.5rem, 2.5vw, 0.8rem);
    line-height: 1.4; 
  }

  .price {
    /* O preço continua sendo o maior, seguindo a hierarquia */
    font-size: clamp(0.91rem, 3.5vw, 1.2rem);
  }

  .offer-button {
    padding: clamp(6px, 2.5vw, 10px) clamp(10px, 4vw, 16px);
    font-size: clamp(0.8rem, 3vw, 1rem);
  }

  .card-image img {
    max-height: clamp(130px, 25vw, 160px);
  }
}

#loading, 
#loading-bebes, 
#loading-automotivos {
  text-align: center;
  margin: 60px;
  font-size: 1rem;
  color: #666;
}

/* ========================================
   7. SEÇÃO SOBRE
   ======================================== */
   
.sobre-content {
  grid-column: 1 / -1;
  background: #efefef;
  padding: 20px;
  font-size: 1.1rem;
  line-height: 1.6;
  border-bottom: 1px solid #000;
}

.sobre-content h2 {
  font-size: 2rem;
  margin-bottom: 15px;
  text-align: center;
}

.sobre-content p {
  margin-bottom: 10px;
  text-align: justify;
  font-weight: bold;
}

/* ========================================
   8. FOOTER (RODAPÉ)
   ======================================== */

footer {
  background-color: transparent;
  color: #282828;
  text-align: center;
  padding: 10px 20px;
}



/*
========================================
  AJUSTE FINO PARA TELAS MUITO ESTREITAS
  (max-width: 360px)
========================================
*/
@media (max-width: 360px) {

  /* Reduz o tamanho da logo para ganhar mais espaço horizontal */
  .logo {
    width: 55px;
  }

  /* Diminui a fonte do título para evitar que ele seja cortado */
  .site-title {
    font-size: 1.4rem; /* Um tamanho menor para caber na linha */
    letter-spacing: 1px; /* Reduz um pouco o espaçamento entre as letras */
  }

  /* Opcional: Reduz o espaçamento entre a logo e o título */
  .header-top {
    gap: 8px;
  }
  
}


/*
========================================
  AJUSTE PARA TABLET: Centralizar Logo e Título
========================================
*/
@media (min-width: 769px) and (max-width: 1024px) {

  /* 1. Adicionamos posicionamento relativo para poder ancorar o botão de menu */
  .header-top {
    position: relative;
    /* Agora que o botão sairá do fluxo, podemos centralizar o que sobrou */
    justify-content: center;
  }

  /* 2. Tiramos o botão do fluxo normal e o posicionamos no canto direito */
  .menu-toggle {
    position: absolute;
    right: 0; /* Alinhado à direita do container .header-top */
    top: 50%;
    transform: translateY(-50%);
    margin-left: 0; /* Removemos a margem que empurrava tudo */
  }

}


/*
===========================================================
  AJUSTE FINO PARA CARDS EM TELAS MUITO ESTREITAS
===========================================================
*/
@media (max-width: 360px) {

  /* Ajusta o padding interno do card para dar mais respiro */
  .card {
    padding: 10px;
  }

  /* Diminui o título do produto */
  .card h3 {
    font-size: 0.8rem;   /* Um pouco menor que o padrão mobile */
    min-height: auto;      /* Remove a altura mínima para o card poder encolher */
    margin: 8px 0;         /* Ajusta a margem */
  }

  /* Esta é a mudança principal para reduzir o comprimento do card */
  .description {
    font-size: 0.7rem;  /* Texto da descrição visivelmente menor */
    line-height: 1.4;      /* Ajusta o espaçamento entre as linhas */
  }

  /* Ajusta o preço */
  .price {
    font-size: 0.9rem;   /* O preço ainda se destaca, mas um pouco menor */
  }

  /* Ajusta o botão de oferta */
  .offer-button {
    font-size: 0.75rem;     /* Texto do botão menor */
    padding: 6px 14px;      /* Preenchimento (padding) do botão reduzido */
    margin-top: 8px;        /* Ajusta a margem */
  }
  
}


/*
========================================
  ESTILO DO LOGO DA LOJA NO CARD
========================================
*/

/* 1. Prepara o container da imagem para posicionar o logo dentro dele. */
.card-image {
  position: relative;
}

/* 2. Estiliza e posiciona o logo da loja. */
.store-logo {
  position: absolute; /* Permite que ele "flutue" sobre a imagem do produto. */
  top: -5px;           /* Distância do topo. */
  left: -5px;          /* Distância da esquerda. */
  width: 30px;        /* Largura do logo. Ajuste se necessário. */
  height: auto;       /* Altura automática para manter a proporção. */
  z-index: 10;        /* Garante que o logo fique na frente da imagem do produto. */
  background-color: rgba(255, 255, 255, 0.7);
  border-radius: 4px; /* Bordas arredondadas. */
  padding: 2px;       /* Pequeno espaçamento interno. */
  box-shadow: transparent
}




/* ========================================
   ESTILOS DOS CARDS E OFERTA RELÂMPAGO
   ======================================== */

/* 1. Prepara o card para posicionamento de elementos internos */
.card {
  position: relative;
  overflow: hidden;
}

/* 2. Prepara o link da imagem para o posicionamento da tag */
.card-image a {
  position: relative;
  display: block; 
}

.time-container {
  position: absolute;
  top: 8px;
  right: 8px;
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  border-radius: 12px;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.6rem;
  font-weight: 600;
  color: #333;
  z-index: 15;
}

.relampago-tag {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background-color: #FFD700;
  color: #111;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.5rem;
  font-weight: 700;
  text-transform: uppercase;
  z-index: 10;
  letter-spacing: 0.5px;
  pointer-events: none;
}

/* ========================================
   BOTÃO RELÂMPAGO (VERSÃO DESKTOP)
   ======================================== */

/* O wrapper interno que alinha o conteúdo do botão especial */
.offer-button-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px; /* Espaço entre os GIFs e o botão */
  margin-top: 10px;
}

.lightning-gif {
  width: 45px;
  height: 45px;
}

/* Garante que o botão não tenha margem extra quando está no wrapper */
.offer-button-wrapper .offer-button {
  margin-top: 0;
}


/* ========================================
   RESPONSIVO - ESCONDE RAIOS NO MOBILE
   ======================================== */
@media (max-width: 1024px) {

  /* Em telas de tablet e celular, o GIF é escondido */
   .lightning-gif {
    display: none;
  }

  /* E o espaçamento extra dentro do botão é removido */
  .button-content-wrapper {
    gap: 0;
  }
}

/* Botão Voltar ao Topo */
#backToTopBtn {
    display: none;
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 99;
    background-color: #f39c12;
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 1.4em;
    text-align: center;
    line-height: 48px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s ease, transform 0.2s ease;
}

#backToTopBtn:hover {
    background-color: #e67e22;
    transform: translateY(-3px);
}

@media (max-width: 768px) {
  #backToTopBtn {
        width: 40px;
        height: 40px;
        font-size: 1.2em;
        bottom: 15px;
        right: 15px;
        line-height: 40px;
    }
}

@media (max-width: 400px) {
  #backToTopBtn {
        width: 30px;
        height: 30px;
        font-size: 1.0em;
        bottom: 10px;
        right: 10px;
        line-height: 30px;
    }
}