/* General Styles */
body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    margin: 0;
    padding: 0;
}

/* Menu Styles */
.menu {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: 0.3s;
    padding: 15px 20px;
}

.logo {
    display: flex;
    align-items: center;
}

.logo img {
    height: 40px;
}

.search {
    flex-grow: 1;
    display: flex;
    justify-content: center; /* Centra el buscador horizontalmente */
    margin: 0 40px; /* Ajusta el margen lateral */
}

.search-container {
    display: flex;
    align-items: center;
    position: relative;
    width: 60%;
    max-width: 600px; /* Establece un ancho máximo para el buscador */
}

.search-container input[type="text"] {
    padding: 10px 40px 10px 40px;
    font-size: 16px;
    border-radius: 25px;
    border: 1px solid #ccc;
    outline: none;
    transition: all 0.3s ease;
    width: 100%;
}

.search-container input[type="text"]:focus {
    border-color: #4CAF50;
}

.search-container button {
    background: none;
    border: none;
    cursor: pointer;
    color: #000;
    transition: color 0.3s ease;
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.search-container button:hover {
    color: #4CAF50;
}

.search-container button i {
    font-size: 20px;
}

.hamburger-menu {
    display: none;
    cursor: pointer;
    font-size: 24px;
}

.navbar-container {
    display: flex;
    align-items: center;
}

.navbar {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-direction: row;
}

.navbar a {
    color: #333;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.navbar a:hover,
.navbar a.active {
    color: #4CAF50;
}

#search-results {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-80%);
    width: 80%;
    max-width: 600px;
    background: rgba(255, 255, 255, 0.9);
    max-height: 360px;
    overflow-y: auto;
    z-index: 1001;
    border: 1px solid #ccc;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    margin-top: 10px;
    backdrop-filter: blur(5px);
}

#search-results ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#search-results li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
}

#search-results li:hover {
    background-color: #f2f2f2;
}

.consultar-button {
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px 20px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 16px;
}

.consultar-button:hover {
    background-color: #45a049;
}

.book-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin: 10px;
    padding: 10px;
    transition: box-shadow 0.3s ease;
    background-color: #fff;
}

.book-card:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.book-details {
    flex-grow: 1;
}

.book-card h3,
.book-card h4,
.book-card h5 {
    margin: 0;
    padding: 0;
}

.hidden {
    display: none;
}

/* Modern Hamburger Menu */
.hamburger-menu {
    display: block;
    cursor: pointer;
    width: 25px;
    height: 18px;
    position: relative;
    margin-right: 20px; /* Ajusta el margen para alinearlo a la derecha */
}

.hamburger-menu span {
    display: block;
    height: 2px;
    width: 100%;
    background-color: #333;
    position: absolute;
    transition: all 0.3s ease-in-out;
}

.hamburger-menu span:nth-child(1) {
    top: 0;
}

.hamburger-menu span:nth-child(2) {
    top: 8px;
}

.hamburger-menu span:nth-child(3) {
    top: 16px;
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg);
    top: 8px;
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg);
    top: 8px;
}

/* Responsive Styles */
@media screen and (max-width: 800px) {
    .menu {
        flex-direction: row;
        align-items: center;
        padding: 10px;
    }

    .search {
        flex-grow: 1;
        order: 2;
        margin: 0; /* Ajusta el margen a cero para dispositivos móviles */
        display: flex;
        justify-content: center; /* Centra el buscador en móviles */
    }

    .search-container {
        width: 50%; /* Ajusta el ancho al 100% del contenedor padre */
        max-width: none; /* Elimina el ancho máximo para dispositivos móviles */
    }

    .hamburger-menu {
        display: block;
        order: 3;
    }

    .logo img {
        height: 35px;
    }    

    .navbar-container {
        display: none;
        flex-direction: column;
        align-items: flex-end; /* Alinea los elementos a la derecha */
        width: 100%;
        position: absolute;
        top: 100%;
        right: 0;
        z-index: 999;
        background-color: #fff;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        padding: 10px;
    }

    .navbar-container.active {
        display: flex;
    }

    .navbar {
        flex-direction: column;
        align-items: flex-end; /* Alinea las palabras a la derecha */
        width: 100%;
    }

    .navbar a {
        margin-bottom: 10px;
        font-size: 14px;
        text-align: right; /* Alinea el texto a la derecha */
    }

    #search-results {
        width: 90%;
        max-width: none;
        left: 50%;
        transform: translateX(-50%); /* Centra el contenedor de resultados */
    }
}

@media screen and (min-width: 801px) {
    .navbar-container {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end; /* Ajusta para alinear a la derecha */
        width: auto;
    }

    .navbar {
        flex-direction: row;
        align-items: center;
        gap: 20px;
    }

    .hamburger-menu {
        display: none;
    }
}
