:root {
    font-size: 20px;
    font-family: 'Inter', sans-serif;

    --black-text: #262626;
    --white-text: #e4e4e7;
}

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;

    background-color: #d4d4d8;
    color: #262626;
}

button, input, fieldset {
    appearance: none;
    border: 0;
    margin: 0;
    padding: 0;
}

button {
    cursor: pointer;
}

button:hover {
    background-color: var(--black-text);
    color: #e4e4e7;
}

p, h1, h2, button, ul, li {
    margin: 0;
    padding: 0;
    list-style: none;
}

a {
    display: inline-block;
    text-decoration: none;
    cursor: pointer;
}

/* Utility selectors */

.text-dark {
    color: var(--black-text);
}

.text-light {
    color: var(--white-text);
}

.fill-dark {
    fill: var(--black-text);
}

.fill-light {
    color: var(--white-text);
}

/* Header */

header {
    width: max(400px, 30vw);

    display: flex;
    justify-content: space-between;
    align-items: center;

    margin: 2rem 0;

    background-color: #e4e4e7;
    border-radius: 30px;
    box-shadow: 0px 0px 5px 0px #4b5563;
}

header > button {
    appearance: none;

    height: 2rem;

    margin: 0.5rem;

    border-radius: 6px;
    background-color: inherit;

    font-family: inherit;

    transition: all 0.15s ease-in-out;
}

#sign-in {
    padding: 10px;
    border-radius: 30px;
}

#theme-switcher {
    display: grid;
    place-items: center;
    
    width: 2rem;
    padding: 3px;
    
    border-radius: 50%;
}

#theme-switcher > svg {
    height: 100%;
    width: auto;
}

#theme-switcher:hover > svg {
    fill: #e4e4e7;
}

/* Main */

main {
    width: max(400px, 60vw);

    margin: 0 0 2rem 0;

    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#add-book {
    box-sizing: border-box;
    width: 3rem;

    display: grid;
    place-items: center;

    margin: 0 0 2rem 0;
    
    font-size: 1rem;
    font-weight: bold;

    border: 0;
    border-radius: 10px;
    background-color: #e4e4e7;
    box-shadow: 0px 0px 5px 0px #4b5563;

    transition: all 0.15s ease-in-out;
}

#add-book a {
    width: 100%;
    height: 100%;

    display: inline-block;

    border-radius: inherit;
    padding: inherit;

    transition: all 0.15s ease-in-out;
}

#add-book:hover, #add-book a:hover {
    background-color: var(--black-text);
    color: var(--white-text);
}

.collection {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    grid-auto-rows: 250px;
    gap: 1rem;
}

/* Card */

.card {
    display: flex;
    flex-direction: column;

    padding: 20px 5px 5px 5px;

    border-radius: 15px;
    background-color: var(--white-text);
    box-shadow: 0px 0px 5px 0px #4b5563;
}

.card > h2 {
    margin-bottom: 1rem;
}

.card > h2, .card > p {
    text-align: center;
}

.buttons {
    display: flex;
    gap: 5px;

    margin-top: auto;
}

.buttons > button {
    flex: 1;
    border-radius: 10px;
    transition: all 0.1s ease-in-out;
}

.buttons img {
    height: 1.5rem;
    width: auto;
    filter: invert(100%) sepia(49%) saturate(327%) hue-rotate(180deg) brightness(99%) contrast(82%);
    transition: all 0.1s ease-in-out;
    pointer-events: none;
}

#edit {
    background-color: #1d4ed8;
}

#edit a, #delete a {
    width: 100%;
    height: 100%;
}

#delete {
    background-color: #b91c1c;
}

#edit:hover {
    background-color: #1e40af;
}

#delete:hover {
    background-color: #991b1b;
}

#edit:hover > img {
    filter: invert(96%) sepia(8%) saturate(83%) hue-rotate(201deg) brightness(90%) contrast(88%);
}

#delete:hover > img {
    filter: invert(96%) sepia(8%) saturate(83%) hue-rotate(201deg) brightness(90%) contrast(88%);
}

.card span {
    padding: 2px 5px;

    border-radius: 3px;

    font-size: 0.8rem;
    color: var(--white-text);
}

