/* ========== Logo no topo ========== */
.logo-topo {
  text-align: center;
  margin: 10px 0;
}
.logo-topo img {
  height: 80px;
}

/* ========== Menu (desktop e mobile) ========== */
.menu-bar {
  background: #000;
  color: #fff;
  display: flex;                /* desktop */
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  box-sizing: border-box;
  width: 100%;
}

.menu-bar nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
}

.menu-bar nav ul li a {
  color: #fff;
  text-decoration: none;
  font-weight: bold;
}

.menu-bar nav ul li a:hover {
  color: goldenrod;
  text-decoration: underline;
}

nav ul li a.active,
nav ul li a.active:hover {
  color: goldenrod;
  text-decoration: underline;
}

/* --- Bandeira --- */
.lang-switch {
  display: flex;
  align-items: center;
  margin-left: auto; /* direita no desktop */
}
.lang-icon {
  height: 28px;
  width: auto;
  display: block;
}

/* ---- MOBILE: força 2 linhas; menu em cima, bandeira à direita ---- */
@media (max-width: 820px) {
  .menu-bar {
    display: grid !important;       /* vira GRID no mobile */
    grid-template-columns: 1fr auto;/* menu ocupa largura, bandeira na direita */
    grid-template-rows: auto;       /* só uma linha de grid */
    row-gap: 8px;
    padding: 10px 12px;
    box-sizing: border-box;
    width: 100%;
    align-items: center;            /* centraliza verticalmente */
  }

  .menu-bar nav {
    grid-column: 1 / 2;             /* menu na primeira coluna */
  }

  .menu-bar nav ul {
    justify-content: center;
    flex-wrap: wrap;                /* permite quebrar em várias linhas */
    gap: 12px;
  }

  .menu-bar nav ul li a {
    font-size: 17px;
    line-height: 1.2;
  }

  /* Bandeira fica sempre alinhada à direita */
  .menu-bar .lang-switch,
  .menu-bar > a:last-child {
    grid-column: 2 / 3;
    justify-self: end;
    display: flex;
    justify-content: flex-end;
    margin-left: 0;
  }

  .menu-bar img.lang-icon {
    height: 26px;
    width: auto;
    display: block;
  }
}

/* ========== Conteúdo principal ========== */
main { text-align: center; padding: 50px 20px; }

/* ========== Rodapé ========== */
footer {
  background: #000;
  color: #fff;
  text-align: center;
  padding: 20px;
  margin-top: 40px;
}

/* ========== Cards dos livros ========== */
.book {
  background: #f5f5f5;
  border-radius: 12px;
  box-shadow: 0 0 8px rgba(0,0,0,0.1);
  padding: 15px;
  width: 260px;
  max-width: 100%;
  text-align: center;
  transition: transform 0.3s ease;
}
.book:hover { transform: scale(1.02); }
.book img {
  width: 100%;
  height: auto;
  max-height: 340px;
  object-fit: cover;
  border-radius: 8px;
}
.book-title { font-size: 1.1em; font-weight: 700; margin: 12px 0; }
.book-buttons a {
  display: block;
  margin: 8px 0;
  padding: 10px;
  background: #000;
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
}

/* Responsividade de cards */
@media (max-width: 768px) { .book { width: 45%; } }
@media (max-width: 500px) { .book { width: 90%; } }

/* ========== Imagem de topo ========== */
.header-img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* ========== Animação de piscar (se usada) ========== */
.blink { animation: blinkEffect 1.5s infinite; }
@keyframes blinkEffect {
  0% { opacity: 1; }
  50% { opacity: 0.1; }
  100% { opacity: 1; }
}

/* ========== Capa dos livros: mostrar a imagem completa, sem corte ========== */
.book-card img,
.book-cover {
  width: 100%;
  height: auto !important;
  object-fit: contain !important;
  display: block;
  background: #fff;
  max-height: none !important;
}
.book-card .cover { height: auto !important; }
.book-card { height: auto !important; }

/* ========== Grade da página de Livros ========== */
.books-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(4, minmax(0, 1fr)); /* desktop grande */
  align-items: start;
}
.books-grid .book { width: auto !important; box-sizing: border-box; }
.books-grid .book img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  background: #fff;
  border-radius: 8px;
}
@media (max-width: 1024px) {
  .books-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .books-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}