:root {
    --color-theme-dark: #1e1c1c;
    --color-theme-light: #d5cdcd;
    --color-theme-white: #ffffff;
    --color-theme-blue-dark: #20263e;
    --color-theme-orange: #d55222;
    --color-theme-cream: #caa67e;
    --color-theme-sky: #274367;

    --bar-horizontal-padding: 4rem;
    --library-padding: 3rem;

    --fs-title: 1.8rem;
    --fs-author: 1.4rem;
    --fs-pages: 1.2rem;
    --fs-read: 1.2rem;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: "Ubuntu", sans-serif;
}

body {
    height: 100vh;
    display: grid;
    grid-template: 5rem calc(100vh - 8rem) 3rem / 1fr;
    grid-template-areas:
        "topnav"
        "body"
        "footer";
}

/*Used to see borders during the develop process*/
/* div {
    border: 1px solid black;
} */

/* --------------------- Top Nav ----------------------- */
nav {
    width: 100%;
    background: linear-gradient(
        var(--color-theme-sky),
        var(--color-theme-blue-dark)
    );
    color: var(--color-theme-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--bar-horizontal-padding);
    grid-area: topnav;
    border-bottom: 2px solid var(--color-theme-sky);
}

nav .logo {
    font-size: 2rem;
    font-weight: bold;
    color: var(--color-theme-cream);
}

nav ul {
    list-style-type: none;
    display: flex;
    align-items: center;
}

nav ul li {
    font-size: 2rem;
    margin: 0 1rem;
    font-weight: bold;
}

.btn-nav:hover {
    cursor: pointer;
    user-select: none;
    color: var(--color-theme-orange);
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background: linear-gradient(
        var(--color-theme-light) 20%,
        var(--color-theme-white) 35%,
        var(--color-theme-light) 50%
    );
    color: var(--color-theme-dark);
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
    z-index: 1;
    font-weight: normal;
    width: 11rem;
}

#btn-sort:hover .dropdown-content {
    display: block;
    padding: 0 0.5rem;
    animation: fadeIn 0.5s;
    font-size: 1.2rem;
}

#btn-sort:hover .dropdown-content span {
    display: block;
}

#btn-sort:hover .dropdown-content span:hover {
    font-weight: bold;
    color: var(--color-theme-white);
    background-color: var(--color-theme-blue-dark);
    /* text-shadow: 0 0 2px 5px white; */
}

/* --------------------- Top Nav ----------------------- */

/* --------------------- Library ----------------------- */
.library-container {
    grid-area: body;
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    overflow: auto;
    background-image: linear-gradient(
            rgba(0, 0, 0, 0.5),
            rgba(255, 255, 255, 0.5)
        ),
        url("media/brick-pattern.png");
    /*Image by b0red from Pixabay 
    https://pixabay.com/users/b0red-4473488/?utm_source=link-attribution&utm_medium=referral&utm_campaign=image&utm_content=2997965*/
}

.library-container .books-container {
    width: min(90%, 1200px);
    padding: var(--library-padding) 0;
    margin: 0 auto;
    display: grid;
    grid-template: auto / repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    align-content: flex-start;
    height: fit-content;
}

.library-container .books-container .book {
    width: 100%;
    height: 280px;
    border-radius: 10px;
    border: 1px solid var(--color-theme-blue-dark);
}

.library-container .books-container .book:hover {
    box-shadow: 0 0 22px 2px var(--color-theme-white);
}

.book-title,
.book-author,
.book-pages,
.book-read,
.book-actions {
    padding: 0 1rem;
    display: flex;
    align-items: center;
}

.book-title {
    height: 35%;
    background-color: var(--color-theme-blue-dark);
    color: var(--color-theme-white);
    font-size: var(--fs-title);
    font-weight: bold;
    justify-content: space-between;
    border-radius: 10px 10px 0px 0px;

    /*To prevent long single words to overlap the title box*/
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-author {
    height: 20%;
    font-size: var(--fs-author);
    font-weight: bold;
    color: var(--color-theme-light);
    background-color: var(--color-theme-sky);
    font-style: italic;
}

.book-pages {
    height: 15%;
    font-size: var(--fs-pages);
    font-weight: normal;
    color: var(--color-theme-dark);
    background-color: var(--color-theme-light);
}

.book-pages::before {
    content: "Number of pages: ";
    margin-right: 4px;
}

.book-read {
    height: 15%;
    font-size: var(--fs-read);
    font-weight: normal;
    color: var(--color-theme-dark);
    background-color: var(--color-theme-cream);
}

.book-read::before {
    content: "Already read: ";
    margin-right: 4px;
}

.book-actions {
    height: 15%;
    justify-content: space-between;
    background-color: var(--color-theme-blue-dark);
    border-radius: 0 0 10px 10px;
}

.book-actions button {
    height: 70%;
    width: fit-content;
    background-color: var(--color-theme-blue-dark);
    border: none;
    color: var(--color-theme-light);
    font-weight: bold;
}

.book-actions button:hover {
    cursor: pointer;
    color: var(--color-theme-orange);
}
/* --------------------- Library ----------------------- */

/* --------------------- Footer ----------------------- */
footer {
    grid-area: footer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--bar-horizontal-padding);
    color: var(--color-theme-light);
    background: linear-gradient(
        var(--color-theme-dark),
        var(--color-theme-blue-dark)
    );
}

footer .github-contact a {
    color: var(--color-theme-white);
    text-decoration: none;
    font-size: 1.2rem;
}

footer .github-contact a:hover {
    color: var(--color-theme-orange);
}

footer .page-details {
    text-align: right;
}
/* --------------------- Footer ----------------------- */

/* --------------------- Popup Create New Book ----------------------- */
.popup-new-book {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    margin: auto;
    width: 350px;
    height: 400px;
    display: grid;
    grid-template: repeat(7, 1fr) 2fr / 1fr;
    padding: 1rem;
    background: linear-gradient(
        var(--color-theme-dark),
        var(--color-theme-blue-dark)
    );
    color: var(--color-theme-light);
    border-radius: 10px;
    visibility: hidden;
    z-index: 1;
    box-shadow: 0 0 2px 2px var(--color-theme-sky);
}

.show {
    visibility: visible;
    animation: fadeIn 0.5s;
}

/*Add animation (fade in in the popup)*/
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.popup-new-book label {
    font-size: 1.3rem;
    align-self: flex-end;
    margin-bottom: 0.5rem;
    margin-top: 1rem;
}

.popup-new-book input {
    font-size: 1rem;
}

.popup-new-book .popup-btn-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 1rem;
}

.popup-new-book .popup-btn-container button {
    height: 2.5rem;
    align-self: center;
    width: 100%;
    font-size: 1.1rem;
    border: none;
    border-radius: 2px;
    background-color: var(--color-theme-light);
    color: var(--color-theme-dark);
}

.popup-new-book .popup-btn-container button:hover {
    background-color: var(--color-theme-orange);
    color: var(--color-theme-white);
    cursor: pointer;
}

/*field validation in addBookToLibraryArray()*/
.field-required::after {
    content: " *";
    color: var(--color-theme-light);
}

.input-required {
    background-color: pink;
}
/* --------------------- Popup Create New Book ----------------------- */
