/*
  Josh's Custom CSS Reset
  https://www.joshwcomeau.com/css/custom-css-reset/
*/

*, *::before, *::after {
    box-sizing: border-box;
}

* {
    margin: 0;
}

@font-face {
    font-family: 'Monaspace-Neon';
    src: url('fonts/MonaspaceNeonVarVF[wght,wdth,slnt].ttf');
}

body {
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    background-color: #f5f5f5;
    font-family: 'Monaspace-Neon', 'Inter', sans-serif;
}

img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
}

input, button, textarea, select {
    font: inherit;
}

p, h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word;
}

p {
    text-wrap: pretty;
}

h1, h2, h3, h4, h5, h6 {
    text-wrap: balance;
}

#root, #__next {
    isolation: isolate;
}

/** Modal Functionality */

h1.header {
    background-color: #fef8f7;
}

.book-modal {
    display: flex;
    flex-direction: column;
    width: 450px;
    padding: 2rem;
    min-height: 250px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #fef8f7;
    border-radius: 20px;
    z-index: 2;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.book-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.book-close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 32px;
    height: 32px;
    background: #f5f5f5;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #666;
    transition: all 0.2s ease;
}

.book-close-btn:hover {
    background: #fef8f7;
    color: #000;
    transform: rotate(90deg);
}

h2.form-title {
    font-size: 1.75rem;
    color: #1a1a1a;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #4a4a4a;
    font-weight: 500;
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="number"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
    outline: none;
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus {
    border-color: #d1195f;
}

.form-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #d1195f;
}

.form-group.checkbox-group {
    display: flex;
    gap: 0.75rem;
    line-height: 1;
}

.form-group.checkbox-group label {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    height: 18px;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

button[type="submit"] {
    width: 100%;
    padding: 0.875rem;
    background: #ea4f8b;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    margin-top: 1rem;
}

button[type="submit"]:hover {
    background: #d1195f;
}

.book-add-btn {
    display: inline-block;
    padding: 0.875rem 1.5rem;
    font-weight: 600;
    background-color: #ea4f8b;
    color: white;
    border: none;
    border-radius: 10px;
    text-align: center;
    font-size: 1rem;
    cursor: pointer;
    height: auto;
}

button .submit,
.book-add-btn {
    transition: transform 0.5s ease, opacity 0.2s ease;
}

.book-add-btn:hover {
    background: #d1195f;
}

.book-overlay {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1;
}

.hidden {
    display: none;
}

/* Animation classes */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.book-modal:not(.hidden) {
    animation: modalFadeIn 0.3s ease-out;
}

/* Responsive adjustments */
@media (max-width: 500px) {
    .book-modal {
        width: 90%;
        margin: 0 auto;
    }
}

/** Library */
.container {
    display: grid;
    grid-template-areas:
    "header header header"
    "book-modal book-modal book-modal"
    "filter filter filter"
    "library-display library-display library-display";
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: auto auto auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.header {
    grid-area: header;
    text-align: center;
    background-color: white;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.button-group {
    grid-area: book-modal;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background-color: #fef8f7;
    border-radius: 10px;
    padding: 1rem 0 0 0;
    margin-bottom: 1.5rem;
    width: clamp(12rem, 25%, 50%);
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 10px 25px rgba(0, 128, 128, 0.1);
}

.button-group .book-add-btn {
    text-align: center;
    align-items: center;
    justify-content: center;
}

/* Filter List */
.filter-list {
    display: inline-flex;
    align-items: center;
    position: relative;
    height: 2.5rem;
    padding: 0.25rem;
    gap: 0.25rem;
    background-color: #e5e7eb;
    border-radius: 0.375rem;
    font-weight: 600;
    color: #ea4f8b;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

/* Filter Item */
.filter-item {
    display: flex;
    position: relative;
    height: 2rem;
}

/* Hide radio input but keep it accessible */
.radio-group input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Filter Label */
.filter-label {
    display: flex;
    align-items: center;
    height: 2rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5rem;
    color: #4b5563;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Selected/Checked State */
.radio-group input[type="radio"]:checked + .filter-label {
    background-color: #ffffff;
    color: #ea4f8b;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Hover Effect on Filter Label */
.filter-label:hover {
    color: #1f2937;
}

.filter label {
    cursor: pointer;
}

.book-add-btn {
    grid-area: book-modal;
    text-align: center;
    align-items: center;
    justify-content: center;
    width: 50%;
    margin-left: auto;
    margin-right: auto;
}

.toggle-read {
    background-color: #16b679;
    color: white;
    border-radius: 6px;
    border: none;
    padding: 0.5rem;
    margin: 0.5rem 0 0.5rem;
    text-decoration: none;
    cursor: pointer;
}

.toggle-read.read {
    background-color: #ee8072;
}


.remove-book {
    background-color: #E41967;
    color: white;
    border-radius: 6px;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
}

.filter {
    grid-area: filter;
    text-align: center;
    align-items: center;
}

.library-display.wrapper {
    grid-area: library-display;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    display: flex;
}

.library-display-items {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 2rem;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    max-width: 600px;
    perspective: 1000px;
}

/* Book card container */
.book-card {
    position: sticky;
    top: 20px;
    background: #fef8f7;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transform-origin: center top;
    transition: all 0.3s ease;
}

/* Card content styling */
.card-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
    z-index: 1;
}

.card-content h3 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.card-content p {
    color: #666;
    margin: 0;
}

/* Button styling */
.card-content button {
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.toggle-read:hover,
.remove-book:hover,
.book-add-btn:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.library-display.wrapper {
    grid-area: library-display;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    display: flex;
}
