/* ============================================
   RECOMMENDED BOOKS PAGE — books-style.css
   ============================================ */

/* Page wrapper — same 3-column grid as other pages */
.books-page-wrapper {
    max-width: 100%;
    margin: 0 auto;
    padding: 100px 60px 40px;
    display: grid;
    grid-template-columns: 240px 1fr 320px;
    gap: 50px;
    align-items: start;
}

/* ============================================
   PAGE HEADER
   ============================================ */
.books-main {
    padding: 0 30px;
    min-width: 0; /* prevent grid blowout */
}

.page-header {
    text-align: center;
    margin-bottom: 50px;
}

.page-title {
    font-size: 56px;
    font-weight: 700;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
}

.page-subtitle {
    font-size: 18px;
    color: #94a3b8;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ============================================
   FILTERS
   ============================================ */
.filter-section {
    margin-bottom: 16px;
}

.search-bar {
    width: 100%;
    padding: 16px 24px;
    background: rgba(15, 20, 25, 0.6);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    color: #ffffff;
    font-size: 16px;
    outline: none;
    transition: all 0.3s;
    margin-bottom: 20px;
    font-family: inherit;
}

.search-bar:focus {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
}

.search-bar::placeholder {
    color: #64748b;
}

/* Category buttons */
.category-buttons-container {
    margin-top: 20px;
    margin-bottom: 12px;
}

.category-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.category-btn {
    background: linear-gradient(135deg, rgba(20, 15, 50, 0.8) 0%, rgba(30, 20, 70, 0.7) 100%);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    padding: 10px 18px;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-family: inherit;
}

.category-btn:hover {
    background: linear-gradient(135deg, rgba(20, 15, 50, 0.9) 0%, rgba(30, 20, 70, 0.8) 100%);
    border-color: rgba(102, 126, 234, 0.5);
    transform: translateY(-2px);
}

.category-btn.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.3) 0%, rgba(124, 58, 237, 0.3) 100%);
    border-color: rgba(102, 126, 234, 0.6);
}

.category-btn.view-more {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(124, 58, 237, 0.2) 100%);
    border-color: rgba(102, 126, 234, 0.4);
}

.category-btn.hidden {
    display: none;
}

/* ============================================
   AFFILIATE DISCLAIMER
   ============================================ */
.books-disclaimer {
    padding: 12px 16px;
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 8px;
    margin-bottom: 20px;
}

.books-disclaimer p {
    font-size: 12px;
    color: #64748b;
    line-height: 1.6;
    margin: 0;
}

/* Books count */
.books-count {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 30px;
}

.books-count span {
    color: #8b5cf6;
    font-weight: 600;
}

/* ============================================
   BOOK CARDS
   ============================================ */
.book-grid {
    display: grid;
    gap: 24px;
}

.book-card {
    background: rgba(15, 20, 25, 0.6);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 16px;
    padding: 32px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 28px;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.book-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.4), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.book-card:hover {
    border-color: rgba(99, 102, 241, 0.5);
    transform: translateY(-3px);
    box-shadow: 0 16px 40px rgba(99, 102, 241, 0.15);
}

.book-card:hover::before {
    opacity: 1;
}

/* Book cover/spine */
.book-spine {
    width: 110px;
    min-width: 110px;
    height: 160px;
    border-radius: 2px 10px 10px 2px;
    position: relative;
    box-shadow: -5px 5px 18px rgba(0, 0, 0, 0.6);
    flex-shrink: 0;
    align-self: center;
    overflow: hidden;
    background: #1a1d29;
}

.book-spine img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 2px 8px 8px 2px;
    display: block;
}

.book-spine.no-cover {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #2d1b69, #6366f1);
}

.book-spine.no-cover svg {
    width: 44px;
    height: 44px;
    fill: none;
    stroke: rgba(255, 255, 255, 0.85);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Book content */
.book-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.book-number {
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.book-title {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.25;
}

.book-author {
    font-size: 14px;
    color: #64748b;
    font-style: italic;
}

.book-divider {
    height: 1px;
    background: rgba(99, 102, 241, 0.15);
    margin: 4px 0;
}

/* Article source block */
.book-article-link {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 10px;
}

.book-article-link-icon {
    width: 16px;
    height: 16px;
    min-width: 16px;
    margin-top: 2px;
}

.book-article-link-icon svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: #6366f1;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.book-article-link-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.book-article-label {
    font-size: 10px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.book-article-label a {
    color: #6366f1;
    text-decoration: none;
    transition: color 0.2s;
}

.book-article-label a:hover {
    color: #a78bfa;
}

.book-article-title {
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.4;
}

/* Why read */
.book-why {
    font-size: 14px;
    color: #94a3b8;
    line-height: 1.75;
}

/* Buy button row */
.book-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 4px;
}

.book-buy-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(99, 102, 241, 0.15));
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 10px;
    padding: 10px 20px;
    color: #a78bfa;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.book-buy-btn:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(99, 102, 241, 0.25));
    border-color: rgba(139, 92, 246, 0.7);
    color: #c4b5fd;
    transform: translateY(-1px);
}

