.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: calc(100vh - 100px); 
    overflow-y: auto;
    box-shadow: 0 4px 20px var(--shadow-dark);
    animation: slideIn 0.3s;
    text-align: center;
    margin: auto;
}

.modal-header {
    padding: 15px;
    border-bottom: 1px solid var(--button-bg);
    position: relative;
    text-align: center;
}

.modal-header h2 {
    margin: 0;
    text-align: center;
}

.close {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}

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

.modal-body {
    padding: 20px;
    text-align: center;
}

.modal-body h2,
.modal-body h3,
.modal-body h4,
.modal-body p,
.modal-body div {
    text-align: center;
}

.modal-body .description p,
.modal-body .book-meta {
    text-align: left;
    margin: 0 auto;
    max-width: 500px;
}

.modal-body img {
    display: block;
    margin: 0 auto;
}

.modal-body .links {
    text-align: center;
    margin-top: 20px;
}

.modal-body .links a {
    display: inline-block;
    margin: 5px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}