.layout {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

header {
    display: flex;
    align-items: center;
    background-color: var(--primary);
    height: 10vh;
    padding: 1rem;
    border-radius: 40px;
    box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
}

header img {
    margin-left: 3rem;
}

main {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
    padding: 1.5rem;
}

.container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;

    padding: 1rem;
}

.container .card {
    justify-self: center;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 0.5rem;
    width: 260px;
    border-radius: 24px;
    background-color: var(--primary);
    flex-grow: 0;
    line-height: 1.1;
    box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
}

.close-card {
    align-self: flex-end;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    background-color: var(--text);
    box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
    transition: all ease-in-out 250ms;
    cursor: pointer;
}

.close-card:hover {
    scale: 1.1;
}

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

.book img {
    width: 200px;
    height: 300px;
    object-fit: cover;
    border-radius: 12px;
    align-self: center;
    box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
}

.card .title {
    margin-top: 1rem;
    font-size: 20px;
}

.card .author {
    font-size: 18px;
    font-style: italic;
}

.switch {
    position: relative;
    display: inline-block;
    width: 90px;
    height: 34px;
    align-self: flex-end;
    margin-top: auto;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    display: flex;
    align-items: center;
    border-radius: 34px;
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--text);
    -webkit-transition: 300ms;
    transition: 300ms;
    box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
}

.slider p {
    margin-left: 0.75rem;
    cursor: pointer;
    color: var(--text);
    user-select: none;
}

.slider:before {
    border-radius: 50%;
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: var(--secondary);
    -webkit-transition: 300ms;
    transition: 300ms;
}

input:checked+.slider {
    background-color: var(--secondary);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--secondary);
}

input:checked+.slider:before {
    -webkit-transform: translateX(55px);
    -ms-transform: translateX(55px);
    transform: translateX(55px);
    background-color: var(--text);
}

main .add {
    border-radius: 50%;
    position: fixed;
    right: 50px;
    bottom: 50px;
    width: 71px;
    height: 71px;
    cursor: pointer;
    transition: ease-in-out 250ms;
    box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
}

main .add:hover {
    scale: 1.1;
}

dialog {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--primary);
    border-radius: 24px;
    padding: 1rem;
    height: 400px;
    max-width: 50ch;
    border: none;
    box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
    transition: 125ms ease-in;

    &>* {
        margin: 0;
    }
}

.open {
    display: flex;
}

dialog form {
    display: flex;
    gap: 1.5rem;
}

dialog>button {
    align-self: flex-end;
    border-radius: 12px;
    color: var(--text);
    padding: 0.75rem 1rem;
    border: none;
    cursor: pointer;
    transition: 250ms all ease-in-out;
    box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
}

dialog .close {
    position: absolute;
    bottom: 96%;
    left: 96%;
    background-color: var(--text);
    border-radius: 50%;
    padding: 0;
    width: 30px;
}

dialog>button:not(:disabled):hover {
    scale: 1.1;
}

dialog>button:disabled {
    background-color: #182634;
}

form .canvas {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 200px;
    height: 300px;
    background-color: var(--background);
    border-radius: 12px;
    box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
    color: var(--text);
}

.canvas input[type="file"] {
    display: none;
}

.canvas .upload-image {
    border: 1px solid var(--text);
    border-radius: 12px;
    display: inline-block;
    position: absolute;
    padding: 6px 12px;
    cursor: pointer;
    box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
    transition: all 250ms ease-in-out;
    user-select: none;
    z-index: 1;
}

.canvas #imagePreview {
    border-radius: 12px;
    object-fit: cover;
}

.canvas .upload-image:hover {
    scale: 1.1;
}

form .details {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
}

.details input[type="text"],
.details input[type="number"] {
    padding: 1rem;
    border-radius: 12px;
    border: none;
    box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
}

.exists::after {
    content: "" attr(data-help) "";
    color: #d81d1d;
    font-size: 12px;
}

.title-div {
    display: flex;
    flex-direction: column;
}

.details ul {
    display: flex;
    list-style: none;
    align-items: center;
    justify-content: space-evenly;
    color: var(--text);
}

.details ul li {
    display: flex;
    align-items: center;
}

.details ul li label {
    margin-left: 0.5rem;
}

.details input[type="radio"] {
    width: 20px;
    height: 20px;
    border: 2px solid var(--background);
    border-radius: 10px;
    appearance: none;
    background-color: var(--text);
}

.details input[type="radio"]::before {
    display: block;
    content: " ";
    width: 10px;
    height: 10px;
    border-radius: 6px;
    background-color: var(--secondary);
    font-size: 1em;
    transform: translate(3px, 3px) scale(0);
    transform-origin: center;
    transition: all 300ms ease-in-out;
}

input[type="radio"]:checked::before {
    transform: translate(3px, 3px) scale(1);
    transition: all 0.3s cubic-bezier(0.25, 0.25, 0.56, 2);
}

footer {
    display: flex;
    padding: 1rem;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 16px;
    text-align: center;

    a:hover {
        animation: rotate .5s forwards;
    }
}

@keyframes rotate {
    0% {
        rotate: 0deg;
    }

    100% {
        rotate: 360deg;
    }
}

@media (width <=655px) {
    header {
        justify-content: center;
    }

    header img {
        margin: 0;
    }


}

@media (width <=535px) {
    dialog {
        justify-content: space-between;
        height: 670px;
        width: 90%;
        z-index: 1;
    }

    dialog .close {
        position: absolute;
        bottom: 96%;
        left: 93%;
        background-color: var(--text);
        border-radius: 50%;
        padding: 0;
        width: 40px;
    }

    dialog form {
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        gap: 1.5rem;
    }

    form {
        flex-grow: 1;
    }

    form .canvas {
        align-self: center;
    }

    .details input[type="text"] {
        padding: 0.5rem;
    }

}