.book-buy-btn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.2s;
}

.book-buy-btn:hover svg {
    transform: translateX(2px);
}

/* ============================================
   NO RESULTS
   ============================================ */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #475569;
    display: none;
}

.no-results svg {
    width: 48px;
    height: 48px;
    stroke: #475569;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    margin-bottom: 16px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.no-results p {
    font-size: 15px;
}

/* ============================================
   LOADING STATE (AJAX)
   ============================================ */
.books-loading {
    text-align: center;
    padding: 40px;
    color: #64748b;
    display: none;
}

.books-loading.active {
    display: block;
}

/* ── ADD TO books-style.css ── */
.book-save-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
    margin-inline-end: 5px;
}
.book-save-btn svg {
    width: 16px;
    height: 16px;
    stroke: #a78bfa;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: fill 0.2s;
}
.book-save-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.5);
}
.book-save-btn.saved {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.5);
}
.book-save-btn.saved svg { fill: #a78bfa; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media ( max-width: 1200px ) {
    .books-page-wrapper {
        grid-template-columns: 200px 1fr 280px;
        gap: 30px;
        padding: 100px 30px 40px;
    }
}

@media ( max-width: 1024px ) {
    .books-page-wrapper {
        grid-template-columns: 1fr;
        padding: 90px 20px 40px;
    }

    .books-page-wrapper .sidebar-left,
    .books-page-wrapper .sidebar-right {
        display: none;
    }

    .books-main {
        padding: 0;
    }

    .page-title {
        font-size: 36px;
    }

    .page-subtitle {
        font-size: 15px;
    }
}

@media ( max-width: 640px ) {
    .book-card {
        grid-template-columns: 1fr;
        padding: 20px;
    }

    .book-spine {
        width: 90px;
        height: 130px;
        margin: 0 auto;
    }

    .book-title {
        font-size: 18px;
    }

    .books-page-wrapper {
        padding: 80px 16px 30px;
    }
}

/* ── BOOKS PAGINATION ── */
.books-pagination {
    margin-top: 40px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}
.books-pagination.hidden {
    display: none;
}

