/*
 * Books Plugin Stylesheet
 * Version: 1.6
 *
 * Sections:
 *   1. Book Grid (display_books shortcode)
 *   2. Search Form (books_search_form shortcode)
 *   3. Single Book Page
 *   4. Tag Badges
 *   5. External Cover Images
 *   6. Navigation Menus (genre/tag)
 *   7. Pagination & Book Count
 *   8. Responsive Breakpoints
 */

/* ========================================
   1. BOOK GRID
   ======================================== */

.books-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;    /* centres items when the last row is not full */
    gap: 30px;
    margin: 20px 0;
}

.book-item {
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 8px;
    background: #fff;
    transition: box-shadow 0.3s ease;
    text-align: center;
    box-sizing: border-box;  /* ensures flex-basis covers the full outer width */
}

.book-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.book-cover {
    margin-bottom: 15px;
    position: relative;
    overflow: hidden;
    height: 280px;              /* fixed height — all grid covers align consistently */
    display: flex;
    align-items: center;
    justify-content: center;
}

.book-cover a {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.book-cover img,
.book-cover .book-external-cover {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;        /* maintains aspect ratio, no cropping */
    border-radius: 4px;
}

/* Improved no-cover placeholder (Item 15) */
.no-cover-placeholder {
    background: #f0f0f0;
    padding: 40px 20px;
    text-align: center;
    color: #999;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;               /* fills the fixed .book-cover height */
}

.no-cover-placeholder svg {
    margin-bottom: 12px;
    opacity: 0.6;
}

.no-cover-title {
    font-size: 14px;
    font-weight: 600;
    color: #777;
    line-height: 1.3;
    max-width: 140px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Hover description overlay (Item 18) */
.book-hover-desc {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 12px;
    font-size: 13px;
    line-height: 1.4;
    text-align: left;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    border-radius: 0 0 4px 4px;
}

.book-cover:hover .book-hover-desc {
    transform: translateY(15);
}

.book-title {
    font-size: 18px;
    font-weight: bold;
    margin: 0;
}

.book-title a {
    text-decoration: none;
    color: #333;
}

.book-title a:hover {
    color: #0073aa;
}

/* Author/year in grid cards (Item 1) */
.book-grid-meta {
    margin: 4px 0 0;
    font-size: 14px;
    color: #666;
}

.book-grid-tags {
    margin-top: 8px;
}

/* ========================================
   2. SEARCH FORM
   ======================================== */

.books-search-form {
    margin: 20px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.search-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.search-fields input[type="text"],
.search-fields select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    flex: 1 1 150px;
    min-width: 120px;
}

.search-fields button,
.search-fields .reset-button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.search-fields button {
    background: #0073aa;
    color: white;
}

.search-fields button:hover {
    background: #005a87;
}

.search-fields .reset-button {
    background: #ddd;
    color: #333;
}

/* ========================================
   3. SINGLE BOOK PAGE
   ======================================== */

/* Back to Books link (Item 4) */
.books-back-link {
    margin-bottom: 20px;
}

.books-back-link a {
    text-decoration: none;
    color: #0073aa;
    font-size: 15px;
}

.books-back-link a:hover {
    color: #005a87;
    text-decoration: underline;
}

.single-book-details {
    margin: 30px 0;
}

.single-book-cover {
    margin-bottom: 25px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.single-book-cover img {
    height: 450px;
    width: auto;
    max-width: 100%;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.single-book-info h2 {
    margin-top: 0;
    font-size: 24px;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

.book-info-table {
    width: 100%;
    max-width: 600px;
    margin: 20px 0;
    border-collapse: collapse;
}

.book-info-table tr {
    border-bottom: 1px solid #eee;
}

.book-info-table th {
    text-align: left;
    padding: 12px 15px 12px 0;
    font-weight: 600;
    width: 180px;
    vertical-align: top;
}

.book-info-table td {
    padding: 12px 0;
}

.book-info-table td a {
    color: #0073aa;
    text-decoration: none;
}

.book-info-table td a:hover {
    text-decoration: underline;
}

.single-book-comment {
    margin-top: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border-left: 4px solid #0073aa;
}

.single-book-comment h3 {
    margin-top: 0;
    font-size: 18px;
}

.single-book-comment-body {
    font-family: Calibri, candara, segoe, optima, arial, sans-serif !important;
    font-size: 11pt !important;
    line-height: 1.4 !important;
}

.book-description-body {
    font-family: Calibri, candara, segoe, optima, arial, sans-serif !important;
    font-size: 11pt !important;
    line-height: 1.4 !important;
}

.single-book-comment-body p {
    margin: 0 !important;
}

.book-description-body p {
    margin: 0 !important;
}

.single-book-comment-body a {
    color: #0073aa;
    text-decoration: underline;
}

.single-book-comment-body a:hover {
    color: #005a87;
}

/* Previous/Next book navigation (Item 17) */
.books-post-nav {
    display: flex;
    justify-content: space-between;
    margin: 30px 0;
    padding: 15px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.books-post-nav a {
    text-decoration: none;
    color: #0073aa;
    font-size: 15px;
}

.books-post-nav a:hover {
    color: #005a87;
    text-decoration: underline;
}

.books-post-nav-next {
    text-align: right;
}

/* ========================================
   4. TAG BADGES
   ======================================== */

.book-tag {
    display: inline-block;
    background: #e8f0fe;
    color: #1a73e8;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 13px;
    margin: 2px 4px 2px 0;
    line-height: 1.4;
}

/* ========================================
   5. EXTERNAL COVER IMAGES
   ======================================== */

.book-external-cover {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.single-book-cover .book-external-cover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* ========================================
   6. NAVIGATION MENUS
   ======================================== */

.books-nav-menu {
    margin: 15px 0;
}

ul.books-nav-menu {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

ul.books-nav-menu li a {
    display: inline-block;
    padding: 6px 14px;
    background: #f0f0f0;
    border-radius: 20px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    transition: background 0.2s, color 0.2s;
}

ul.books-nav-menu li a:hover {
    background: #0073aa;
    color: #fff;
}

ul.books-nav-menu li a.active {
    background: #0073aa;
    color: #fff;
    font-weight: 600;
}

.books-genre-dropdown select,
.books-tag-dropdown select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 200px;
}

/* ========================================
   7. PAGINATION & BOOK COUNT
   ======================================== */

/* Book count (Item 3) */
.books-count {
    color: #666;
    font-size: 14px;
    margin: 0 0 10px;
}

/* Pagination (Item 2) */
.books-pagination {
    text-align: center;
    margin: 30px 0 10px;
}

.books-pagination .page-numbers {
    display: inline-block;
    padding: 8px 14px;
    margin: 0 3px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    transition: background 0.2s, color 0.2s;
}

.books-pagination .page-numbers:hover {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

.books-pagination .page-numbers.current {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
    font-weight: 600;
}

.books-pagination .page-numbers.dots {
    border: none;
    padding: 8px 6px;
}

/* ========================================
   8. RESPONSIVE BREAKPOINTS
   ======================================== */

@media (max-width: 968px) {
    .search-fields {
        flex-direction: column;
    }

    .search-fields input[type="text"],
    .search-fields select {
        flex: 1 1 auto;
        width: 100%;
    }

    .single-book-cover {
        max-width: 250px;
    }
}

@media (max-width: 768px) {
    .book-info-table {
        max-width: 100%;
    }

    .book-info-table th {
        width: 140px;
    }

    .books-post-nav {
        flex-direction: column;
        gap: 10px;
    }

    .books-post-nav-next {
        text-align: left;
    }
}

/* ── Genre Archive Content (v2.10) ──────────────────────────────────────── */
/* Break out of the theme's narrow content column and use 80% of the        */
/* viewport width (10% margin each side). Works on classic and FSE themes.  */
.books-genre-archive-wrap {
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    width: 80vw;
    box-sizing: border-box;
}
.books-genre-archive-title {
    margin-bottom: 8px;
}
.books-genre-archive-description {
    margin-bottom: 24px;
    color: #555;
}
