/* RESET CSS */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Verdana, Geneva, Tahoma, sans-serif;
}

ul {
    list-style: none;
}

h1,
h2,
h3 {
    text-align: center;
    font-family: Arial, sans-serif;
}

a {
    user-select: none;
    display: inline-block;
    text-decoration: none;
}

img {
    display: block;
    width: 100%;
}

/* ************************************************** */

.background-container {
    background-image: url(../img/fondo_berlinHBF.jpg);
    background-attachment: fixed;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    min-height: 100vh;
    position: relative;
}

#main-head {
    color: rgb(255, 255, 255);
    margin-top: 1.5em;

    &::after {
        content: "";
        display: block;
        height: 3px;
        width: 60%;
        background-color: rgb(255, 255, 255);
        margin: 0 auto;
        margin-bottom: 1em;
        max-width: 300px;
    }
}

.menu {
    & ul {
        position: fixed;
        top: 30px;
        right: 0;
        width: 100%;
        height: 100%;
        background-color: rgb(255, 255, 255);
        transform: translateX(100%);
        transition: 0.8s;
    }
    & ul li {
        margin: 1.5em 0;
    }
    & li:first-of-type a {
        text-transform: uppercase;
        color: black;
    }
    & ul.mostrar {
        transform: translateX(0);
    }
}

.fa-bars {
    position: absolute;
    right: 0;
    top: 5px;
    font-size: 1.2em;
    cursor: pointer;
    margin: 0 10px;
    color: rgb(255, 255, 255);

    &:hover {
        color: rgb(217, 51, 84);
    }
}

.fa-times {
    position: absolute;
    top: 0.5em;
    left: 0.5em;
    cursor: pointer;

    &:hover {
        color: rgb(217, 51, 84);
        transform: rotate(90deg);
        transition: all 0.5s;
    }
}

/* ESTILOS PARA EL CONTENEDOR PRINCIPAL DEL INDEX (BUSCADOR, DESPLEGABLE Y BOTÓN*/
.main-container {
    display: flex;
    flex-direction: column;
    max-width: 500px;
    margin: auto;
    width: 95%;

    & select {
        padding: 10px;
        margin-bottom: 1em;
        font-size: 1.1em;
        background-color: rgb(130, 0, 94);
        color: rgb(255, 255, 255);
        display: block;
        border-radius: 20px;
        width: 100%;
        outline: none;
    }
    & input[type='submit'] {
        display: block;
        margin: 10px 0;
        padding: 10px;
        border: 0;
        font-size: 1.1em; /* Corregido: 'font' a 'font-size' */
        cursor: pointer;
        background-color: rgb(217, 51, 84);
        color: rgb(255, 255, 255);
        width: 100%;
        border-radius: 20px;
        text-transform: uppercase;
    }
    & #form-buscador{
        display: flex;

        & label {
            position: relative;
            margin: 0;
            padding: 0;

            & .fa-caret-square-right {
                position: absolute;
                top: -1px;
                right: 8px;
                color: #D93354;
                font-size: 31px;
                cursor: pointer;
                display: block;
            }
        }
        & input[type="text"]{
            padding: 5px;
            margin-right: 0.5em;
            width: 75vw;
        }
        & #btn-submit {
            display: none;
        }
    }
}


/* ESTILOS PÁGINA VISTA_RDOS FORMATO PC */
/* BARRA DE PROGRESO */
.container-progressbar {
    width: 100%;
    height: 5px;
    background-color: rgb(0, 0, 0);
    position: fixed;
    z-index: 200;

    & .progressbar {
        width: 0%;
        height: 100%;
        background-color: rgb(217, 51, 84);
    }
}

