* {
    box-sizing: border-box;
}

body {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    font-family: 'Times New Roman', Times, serif;
    overflow: hidden;
}

/* Fonts */
h1 {
  font-family: "Alexandria", sans-serif;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 3px;
  font-style: normal;
  margin-bottom: 30px;
  margin-top: 10px;
  color: rgba(0, 0, 0, 0.8);
  text-shadow: 5px 5px 5px rgba(0, 0, 0, 0.5);
}

h1 > span {
    font-size: 70px;
}

h1:hover {
    cursor: default;
}

/* Main */

.bookshelf {
    box-sizing: content-box;
    width: 1000px;
    height: 500px;
    display: flex;
    flex-direction: column;
    gap: 40px;
    /* border: 30px solid #563232; */
    border-radius: 30px;
}


.shelf {
    height: 250px;
    display: flex;
    gap: 6px;
}

.shelf.top-books {
    border-bottom: 20px solid rgba(0, 0, 0, 0.8);
    border-left: 15px solid rgba(0, 0, 0, 0.8);
    border-right: 10px solid white;
    border-top: 10px solid white;
    justify-content: flex-start;
    padding-left: 12px;
    padding-top: 20px;
    padding-bottom: 3px;
    /* overflow-y: hidden; */
    box-shadow: -20px 20px 15px rgba(0, 0, 0, 0.5);
}

.shelf.bottom-books {
    border-top: 10px solid white;
    border-right: 15px solid rgba(0, 0, 0, 0.8);
    border-bottom: 20px solid rgba(0, 0, 0, 0.8);
    border-left: 10px solid white;
    padding-top: 20px;
    padding-bottom: 3px;
    /* overflow-y: hidden; */
    box-shadow: 20px 20px 15px rgba(0, 0, 0, 0.5);
    justify-content: flex-end;
    padding-right: 15px;
}

/* Book Slant Effects */

.shelf > .book {
    border: 2px solid black;
    width: 70px;
    height: 180px;
    border-radius: 5px;
    padding: 3px;
    margin: 0;
    transform: rotate(-90deg);
    z-index: 10;
    background-color: white;
}


.book > .spine-title {
    font-size: 10px;
    height: 20px;
    text-align: center;
    margin-bottom: 30px;
}

.book > .spine-title > p {
    border-bottom: 1px solid black;
    padding-bottom: 3px;
    overflow: hidden;
}

.book > .spine-author {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 80px; 
}

.book > .spine-author > p {
    transform: rotate(90deg);
    padding: 0;
    margin: 0;
    font-size: 12px;
    text-align: center;
    white-space: nowrap;
}


.shelf.top-books .book {
    transform: rotate(-10deg);
    display: inline-block;
    box-shadow: -5px 10px 5px rgba(0, 0, 0, 0.5);
}

.shelf.bottom-books .book {
    transform: rotate(10deg);
    display: inline-block;
    box-shadow: 5px 10px 5px rgba(0, 0, 0, 0.5);
}

.shelf.bottom-books .book:nth-child(odd) {
    transform: rotate(8deg);
}

.shelf.top-books .book:nth-child(odd) {
    transform: rotate(-8deg);
}


/* Book Hover Effects */

.book:hover {
    cursor: pointer;
}

.shelf.top-books .book:hover {
    transform: rotate(-10deg) scale(1.1);
}

.shelf.bottom-books .book:hover {
    transform: rotate(10deg) scale(1.1);
}

.shelf.bottom-books .book:nth-child(odd):hover {
    transform: rotate(8deg) scale(1.1);
}

.shelf.top-books .book:nth-child(odd):hover {
    transform: rotate(-8deg) scale(1.1);
}


/* Add Book Button */

#addBook {
    margin-top: 30px;
    margin-bottom: 10px;
    padding: 15px 50px;
    color: black;
    background-color: white;
    border: 5px solid rgba(0, 0, 0, 0.8);
    border-radius: 20px;
    outline: none;
    box-shadow: 10px 10px 10px rgba(0, 0, 0, 0.7);
    font-family: 'Courier New', Courier, monospace;
    font-size: 16px;
    font-weight: 600;
}

#addBook:hover {
    cursor: pointer;
    transform: scale(1.1);
    box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.7);
}

#addBook:active {
    opacity: .6;
}

/* AddBook Modal */

.modal {
    border: 5px solid black;
    background-color: white;
    width: 300px;
    height: 400px;
    padding: 0;
    border-radius: 20px;
    overflow: hidden;
    z-index: 10;
    font-family: 'Courier New', Courier, monospace;
}

.modal > .form-header {
    /* border: 1px solid red; */
    display: flex;
    justify-content: center;
    padding: 20px;
    height: 70px;
}

.form-header .modal-title {
    /* border: 1px solid red; */
    font-family: "Alexandria", sans-serif;
    font-weight: 500;
    font-style: normal;
    letter-spacing: -1px;
    font-size: 25px;
    align-self: center;
}

.closeModal {
    /* Make it Global for all classes */
    font-weight: bold;
    width: 25px;
    height: 25px;
    text-align: center;
    position: absolute;
    margin: 5px;
    border: 2px solid black;
    border-radius: 20px;
    top: 0;
    right: 0;
}

.modal > form {
    /* border: 1px solid blue; */
    display: flex;
    flex-direction: column;
    height: 310px;
    padding: 15px;
    font-size: 16px;
    /* justify-content: center; */
}


.form-label {
    display: inline-block;
    font-size: 15px;
    font-weight: 600;
}

#addBookForm div {
    box-sizing: border-box;
    margin-bottom: 10px;
}