/* ── My Reading Path (Milestone 7) ── */
.mrp-scroll-wrap { position: relative; display: flex; align-items: center; gap: 0; }
.mrp-scroll-viewport { overflow: hidden; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.mrp-scroll-viewport::-webkit-scrollbar { display: none; }
.mrp-arrow { flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; background: rgba(10,13,18,0.9); border: 1px solid rgba(99,102,241,0.3); color: #818cf8; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; z-index: 2; line-height: 1; padding: 0; font-family: inherit; }
.mrp-arrow:hover { background: rgba(99,102,241,0.15); border-color: rgba(99,102,241,0.6); color: #a78bfa; }
.mrp-arrow-left  { margin-right: 10px; }
.mrp-arrow-right { margin-left:  10px; }
.mrp-book-mini { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 130px; flex-shrink: 0; cursor: pointer; transition: all 0.2s; }
.mrp-book-mini:hover { transform: translateY(-4px); }
.mrp-book-mini-cover { width: 130px; height: 195px; border-radius: 7px; overflow: hidden; border: 1px solid rgba(99,102,241,0.2); box-shadow: 0 8px 28px rgba(0,0,0,0.85); background: rgba(10,13,18,0.9); display: flex; align-items: center; justify-content: center; transition: all 0.25s; }
.mrp-book-mini:hover .mrp-book-mini-cover { border-color: #6366f1; box-shadow: 0 14px 36px rgba(0,0,0,0.9); }
.mrp-book-mini-cover img { width: 100%; height: 100%; object-fit: cover; }
.mrp-book-mini-title { font-size: 12px; font-weight: 600; color: #cbd5e1; text-align: center; line-height: 1.35; max-width: 130px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mrp-book-mini-author { font-size: 11px; color: #64748b; text-align: center; }
.mrp-reading-card { background: rgba(15,20,25,0.6); border: 1px solid rgba(99,102,241,0.2); border-radius: 14px; padding: 22px; display: flex; gap: 18px; align-items: flex-start; width: 340px; flex-shrink: 0; transition: all 0.25s; position: relative; box-shadow: 0 4px 24px rgba(0,0,0,0.6); }
.mrp-reading-card:hover { border-color: rgba(99,102,241,0.5); transform: translateY(-2px); }
.mrp-reading-cover { width: 80px; height: 120px; border-radius: 6px; overflow: hidden; flex-shrink: 0; background: rgba(10,13,18,0.9); border: 1px solid rgba(99,102,241,0.2); box-shadow: 0 8px 28px rgba(0,0,0,0.85); display: flex; align-items: center; justify-content: center; }
.mrp-reading-cover img { width: 100%; height: 100%; object-fit: cover; }
.mrp-reading-info { flex: 1; min-width: 0; }
.mrp-reading-title { font-size: 14px; font-weight: 700; color: #fff; line-height: 1.3; margin-bottom: 4px; }
.mrp-reading-author { font-size: 12px; color: #64748b; margin-bottom: 12px; }
.mrp-progress-bar-wrap { background: rgba(99,102,241,0.1); border-radius: 4px; height: 5px; margin-bottom: 6px; overflow: hidden; }
.mrp-progress-bar-fill { height: 100%; background: linear-gradient(90deg,#6366f1,#8b5cf6); border-radius: 4px; transition: width 0.4s; }
.mrp-progress-pct { font-size: 11px; color: #8b5cf6; font-weight: 600; }
.mrp-reading-remove { position: absolute; top: 10px; right: 10px; background: none; border: none; color: #475569; cursor: pointer; font-size: 16px; padding: 2px 6px; border-radius: 5px; transition: color 0.2s; }
.mrp-reading-remove:hover { color: #ef4444; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; padding-bottom: 13px; border-bottom: 1px solid rgba(99,102,241,0.15); }
.section-heading-left { font-size: 18px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 10px; }
.section-heading-left svg { width: 18px; height: 18px; fill: none; stroke: #8b5cf6; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.count-badge { font-size: 11px; font-weight: 600; color: #cbd5e1; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15); padding: 2px 9px; border-radius: 3px; }
.book-reading-btn { display: inline-flex; align-items: center; gap: 6px; background: rgba(99,102,241,0.1); border: 1px solid rgba(99,102,241,0.4); border-radius: 9px; padding: 8px 16px; color: #a5b4fc; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.3s; text-decoration: none; font-family: inherit; box-shadow: 0 4px 18px rgba(0,0,0,0.5); }
.book-reading-btn:hover { background: rgba(99,102,241,0.18); border-color: rgba(99,102,241,0.7); color: #c4b5fd; transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0,0,0,0.6); }
.book-reading-btn svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.books-tabs { display: flex; align-items: flex-end; gap: 48px; margin-bottom: 8px; border-bottom: 1px solid rgba(99,102,241,0.15); position: relative; }
.books-tab { cursor: pointer; padding-bottom: 14px; margin-bottom: -1px; transition: opacity 0.3s; }
.books-tab h1 { font-size: 32px; font-weight: 700; background: linear-gradient(135deg,#ffffff,#cbd5e1); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; line-height: 1.1; margin-bottom: 4px; }
.books-tab p { font-size: 13px; color: #94a3b8; line-height: 1.4; margin: 0; }
.books-tab-indicator { position: absolute; bottom: -1px; left: 0; height: 2px; background: #8b5cf6; transition: transform 0.35s cubic-bezier(0.4,0,0.2,1), width 0.35s cubic-bezier(0.4,0,0.2,1); }
#books-tab-content .page-header { padding-top: 16px; }
@media (max-width: 768px) {
    .books-tabs { gap: 20px; }
    .books-tab h1 { font-size: 20px; }
    .books-tab p { display: none; }
    .mrp-arrow { display: none; }
    .mrp-reading-card { width: 290px; }
    #mrp-rec-detail-overlay > div > div { flex-direction: column; }
}

/* ── Recommended book banner per category (Milestone 7) ── */
.rec-book-banner { display: none; margin-bottom: 28px; }
.rec-book-banner.visible { display: block; }
.rec-book-card { background: rgba(15,20,25,0.6); border: 1px solid rgba(99,102,241,0.2); border-radius: 13px; padding: 36px; position: relative; overflow: hidden; transition: all 0.3s ease; display: flex; gap: 32px; align-items: center; box-shadow: 0 4px 18px rgba(0,0,0,0.5); }
.rec-book-card:hover { border-color: rgba(99,102,241,0.55); transform: translateY(-3px); box-shadow: 0 12px 32px rgba(0,0,0,0.6); }
.rec-book-cover { width: 110px; min-width: 110px; height: 160px; border-radius: 3px 10px 10px 3px; overflow: hidden; background: #1a1d29; box-shadow: -6px 10px 32px rgba(0,0,0,0.9); flex-shrink: 0; align-self: center; }
.rec-book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rec-book-body { flex: 1; display: flex; flex-direction: column; }
.rec-book-cat { font-size: 12px; font-weight: 600; color: #667eea; text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 12px; }
.rec-book-title { font-size: 24px; font-weight: 700; color: #fff; line-height: 1.35; margin: 0 0 6px 0; }
.rec-book-author { font-size: 14px; color: #a5b4fc; font-style: italic; line-height: 1.6; margin: 0 0 4px 0; }
.rec-book-weekly { font-size: 12px; color: rgba(255,255,255,0.3); margin: 0 0 18px 0; }
.rec-book-art-link { display: flex; align-items: flex-start; gap: 7px; padding: 9px 12px; background: rgba(99,102,241,0.06); border: 1px solid rgba(99,102,241,0.15); border-radius: 9px; margin-bottom: 14px; }
.rec-book-art-link .book-art-link-icon { width: 13px; height: 13px; min-width: 13px; margin-top: 2px; }
.rec-book-art-link .book-art-link-icon svg { width: 13px; height: 13px; fill: none; stroke: #6366f1; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rec-book-art-link .book-art-label { font-size: 11px; font-weight: 700; color: #818cf8; }
.rec-book-art-link .book-art-title { font-size: 12px; color: #94a3b8; line-height: 1.4; }
.rec-book-why { background: rgba(99,102,241,0.07); border-left: 3px solid #6366f1; border-radius: 0 10px 10px 0; padding: 14px 18px; margin-bottom: 24px; }
.rec-book-why-label { font-size: 11px; font-weight: 700; color: #8b5cf6; text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 6px; }
.rec-book-why-text { font-size: 13px; color: rgba(255,255,255,0.7); line-height: 1.6; margin: 0; }
.rec-book-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.rec-book-get-btn { background: rgba(99,102,241,0.1); border: 1px solid rgba(99,102,241,0.4); border-radius: 10px; color: #a5b4fc; font-size: 13px; font-weight: 600; padding: 11px 24px; cursor: pointer; transition: all 0.2s; font-family: inherit; text-decoration: none; box-shadow: 0 4px 18px rgba(0,0,0,0.5); }
.rec-book-get-btn:hover { transform: translateY(-1px); background: rgba(99,102,241,0.18); border-color: rgba(99,102,241,0.7); color: #c4b5fd; box-shadow: 0 8px 24px rgba(0,0,0,0.6); text-decoration: none; }

/* ── Most read books this week ── */
.most-read-section { grid-column: 1 / -1; margin: 8px 0 4px 0; background: rgba(99,102,241,0.06); border: 1px solid rgba(99,102,241,0.2); border-radius: 14px; padding: 24px 24px 20px; }
.most-read-section .most-read-cat { font-size: 12px; font-weight: 400; color: #94a3b8; margin-left: 4px; }
.most-read-section .most-read-grid { grid-template-columns: 1fr 1fr; gap: 20px; }
.most-read-section .book-card { margin: 0; }
@media (max-width: 768px) {
    .rec-book-card { flex-direction: column; padding: 22px; gap: 18px; }
    .rec-book-title { font-size: 20px; }
    .rec-book-footer { flex-wrap: wrap; justify-content: flex-start; }
    .most-read-section .most-read-grid { grid-template-columns: 1fr; }
    .most-read-section .section-heading-left { flex-wrap: wrap; }
}

/* ── Milestone 7 (item 7): short intro, books side by side, page numbers ── */
.books-intro { margin: 4px 0 22px; }
.books-intro p { font-size: 15px; color: #94a3b8; line-height: 1.7; max-width: 760px; margin: 0; }

.books-pager { margin: 4px 0 24px; }
.books-pager .pagination { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.books-pager .pagination:empty { display: none; }
.books-pager .pagination-info { font-size: 13px; color: #64748b; }
.books-pager-bottom { margin: 28px 0 10px; }

#books-tab-content .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: stretch; }
#books-tab-content .book-card { display: flex; flex-direction: column; gap: 18px; padding: 28px; }
#books-tab-content .book-card .book-spine { align-self: center; }
#books-tab-content .book-card .book-content { flex: 1; }
#books-tab-content .book-card .book-title { font-size: 19px; text-align: center; }
#books-tab-content .book-card .book-author { text-align: center; }
#books-tab-content .book-card .book-footer { margin-top: auto; padding-top: 6px; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
#books-tab-content .book-card .book-why { font-size: 13.5px; }
@media (max-width: 900px) {
    #books-tab-content .book-grid { grid-template-columns: 1fr; }
}