/* **************** VISTA RESULTADOS (TARJETAS) *************************** */
.container-tarjetas {
    display: grid;
    /* Crea tantas columnas como quepan (mínimo 410px de ancho) */
    grid-template-columns: repeat(auto-fill, minmax(410px, 1fr));
    gap: 30px;
    width: 90%;
    max-width: 100%;
    margin: 0 auto;
    padding-top: 80px;
    padding-bottom: 10px;

    & .tarjeta-libro {
        background-color: #e2eff6;
        border: 1px solid #937ef8;
        border-radius: 8px;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        padding: 15px;
        display: flex;
        flex-direction: column;
        min-height: 300px;
        height: 100%;
        transition: transform 0.2s, box-shadow 0.2s;

        &:hover {
            transform: translateY(-5px);
            box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
            background-color: #bae7ff;
        }
        & .cont_1 h3 {
            text-align: left;
            font-size: 1.3em;
            color: #4682b4;
            margin-top: 0;
            margin-bottom: 15px;
            border-bottom: 1px solid #eee;
            padding-bottom: 10px;
        }
        & .tarjeta-cuerpo {
            display: flex;
            flex-grow: 1;
            gap: 15px;

            & .cont_2 {
                flex-basis: 150px;
                width: 150px;
                flex-shrink: 0;
                text-align: center;
                display: flex;
                align-items: flex-start;
                justify-content: center;
                margin: 0;

                & img{
                    max-width: 100%;
                    height: auto;
                    max-height: 200px;
                    object-fit: contain;
                    border: 1px solid #f0f0f0;
                    border-radius: 4px;
                }
            }
            & .cont_3 {
                flex-grow: 1;
                padding: 0;
                font-size: 0.9em;

                & p{
                    margin: 3px 0;
                    color: #333;
                    display: block;

                    & strong {
                        font-weight: bold;
                        color: #000;
                         min-width: 80px;
                        flex-shrink: 0;
                        padding-right: 5px;
                        display: inline-block;
                    }
                    & span {
                        font-weight: normal;
                        color: #555;
                    }
                    & span#editor {
                        max-width: 95%;
                        white-space: nowrap;
                        overflow: hidden;
                        text-overflow: ellipsis;
                        flex-grow: initial;
                        min-width: initial;
                    }

                }
            }
        }
    }
}
/*************************************************************************/

/* ESTILOS PÁGINA ACERCA DE... */
.fa-arrow-left {
    font-size: 1.2em;
    cursor: pointer;
}

.page-version {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #f0f0f0;
    padding: 1em;
    border: 1px solid #4682b4;
    border-radius: 5px;

    & dl, dt, dd {
        margin: 0;
        padding: 0
    }
    & dt {
        font-weight: bold;
        font-size: 1.2em;
        color: #000000;
    }
    & dd {
        margin-bottom: 20px;
        font-size: 1.1em;
        font-weight: bold;
        color: #4682b4;
    }
    & #copy {
        color: #8319ec;
        font-family: Helvetica, sans-serif;
        font-style: italic;
        padding: 0;
        margin: 0;
    }
}

/* ESTILOS PARA LOS LINKS PARA ACCEDER A GESTION BD */
.menu {
    & .info {
        display: block;
        color: rgb(0, 0, 0);
        text-align: center;

        & .fa-book-open,
          .fa-chart-pie,
          .fa-file-pdf,
          .fa-info,
          .fa-file-audio {
            display: inline-block;
            margin-right: 0.5em;
        }
    }
    & #gestion {
        & li {
            margin: 0.5em 0;
            text-align: center;
        }
        & p{
            color: rgb(10, 133, 235);
            text-align: center;
            border-bottom: 1px solid #4682b4;
            font-size: 1.2em;
            font-weight: bold;
            margin: 0;
        }
    }
}

/**********************************************

/* BOTÓN DE VUELTA AL INDEX ICONO DE LA 'CASITA' */
#linkBack {
    display: inline-block;
    background-color: rgba(120, 161, 195, 0.59);
    padding: 10px;
    border: 1px solid #fff;
    border-radius: 20px;
    color: rgb(255, 255, 255);
    font-weight: bold;
    position: fixed;
    top: 5px;
    left: 5px;
    z-index: 100;
}


/* ESTILOS PARA EL BOTÓN DE FLECHA ARRIBA */
.go-top-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    width: 3.3rem;
    height: 3.3rem;
    z-index: -1;

    & .go-top-button {
        width: 0rem;
        height: 0rem;
        background: rgba(220, 20, 60, 0.6);
        border-radius: 50%;
        cursor: pointer;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: -1;

        & i{
            position: absolute;
            font-size: 1.5rem;
            top: 48%;
            left: 50%;
            transform: translate(-50%, -50%) scale(0);
            color: rgb(255, 255, 255);
            transition: .2s;
        }
    }
    &.show {
        z-index: 10;

        & .go-top-button {
            animation: popup .3s ease-in-out;
            width: 3.3rem;
            height: 3.3rem;
            z-index: 11;
        }
        &.show i{
            transform: translate(-50%, -50%) scale(1);
        }
    }
}

/* ESTILOS PARA LA PÁGINA QUE MUESTRA TODOS LOS LIBROS */
#seleccion {
    display: block;
    margin-bottom: 10px;
    text-transform: uppercase;
    background-color: cadetblue;
    padding: 15px;
    text-align: center;
    color: rgb(255, 255, 255);
    position: sticky;
    left: 0;
    top: 0;
    max-width: 800px;
    margin: auto;
}