.book-title > input,
.book-author > input {
    display: block;
    width: 100%;
    height: 20px;
    margin-bottom: 5px;
    padding: 10px;
    border: 2px solid black;
    border-radius: 3px;
    outline: none;
}
.book-pages > input {
    width: 100%;
    height: 20px;
    display: block;
    padding: 10px;
    border: 2px solid black;
    border-radius: 3px;
    outline: none;
    margin-bottom: 5px;
}

.book-status {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    font-weight: 600;
}

/* Form Validation */ 

.showEffect {
    font-size: 10px;
    height: 10px; /*Add a fixed height, so things don't overflow*/
    margin: 0;
    width: fit-content;
    color: #8b0000;
}

#bookSubmit {
    margin: 0;
    width: 190px;
    height: 40px;
    font-size: 13px;
    font-weight: 600;
    align-self: center;
    border: 3px solid black;
    border-radius: 50px;
    outline: none;
    font-family: 'Courier New', Courier, monospace;
}

/* Toggle button for isRead status */

.book-status > .toggleContainer {
    /* border: 1px solid red; */
    margin: 0;
    margin-top: 10px;
    padding-bottom: 5px;
    text-align: center;
    align-self: center;
    justify-items: center;
}


input[type=checkbox].toggle {
    display: none;
}

input[type=checkbox].toggle + label {
    display: inline-block;
    height: 25px;
    width: 100px;
    position: relative;
    border: 2px solid black;
    border-radius: 2px;
    padding: 0;
    margin: 0;
    cursor: pointer;
    box-sizing: border-box;
    transition: all 0.2s ease;
    font-family: 'Courier New', Courier, monospace;
}

input[type=checkbox].toggle + label:before {
    border: 2px solid black;
    position: absolute;
    top: 1px;
    width: 15px;
    height: 15px;
    content: '';
    z-index: 3;
}

input[type=checkbox].toggle + label:after {
    font-size: 13px;
    width: 60px;
    text-align: center;
    z-index: 2;
    text-transform: uppercase;
    position: absolute;
    top: 4px;
    right: 0;
    overflow: hidden;
}

input[type=checkbox].toggle:not(:checked) + label {
    background-color: transparent;
    text-align: right;
}

input[type=checkbox].toggle:not(:checked) + label:after {
    content: attr(data-unchecked);
    right: 0;
    left: auto;
    color: black;
}

input[type=checkbox].toggle:not(:checked) + label:before {
    left: 1px;
    background-color: white;
}

input[type=checkbox].toggle:checked + label {
    text-align: left;
    border-color: #8b0000;
    box-shadow: 1px 1px 3px #8b0000;
}

input[type=checkbox].toggle:checked + label:after {
    content: attr(data-checked);
    left: 0;
    right: auto;
    color: #8b0000;

}

input[type=checkbox].toggle:checked + label:before {
    left: 75px;
    border-color: #8b0000;
    background-color: #8b0000;
}




/* Display Book Info Modal */

.modal.displayBook p {
    margin: 0;
    padding: 2px;
    text-align: center;
    white-space: wrap;
    overflow: hidden;
}

.modal.displayBook {
    background-color:	white; 
    box-shadow: -20px 15px 5px rgba(0, 0, 0, 0.6);
    border-color: #262626;
    background-image: linear-gradient(to bottom right, rgba(255, 255, 255), rgba(192, 192, 192, .3));
}

.modal.displayBook > #bookInfo {
    border: 10px double #262626;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px;
    margin-top: 35px;
    height: 330px;
    justify-content: space-between;

}

#bookInfo > .bookTitleInfo {
    width: 100%;
    border-bottom: 3.5px solid #262626;
    padding-bottom: 25px;
    margin-top: 20px;
    font-family: "Alexandria", sans-serif;
    color: black;
    font-size: 30px;
    font-weight: 500;
    font-style: normal;
    letter-spacing: -1px;
    line-height: 35px;
}

#bookInfo > .bookAuthorInfo {
    justify-self: baseline;
    font-family: "Alexandria", sans-serif;
    color: black;
    font-style: normal;
    font-weight: 500;
    font-size: 25px;
}

.modal.displayBook .bookStatusInfo {
    width: 100%;
    display: flex;
    margin-top: 20px;
    justify-content: center;
    align-items: center;
    gap: 20px;
    font-family: "Alexandria", sans-serif;
    font-style: normal;
    font-weight: 600;
    font-size: 12px;
    
}

.bookStatusInfo > div {
    padding: 10px 20px;
    color: black;
}

.bookStatusInfo > .bookReadStatusInfo {
    color: 	#8b0000;
    opacity: 1;
}

#bookInfo > #withdraw {
    margin: 0;
    margin-bottom: 10px;
    font-size: 12px;
    letter-spacing: .5px;
    padding: 4px 10px;
    padding-top: 6px;
    border: 3px solid #262626;
    border-radius: 4px;
    outline: none;
    font-family: 'Courier New', Courier, monospace;
    color: black;
    font-weight: 600;
    text-align: center;
}

/* Below: Storage Alert */

.storageAlert{
    border-color: #8b0000;
    height: 150px;
    width: 350px;
    padding: 30px;
}

.storageAlert div {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
}

.storageAlert div p {
    margin: 0;
    text-align: center;
    font-weight: 600;
}

.alert.closeModal {
    border-color: #8b0000;
    color: #8b0000;
}

/* Hover Effects */

button {
    background-color: white;
}

form button:hover, 
.closeModal:hover,
#withdraw:hover {
    cursor: pointer;
    transform: scale(1.1);
}

form button:active,
#withdraw:active {
    opacity: .7;
}

dialog::backdrop {
    background-color: black;
    opacity: .5;
    backdrop-filter: blur(10px);
}

.displayBook::backdrop {
    background-color: transparent;
    opacity: 0;
    backdrop-filter: blur(0px);
}
