@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap');

:root{
    --primary: #118AB2;
    --secondary: #747371;
    --success: #06C6A0;
    --warning: #FFD166;
    --danger: #EF476F;
    --light: white;
}

body{
    margin: 0;
    font-family: "Roboto", sans-serif;
    font-weight: 300;
    background: var(--light);  
}

#main-content{
    min-height: calc(100vh - 140px);
}

h1, h2, h3, h4, h5, h6{
    font-weight: 300;
}

.text-secondary{
    color: var(--secondary);
}

.notification{
    position: fixed;
    left: 20px;
    bottom: 20px;
    padding: 15px;
    color: var(--light);
    background: var(--success);

    animation: fade-in 0.3s ease forwards, popup 0.3s ease forwards;
}

@keyframes fade-in{
    0%{ opacity: 0; }
    25%{ opacity: 0.25; }
    50%{ opacity: 0.5; }
    75%{ opacity: 0.75; }
    100%{ opacity: 1; }
}

@keyframes popup{
    0%{ transform: scale(0.01); }
    20%{ transform: scale(0.15); }
    40%{ transform: scale(0.25); }
    60%{ transform: scale(0.50); }
    80%{ transform: scale(0.75); }
    100%{ transform: scale(1); }
}

@keyframes slide-down{
    0%{ margin-top: 100px; }
    25%{ margin-top: 75px; }
    50%{ margin-top: 50px;  }
    75%{ margin-top: 25px;  }
    100%{ margin-top: 0px;  }
}

.form-bg{
    position: fixed;
    left: 0;
    top: 0;

    height: 100vh;
    width: 100vw;
    background: rgba(0,0,0,0.4);

    z-index: 1;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    animation: fade-in 0.3s forwards;
    animation-timing-function: ease-in;
}

/* It has a higher z-index because of addform hieritance */

.form{
    background: var(--light);
    width: 350px;
    padding: 25px;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    box-sizing: border-box;

    animation: slide-down 0.5s forwards, fade-in 0.5s forwards;
    animation-timing-function: ease-in;

    z-index: 2;
}

.form .form-title h2{
    margin-top: 0;
}

.form .close-btn{
    align-self: end;
    width: 20px; height: 20px;
}

.input-div{
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: 15px 0px;
    width: 100%;
}

.input-div > input[type="text"], .input-div > input[type="number"]{
    font-family: 'Roboto', sans-serif;
    font-weight: 300;
    font-size: 16px;
    padding: 10px 0px;
    border: 0;
    outline: 0;
    border-bottom: 1px solid var(--secondary);
}

.checkbox-div{
    flex-direction: row;
    margin: 20px 0px;
}

.form-btn{
    width: 100%;
}

.btn-primary{
    color: var(--light);
    background-color:  var(--primary);
}

.btn-danger{
    color: var(--light);
    background-color:  var(--danger);
}

.btn{
    padding: 10px;

    font-size: 18px;
    font-weight: 300;
    outline: 0;
    border: 0;

    cursor: pointer;
    transition: filter 0.4s ease;
}

.btn:hover{
    filter: brightness(1.4)
}

.container{
    width: 70%;
    margin: auto;
}

#main-header{
    padding-top: 80px;
}


#main-header > nav{ 
    display: flex;
    justify-content: space-between;
}

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

#logo img{
    width: 60px;
    height: 60px;
}

#logo h1{
    font-size: 48px;
    margin: 0px 10px;
}

#main-header > nav > ul{
    list-style: none;
    padding: 0;
    display: flex;
    margin: 0;
}

#main-header ul > li{
    margin: 0px 10px;

    cursor: pointer;

    /* Align text */
    display: flex;
    justify-content: center;
    align-items: end;
    padding-bottom: 10px;
}

#main-header ul > li:hover{
    color: var(--primary);
}

.selected-page{
    color: var(--secondary);
    border-bottom: 1px solid var(--secondary);
}


#add-btn{
    display: flex;
    align-items: center;
    padding: 10px 25px;
}

#add-btn svg{
    margin-right: 5px;
}

#main-content, #books-wrapper{
    padding: 25px 0px;
}

#books-wrapper{
    width: 100%;
    display: flex;
    flex-wrap: wrap;
}

.book-item{
    animation: fade-in 0.2s ease forwards;

    margin-right: 25px;
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    width: 300px;
    align-self: flex-start;

    box-shadow: 0 2px 10px 2px rgba(0,0,0,0.3);
    box-sizing: border-box;
}

.book-item h2, .book-item p{
    margin: 0;
}

.book-item > .book-title{
    padding: 15px;
    display: grid;
    grid-template-columns: auto 80px;
    grid-template-areas:
        "title edit"
        "author author"
    ;
}

.book-title > .title{
    grid-area: title;
}

.book-title > .author{
    grid-area: author;
}

.book-title > .edit{
    grid-area: edit;
    display: flex;
    justify-self: end;
}

.icon-btn{
    background: transparent;

    width: 30px; height: 30px;
    padding: 5px;
    outline: 0;
    border: 0;

    display: flex;
    justify-content: end;
    align-items: center;
    
    cursor: pointer;
}

.icon-btn:hover{
    color: var(--danger);
}

.remove-btn:hover{
    color: var(--danger);
}

.icon-btn svg{
    width: 100%; height: 100%;
}

.book-item > .book-cover img{ 
    width: 100%;
    height: auto;
}

.book-item > .book-footer{
    padding: 15px;

    display: flex;
    justify-content: space-between;
    color: var(--secondary);
}

#main-footer{
    background-color: var(--secondary);
    color: var(--light);
    text-align: center;
    padding: 20px;
}

#main-footer p{
    margin: 0;
}

#main-footer a{
    color: var(--warning);
    text-decoration: none;
}

#darkSwitch{
    position: fixed;
    bottom: 40px;
    center: 20px;
    appearance: none;
    -webkit-appearance : none;
    -moz-appearance : none;
    -o-appearance : none;
    width: 80px;
    height: 40px;
    background: grey;
    border-radius: 22px;
    cursor: pointer;
    outline: none;
}

#darkSwitch::before{
    content: '';
    position: absolute;
    width: 40px;
    height: 35px;
    background-color:white;
    border-radius: 35px;
    top: 2px;
    left: 2px;
    cursor: pointer;
    transition: .3s linear;
}


#darkSwitch:checked + .container{
  background: rgb(19, 18, 18);
  color: white;
}

#darkSwitch:checked::before{
    left: 40px;
}

#darkSwitch:checked{
    background: rgb(12, 177, 81);
}

@media (max-width: 720px){

    .container, .form{
        width: 80%;
    }
    
    #main-header{
        padding-top: 10px;
    }
    
    #main-header > nav{ 
        display: flex;
        justify-content: center;
        align-content: center;
        flex-direction: column;
    }
    
    #logo{
        display: flex;
        align-items: center;
        justify-content: center;

        margin: 10px;
    }
    
    #logo img{
        width: 34px;
        height: 34px;
    }
    
    #logo h1{
        font-size: 32px;
    }
    
    #main-header > nav > ul{
        display: flex;
        justify-content: center;
    }
    
    #main-header ul > li{
        margin: 0px;
        padding: 10px 0px;
        width: 100%;
    }

    #add-btn{
        width: 100%;
        justify-content: center;
    }

    .book-item{
        width: 100%;

        max-width: 100%;
        min-height: 0;
        margin-right: 0;
    }
}