#books-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr); 
    gap: 25px;
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.book-item {
    background: #ffffff;
    border: 1px solid #d8deea;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.book-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.book-cover {
    width: 100%;
    height: 240px;
    object-fit: contain;
    margin-bottom: 15px;
}

.book-info {
    text-align: center;
    margin-bottom: 15px;
}

.book-info h3 {
    font-size: 1.1rem;
    margin: 0 auto 5px auto;
    color: #111;
    display: block;
}

.status-text {
    font-size: 0.8rem;
    font-weight: bold;
    margin: 10px 0;
}

.status-available { color: #2e7d32; }
.status-borrowed { color: #d32f2f; }

button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-available {
    background-color: #1a4aa5;
    color: white;
}

.btn-available:hover {
    background-color: #0f3a8c;
}

.btn-borrowed {
    background-color: #e0e6ed;
    color: #7a869a;
    cursor: not-allowed;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    #books-container { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    #books-container { grid-template-columns: 1fr; }
}

/* Single-book view (?id=) */
#books-container.books-container--detail {
    display: block;
    max-width: 960px;
}

.book-item__link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.book-item__title-link {
    color: #1a4aa5;
    text-decoration: none;
}

.book-item__title-link:hover {
    text-decoration: underline;
}

.book-detail {
    background: #fff;
    border: 1px solid #d8deea;
    border-radius: 12px;
    padding: 24px 28px 32px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.book-detail__back {
    display: inline-block;
    margin-bottom: 20px;
    color: #1a4aa5;
    font-weight: 600;
    text-decoration: none;
}

.book-detail__back:hover {
    text-decoration: underline;
}

.book-detail__layout {
    display: flex;
    flex-wrap: wrap;
    gap: 28px 36px;
    align-items: flex-start;
}

.book-detail__media {
    flex: 0 0 auto;
    max-width: 280px;
}

.book-detail__cover {
    width: 100%;
    max-height: 420px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid #e3e8f0;
    background: #fafbfd;
}

.book-detail__body {
    flex: 1 1 280px;
    min-width: 0;
}

.book-detail__title {
    margin: 0 0 12px;
    font-size: 1.75rem;
    color: #111;
    line-height: 1.25;
}

.book-detail__meta {
    margin: 8px 0;
    color: #333;
}

.book-detail__status {
    margin: 16px 0;
    font-size: 0.95rem;
}

.book-detail__description {
    margin: 20px 0 24px;
    padding-top: 16px;
    border-top: 1px solid #e8ecf4;
}

.book-detail__description-heading {
    margin: 0 0 10px;
    font-size: 1rem;
    color: rgba(25, 52, 100, 0.9);
}

.book-detail__description p {
    margin: 0;
    line-height: 1.6;
    color: #444;
}

.book-detail__borrow {
    width: auto;
    min-width: 200px;
    max-width: 320px;
}

.book-detail--missing {
    text-align: center;
    padding: 40px 24px;
}

.book-detail__missing-msg {
    margin: 0 0 16px;
    font-size: 1.1rem;
    color: #555;
}

@media (max-width: 600px) {
    .book-detail__layout {
        flex-direction: column;
    }

    .book-detail__media {
        max-width: none;
    }
}