.book-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 800px;
    margin: auto;

    & img {
        display: block;
        margin: 8px;
        border: 2px solid steelblue;
        border-radius: 10%;
        width: 20%;
        object-fit: cover;
    }
    & h2, h3{
        margin: 0;
        padding: 0;
        text-align: center;
        font-family: sans-serif;
        width: 100%;
        background-color: rgb(10, 133, 235);
        padding: 5px;
        color: rgb(255, 255, 255);
    }
    & h3{
        background-color: cornflowerblue;
        font-weight: normal;
    }
}

/* ESTILOS PARA LA PÁGINA DE ESTADÍSTICAS */
.stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-gap: 0.5em;
    margin: 0 auto;
    padding-top: 2em;
    width: 80%;
    max-width: 800px;

    & .theme {
        grid-column: 1 / -1;
        font-family: sans-serif;

        & dl {
            display: flex;
            flex-direction: row;
            align-items: center;
            padding: 0.1em 0.2em;
            background-color: #000000;
            padding: 0.4em;

            & dt {
                font-size: 1.2rem;

                &:first-of-type,
                &:last-of-type {
                    color: rgb(4, 128, 236);
                    text-transform: uppercase;
                }
                &  a {
                    color: rgb(255, 255, 255);
                }
            }
            & dd {
                margin-bottom: 0;
                margin-left: auto;
                color: rgb(255, 255, 255);
                font-weight: bold;
                font-size: 1.2rem;
            }

        }

    }
}

/* *********************************************************** */

#search {
    background: none;
    height: auto;
}

#lupa {
    margin: 0.5em;
    color: rgb(255, 255, 255);
    cursor: pointer;
}

.search-container {
    position: fixed;
    top: 0.5em;
    left: 35px;
    transform: translateX(-140%);
    transition: 0.5s;
}
/* CLASES APLICABLES CUANDO SE HACE CLICK EN LA LUPA (BUSCADOR) */
.mostrar {
    transform: translateX(0);
    z-index: 2;
}

.difuso {
    filter: blur(20px);
}
/* *************************************************************** */

/* ESTILOS PARA MOSTRAR ERROR CUANDO EL BUSCADOR NO ENCUENTRA ALGO */
#error {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 100%;
    transform: translate(-50%, -50%);

    background-color: rgb(217, 51, 84);
    color: rgb(255, 255, 255);
    text-align: center;
    padding: 0.5em;
    margin: auto;
    max-width: 800px;
}

/* ESTILOS PÁGINA DE ARCHIVOS DE AUDIO */
#audio-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding-top: 1em;
    height: 90vh;

    & audio {
        transition: all 0.5s linear;
        border-radius: 7px;

        &:hover,:focus,:active{
           transform: scale(1.05);
        }
    }
    & p {
        margin: 0.5em;
        text-transform: capitalize;
        color: rgb(255, 255, 255);
        background-color: rgb(0, 0, 0);
        padding: 0.3em;
        border-radius: 5px;
        font-weight: 500;
    }
}

@keyframes popup {
    0% {
        width: 0rem;
        height: 0rem;
    }

    50% {
        width: 6rem;
        height: 6rem;
    }

    100% {
        width: 3.3rem;
        height: 3.3rem;
    }
}


/* DISEÑO RESPONSIVE PARA LA TABLA EN FORMATO MÓVIL */
@media (max-width: 600px) {
    .background-container {
        background-image: url(../img/viasTren.jpg);
    }

    #gestion {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;

        & a{
            margin-bottom: 0;
        }
    }

    .index-container {
        width: 80%;
        margin: auto;
    }

    .container #form-reg {
        width: 100%;
    }

    .book-container img {
         flex: 0 1 44%;
    }

    /* CAMBIO DE TAMAÑO LETRA EN PÁGINA STATS */
    .theme {
        & dt {
            font-size: 1.3rem;
        }
        & dd {
            font-size: 1.3rem
        }
    }

    #seleccion {
        font-size: 2.7vw;
    }

    /* ESTA REGLA APLICA SÓLO A LA VISTA DE RESULTADOS DEL BUSCADOR */
    .main-container {
        width: 100%;
    }

    /* ESTA REGLA APLICA A LOS RESULTADOS DE BUSQUEDA (TARJETAS) */
    .background-container {
        width: 100%;
        overflow: hidden;
        padding: 0;
    }

    .container-tarjetas {
       grid-template-columns: 1fr;
	   width: 100%;
	   margin: 0;
	   gap: 20px;
	   padding-top: 80px;
	   padding-bottom: 10px;
    }

    .tarjeta-libro {
        padding: 0.5em;
		width: 90%;
		max-width: 410px;
		margin: 0 auto;

    }

    .tarjeta-cuerpo {
        flex-direction: column;
    }

    .tarjeta-cuerpo .cont_2 {
        justify-content: flex-start;
    }

    .page-version {
        width: 90%;
    }

    .stats-container {
        font-size: 0.5em;
        padding-top: 7em;
    }
}