#unread {
    background-color: #7f1d1d;
}

#reading {
    background-color: #c2410c;
}

#read {
    background-color: #166534; 
}

/* Footer */

footer {
    display: flex;
    align-items: center;
    gap: 4px;

    margin: auto 0 1rem 0;
}

footer > a {
    height: 1.5rem;
    width: 1.5rem;
}

footer > svg {
    height: 100%;
    width: auto;
}

footer > a:hover > svg:hover {
    animation: spin 0.5s ease-in-out forwards;
    scale: 1.1;
}

/* Popups */
.overlay {
    position: fixed;

    display: grid;
    place-items: center;

    width: 100%;
    height: 100%;

    background-color: rgb(0, 0, 0, 0.3);
    visibility: hidden;
    opacity: 0;

    transition: opacity 0.3s ease-out;
}

.overlay.active {
    visibility: visible;
    opacity: 1;
}

body:has(.overlay.active) {
    overflow: hidden;
}

.popup {
    width: 300px;
    
    padding: 2rem 3rem 3rem 3rem;

    background-color: var(--white-text);
    border-radius: 15px;
    box-shadow: 0px 0px 5px 0px #4b5563;
}

.popup h2 {
    display: inline-block;
    margin: 0;
}

.popup ul {
    padding: 0;
    margin: 0;
}

.popup li {
    list-style: none;
}

.popup .header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin: 0 0 1rem 0;
}

.popup .header a {
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--black-text);
    transition: color 0.1s ease-in-out;
}

.popup .header a:hover {
    color: #b91c1c;
}

.popup input:not([type='radio']) {
    height: 1.5rem;
    width: 100%;
    box-sizing: border-box;

    display: block;
    
    margin: 2px 0 1rem 0;
    padding: 0 0 0 10px;

    background-color: #f4f4f5;
    border: 2px solid #d4d4d8;
    border-radius: 10px;;

    font-family: 'Inter', sans-serif;
}

.popup input[type='radio'] {
    appearance: none;

    width: 100%;
    min-height: 2rem;

    border-radius: 10px;
}

.popup input[type='radio']#book-unread, .popup input[type='radio']#current-book-unread {
    background-color: #b91c1c;
    border: 2px solid #991b1b;
}


.popup input[type='radio']#book-reading, .popup input[type='radio']#current-book-reading {
    background-color: #d97706;
    border: 2px solid #b45309;
}

.popup input[type='radio']#book-read, .popup input[type='radio']#current-book-read {
    background-color: #16a34a;
    border: 2px solid #15803d;
}

.popup input[type='radio']#book-unread:checked, .popup input[type='radio']#current-book-unread:checked {
    background-color: #991b1b;
}

.popup input[type='radio']#book-reading:checked, .popup input[type='radio']#current-book-reading:checked {
    background-color: #b45309;
}

.popup input[type='radio']#book-read:checked, .popup input[type='radio']#current-book-read:checked {
    background-color: #15803d;
}

.popup fieldset {
    position: relative;
}

.radio-buttons, .radio-buttons-text {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 5px;

    margin: 2px 0 0 0;
}

.radio-buttons input, .radio-buttons-text > * {
    flex: 1;
    pointer-events: auto;
}

.radio-buttons-text {
    position: absolute;
    top: 0;
    pointer-events: none;
}

.radio-buttons-text label {
    box-sizing: border-box;
    width: 300px;
    min-height: 2rem;
    
    display: grid;
    place-items: center;

    border-radius: 10px;
    border: 2px solid transparent;
    background-color: transparent;

    color: var(--white-text);
}

.popup button {
    width: 100%;
    height: 3rem;
    
    /* padding: 0.8rem 0; */
    margin: 1rem 0 0 0;

    border-radius: 10px;
    border: 2px solid #d4d4d8;

    font-family: 'Inter', sans-serif;
    font-weight: bold;
}

.popup button a {
    width: 100%;
    height: 100%;

    display: grid;
    place-items: center;

    color: var(--black-text);
}

.popup button:hover > a {
    color: var(--white-text);
}

/* Animation */

@keyframes spin {
    100% {
        rotate: 360deg;
    }
}