/* ==================== */
/* VARIÁVEIS E RESET    */
/* ==================== */
:root {
  --cor-primaria: #2c3e50;
  --cor-secundaria: #b7a53c;
  --cor-texto: #333;
  --cor-texto-claro: #7f8c8d;
  --cor-fundo: #f5f5f5;
  --cor-branco: #fff;
  --sombra-box: 0 2px 5px rgba(0, 0, 0, 0.1);
  --transicao: all 0.3s ease;
  --transparencia-overlay: 0.0;
  --transparencia-conteudo: 0.0;
  --cor-download: #3498db;
  --cor-download-hover: #2980b9;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ==================== */
/* ELEMENTOS BASE       */
/* ==================== */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--cor-fundo);
  color: var(--cor-texto);
  line-height: 1.5;
  padding-top: 60px;
  font-size: 14px;
  background-image: url('bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, var(--transparencia-overlay));
  z-index: -1;
}

h1 {
  color: var(--cor-primaria);
  margin-bottom: 25px;
  text-align: center;
  font-size: 1.8rem;
}

/* ==================== */
/* LAYOUT PRINCIPAL     */
/* ==================== */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 60px;
  background-color: var(--cor-primaria);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  box-shadow: var(--sombra-box);
  z-index: 1000;
}

main {
  max-width: 1200px;
  margin: 40px auto;
  padding: 20px;
  background-color: rgba(255, 255, 255, var(--transparencia-conteudo));
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* ==================== */
/* COMPONENTES          */
/* ==================== */
.header-left {
  display: flex;
  align-items: center;
  flex: 1;
}

.header-center {
  display: flex;
  justify-content: center;
  flex: 2;
}

.header-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex: 1;
  gap: 15px;
}

nav ul {
  display: flex;
  list-style: none;
  align-items: center;
  gap: 15px;
  margin: 0;
  padding: 0;
}

nav ul li a {
  color: var(--cor-branco);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  transition: var(--transicao);
  display: flex;
  align-items: center;
  gap: 5px;
}

nav ul li a:hover {
  color: var(--cor-secundaria);
}

.profile-dropdown {
  position: relative;
  display: inline-block;
}

.foto-perfil-menu {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--cor-secundaria);
  object-fit: cover;
  cursor: pointer;
  transition: var(--transicao);
  background-color: var(--cor-branco);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.foto-perfil-menu:hover {
  transform: scale(1.05);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background-color: var(--cor-branco);
  min-width: 200px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1001;
  display: none;
  margin-top: 10px;
  overflow: hidden;
}

.dropdown-menu.show {
  display: block;
  animation: fadeIn 0.3s ease;
}

.dropdown-menu a {
  display: block;
  padding: 12px 15px;
  color: var(--cor-primaria);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transicao);
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.dropdown-menu a:last-child {
  border-bottom: none;
}

.dropdown-menu a:hover {
  background-color: #f5f5f5;
  color: var(--cor-secundaria);
}

.dropdown-menu a i {
  width: 20px;
  text-align: center;
}

.search-container {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 500px;
}

.search-container form {
  display: flex;
  width: 100%;
}

.search-container input[type="text"] {
  padding: 8px 15px;
  border: none;
  border-radius: 4px 0 0 4px;
  width: 100%;
  font-size: 14px;
  background-color: rgba(255, 255, 255, 0.9);
}

.search-container button {
  padding: 8px 15px;
  background-color: var(--cor-secundaria);
  color: var(--cor-branco);
  border: none;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  transition: var(--transicao);
  font-size: 14px;
}

.search-container button:hover {
  background-color: #9c8c33;
}

/* ==================== */
/* ESTILOS NETFLIX      */
/* ==================== */
.categoria-container {
  margin-bottom: 40px;
}

.categoria-titulo {
  color: #fff;
  font-size: 1.5rem;
  margin-bottom: 15px;
  padding-left: 20px;
  font-weight: bold;
}

.livros-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 15px;
  padding: 0 20px;
  overflow-x: auto;
}

.livro-card {
  background: #2a2a2a;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  position: relative;
}

.livro-card:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  z-index: 10;
}

