#header.header--flex {
  display: flex !important;
  align-items: center;
  justify-content: space-between;

  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  margin: 0 !important;
  border-radius: 0 !important;
  z-index: 9999 !important;

  /* Sombra más notoria */
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transition: box-shadow 0.3s ease;
}

/* Ajusta el contenedor izquierdo a flex */
.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Ajuste para evitar que el header tape contenido */
#content-wrap, body {
  padding-top: 56px !important; /* Altura exacta del header */
}

/* Dropdown de capítulos con hover */
.chapter-dropdown {
  position: relative;
  display: inline-block;
  margin-left: 1rem;
}

.chapter-dropdown button#chapterToggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.5rem 1rem;
  color: inherit;
  outline: none;
  transition: all 0.3s ease;
}

.chapter-dropdown button#chapterToggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.chapter-dropdown button#chapterToggle::after {
  content: '▼';
  margin-left: 0.5rem;
  font-size: 0.8rem;
  transition: transform 0.3s ease;
}

/* Hover effect - Mostrar menu al hacer hover */
.chapter-dropdown:hover .mega-menu {
  display: block !important;
  opacity: 1;
  transform: translateY(0);
}

.chapter-dropdown:hover button#chapterToggle::after {
  transform: rotate(180deg);
}

.mega-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border: 1px solid #ddd;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  width: 800px;
  max-height: 500px;
  overflow-y: auto;
  z-index: 1000;
  padding: 1rem;
  display: none; /* Oculto por defecto */
  grid-template-columns: 1fr;
  gap: 1.5rem;
  
  /* Animación suave */
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}

/* Mantener el menú visible cuando el cursor está sobre él */
.mega-menu:hover {
  display: block !important;
  opacity: 1;
  transform: translateY(0);
}

.book-section {
  display: flex;
  flex-direction: column;
}

.book-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #333;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
}

.chapter-card {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 0.75rem;
  text-decoration: none;
  color: #333;
  border: 1px solid #e0e0e0;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

.chapter-card:hover {
  background-color: #FFD706;
  border-color: #b3d1ff;
  color: #1c1c1c;
}

.chapter-name {
  font-weight: 500;
}

/* Responsive: En móviles mantener el comportamiento de click */
@media (max-width: 768px) {
  .chapter-dropdown:hover .mega-menu {
    display: none !important;
  }
  
  .mega-menu.mobile-open {
    display: block !important;
    opacity: 1;
    transform: translateY(0);
  }
}

.flex-container-column {
    display: flex;
    flex-direction: column;
    align-items: flex-start !important; /* sobrescribe el centrado */
    margin-left: -12rem; /* ajustar para mover el buscador del header */

}
