@import url('https://fonts.googleapis.com/css2?family=Raleway&display=swap');

:root {
    --border-radius: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Raleway", system-ui, Helvetica, Arial, sans-serif;
}

/* Modify focus indicator */
:focus-visible {
    outline: 3px solid black;
    box-shadow: 0 0 0 6px white;
}

/* Fallback for browsers without :focus-visible support */
@supports not selector(:focus-visible) {
    :focus {
        outline: 3px solid black;
        box-shadow: 0 0 0 6px white;
    }
}

html {
    /* This, alongside body: min-height: 100%, will make the body
    fill the viewport by default and grow with the document */
    height: 100%;
}

body {
    min-height: 100%;
    padding: 20px;
    background-color: #3A2D32;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --------------------------- Page Header --------------------------- */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

h1 {
    width: fit-content;
}

/* Button to open modal for new book */
#add-book {
    border: none;
    border-radius: 5px;
    background-color: white;
}

/* SVG inside add new book button */
#add-book img {
    padding: 2px;
    height: 2rem;
}

/* --------------------------- Dialog Animation --------------------------- */

dialog[open] {
    animation: dialogIn 0.6s;
}

@keyframes dialogIn {
    from {
        transform: translateY(-200%);
    }
    to {
        transform: translateY(0%);
    }
}

/* --------------------------- Add New Book Modal --------------------------- */

#add-book-modal {
    margin: auto; /* Center the modal */
    padding: 20px;
    border: none;
    border-radius: var(--border-radius);
}

/* Blur backdrop when modal is open */
#add-book-modal::backdrop {
    -webkit-backdrop-filter: blur(1px);
    backdrop-filter: blur(1px);
}

#add-book-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-row:nth-of-type(-n + 3) {
    display: flex;
    flex-direction: column; /* Place labels above text input */
}

/* Style text and number inputs */
.form-row input[type="text"],
.form-row input[type="number"] {
    font-size: 1rem;
    background: rgb(250, 250, 250);
    border: 1px solid #A6A6A6;
    border-radius: 2px;
    padding: 8px;
    margin-top: 3px;
}

/* Form row containing read or not checkbox */
.form-row:nth-of-type(4) {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Form row containing cancel and add buttons */
.form-row:last-child {
    display: flex;
    gap: 8px;
}

.form-row .cancel-modal,
.form-row .submit {
    font-size: 1rem;
    padding: 5px;
    width: 50%;
    border-radius: 5px;
}

.form-row .cancel-modal {
    color: #3A2D32;
    border: 1px solid #3A2D32;
    background-color: white;
}

.form-row .submit {
    color: black;
    border: 1px solid black;
    background-color: #A2AD91;
}

/* --------------------------- Main Content --------------------------- */

#card-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    grid-auto-rows: 1fr;
    gap: 20px;
}

#empty-library-message {
    flex: 1 1 auto;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 1.5rem;
}

/* --------------------------- Book Card --------------------------- */

.card {
    background-color: #A2AD91;
    border-radius: var(--border-radius);
    text-align: center;
    padding: 15px;

    display: grid;
    grid-template-rows: 1fr auto auto auto; /* fr is greedy, auto is shy */
    justify-items: center;
    align-items: center;
    gap: 10px;
}

.title {
    font-size: 1.3rem;
}

.card button {
    padding: 8px;
    border: 1px solid black;
    border-radius: var(--border-radius);
    width: 100px;
    color: black;
    background-color: #DBB4AD;
    font-size: 1rem;
}

.card button:nth-of-type(1) {
    margin-top: 10px;
}

.card .unread {
    background-color: #FFE3DC;
}

.card .delete {
    color: white;
    background-color: #D30C7B;
}

/* --------------------------- Hover Effects --------------------------- */

@media (hover: hover) {
    button:hover {
        filter: brightness(85%);
        cursor: pointer;
    }

    input[type="checkbox"]:hover {
        cursor: pointer;
    }

    #github-link:hover {
        transform: scale(1.2);
    }
}

/* ------------------------------- Footer ------------------------------- */

footer {
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    margin-top: auto; /* Make footer stay at bottom of page */
}

footer a {
    display: flex;
    align-items: center;
}

#github-icon {
    height: 1.5rem;
}