.livro-capa {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.livro-info {
  padding: 10px;
  color: #fff;
}

.livro-titulo {
  font-size: 0.9rem;
  font-weight: bold;
  margin-bottom: 5px;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.livro-autor {
  font-size: 0.8rem;
  color: #ccc;
  margin-bottom: 5px;
}

.livro-categoria {
  font-size: 0.7rem;
  color: #888;
}

.livro-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.livro-card:hover .livro-actions {
  opacity: 1;
}

.download-btn {
  background: var(--cor-download);
  color: white;
  border: none;
  border-radius: 50%;
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.3s ease;
}

.download-btn:hover {
  background: var(--cor-download-hover);
}

/* Menu sempre visível */
.login-btn {
  color: #fff;
  text-decoration: none;
  padding: 8px 16px;
  border: 1px solid #fff;
  border-radius: 4px;
  transition: background 0.3s ease;
}

.login-btn:hover {
  background: rgba(255,255,255,0.1);
}

.resultados-busca {
  margin-top: 20px;
}

.resultados-busca h2 {
  color: var(--cor-primaria);
  margin-bottom: 20px;
  font-size: 1.5rem;
  text-align: center;
}

.mobile-menu-icon {
  color: var(--cor-branco);
  font-size: 1.2rem;
  transition: var(--transicao);
  display: none;
}

.mobile-menu-icon:hover {
  color: var(--cor-secundaria);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== */
/* RESPONSIVIDADE       */
/* ==================== */
@media (max-width: 992px) {
  .header-left {
    flex: 1;
  }
  
  .header-center {
    flex: 3;
  }
  
  .header-right {
    flex: 1;
  }
}

@media (max-width: 768px) {
  body {
    padding-top: 80px;
    background-attachment: scroll;
  }

  header {
    height: 60px;
    padding: 5px 10px;
    flex-wrap: nowrap;
  }

  .header-left, 
  .header-center, 
  .header-right {
    flex: none;
    margin-bottom: 0;
  }

  .header-left {
    order: 1;
    width: auto;
  }

  .header-center {
    order: 2;
    flex-grow: 1;
    margin: 0 5px;
  }

  .header-right {
    order: 3;
    width: auto;
    gap: 10px;
  }

  .search-container {
    margin-left: 5px;
  }

  .foto-perfil-menu {
    width: 30px;
    height: 30px;
  }

  .dropdown-menu {
    min-width: 180px;
    right: -10px;
  }

  h1 {
    font-size: 1.2rem;
    margin: 5px 0;
    padding: 0;
  }

  main {
    margin-top: 5px;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.95);
  }

  /* GRADE NETFLIX MOBILE - 3 LIVROS POR LINHA */
  .livros-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 0 10px;
  }

  .livro-card {
    max-width: 100%;
  }

  .livro-capa {
    height: 180px;
  }

  .livro-info {
    padding: 8px;
  }

  .livro-titulo {
    font-size: 0.8rem;
    margin-bottom: 4px;
  }

  .livro-autor {
    font-size: 0.75rem;
    margin-bottom: 4px;
  }

  .livro-categoria {
    font-size: 0.7rem;
  }

  .download-btn {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
  }

  .categoria-titulo {
    font-size: 1.2rem;
    padding-left: 10px;
    margin-bottom: 10px;
  }

  .categoria-container {
    margin-bottom: 25px;
  }

  nav ul li a span {
    display: none;
  }

  /* ESCONDER ÍCONES DE MENU NO MOBILE */
  .mobile-menu-icon {
    display: none !important;
  }

  .header-right .profile-dropdown {
    display: block;
  }

  .dropdown-menu {
    position: fixed;
    top: 60px;
    right: 0;
    left: 0;
    min-width: auto;
    border-radius: 0;
    margin-top: 0;
  }
}

@media (max-width: 480px) {
  .livros-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 0 5px;
  }

  .livro-capa {
    height: 160px;
  }

  .livro-info {
    padding: 6px;
  }

  .livro-titulo {
    font-size: 0.75rem;
  }

  .livro-autor {
    font-size: 0.7rem;
  }

  .livro-categoria {
    font-size: 0.65rem;
  }

  .download-btn {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }

  .categoria-titulo {
    font-size: 1.1rem;
    padding-left: 5px;
  }

  .dropdown-menu {
    min-width: 100%;
    right: 0;
  }

  .header-right {
    gap: 5px;
  }

  .foto-perfil-menu {
    width: 28px;
    height: 28px;
  }
}