/* Pojok Baca / Bookshelf Section */
.pojok-baca-section {
    padding: 40px 0 60px;
    background: linear-gradient(180deg, #8B7355 0%, #6B5344 100%);
    position: relative;
}

/* Header Bar */
.pojok-baca-header {
    background: linear-gradient(180deg, #D4A574 0%, #C49A6C 100%);
    border-radius: 8px 8px 0 0;
    padding: 15px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    margin-bottom: 0;
}

.pojok-baca-header .header-title {
    font-size: 24px;
    font-weight: 700;
    color: #4A3728;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.3);
}

.pojok-baca-header .header-controls {
    display: flex;
    gap: 10px;
}

.pojok-baca-header .header-controls button {
    background: #fff;
    border: 1px solid #ccc;
    padding: 8px 15px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

.pojok-baca-header .header-controls button:hover {
    background: #f5f5f5;
}

/* Bookshelf Container */
.bookshelf-container {
    background: linear-gradient(180deg, #C9A66B 0%, #B8956A 50%, #A58460 100%);
    border-radius: 0 0 8px 8px;
    padding: 30px 25px 20px;
    position: relative;
    box-shadow:
        inset 0 5px 15px rgba(0, 0, 0, 0.2),
        0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Wooden Shelf Row */
.book-shelf-row {
    position: relative;
    margin-bottom: 50px;
}

.book-shelf-row:last-child {
    margin-bottom: 20px;
}

/* Wooden Shelf */
.book-shelf {
    display: flex;
    justify-content: flex-start;
    align-items: flex-end;
    gap: 25px;
    padding: 20px 30px 0;
    position: relative;
    min-height: 240px;
    z-index: 5;
}

/* Shelf board element */
.shelf-board {
    position: relative;
    height: 25px;
    background: linear-gradient(180deg, #8B6914 0%, #6B5010 50%, #5A420D 100%);
    border-radius: 0 0 5px 5px;
    box-shadow:
        0 5px 15px rgba(0, 0, 0, 0.4),
        inset 0 2px 0 rgba(255, 255, 255, 0.1);
    margin: -10px -5px 0;
    /* Naikkan board 10px agar overlap dengan buku */
    z-index: 1;
}

/* Shelf front edge */
.shelf-board::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(180deg, #5A420D 0%, #4A350A 100%);
    border-radius: 0 0 3px 3px;
}

/* Book Cards */
.book-card {
    width: 160px;
    height: 220px;
    background: #333;
    border-radius: 3px 8px 8px 3px;
    /* overflow: hidden removed to allow tooltip popup */
    box-shadow:
        -3px 0 8px rgba(0, 0, 0, 0.3),
        3px 3px 10px rgba(0, 0, 0, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    position: relative;
    transform-origin: bottom center;
    z-index: 2;
}

.book-card:hover {
    transform: translateY(-15px) scale(1.05);
    box-shadow:
        -5px 0 15px rgba(0, 0, 0, 0.4),
        5px 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

/* Book spine effect */
.book-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 8px;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.1) 50%, transparent 100%);
    z-index: 5;
}

/* Book page edges */
.book-card::after {
    content: '';
    position: absolute;
    right: -2px;
    top: 5px;
    bottom: 5px;
    width: 4px;
    background: repeating-linear-gradient(180deg,
            #f5f5dc 0px,
            #f5f5dc 1px,
            #e8e8d0 1px,
            #e8e8d0 2px);
    border-radius: 0 2px 2px 0;
}

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

.book-card .book-cover-canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Book title overlay on hover */
.book-card .book-title-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
    padding: 40px 10px 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.book-card:hover .book-title-overlay {
    opacity: 1;
}

.book-card .book-title-overlay h4 {
    color: #fff;
    font-size: 12px;
    margin: 0;
    line-height: 1.3;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Tooltip popup for description */
.book-card .book-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(0, 0, 0, 0.95);
    color: #fff;
    padding: 12px 15px;
    border-radius: 8px;
    width: 220px;
    max-height: 250px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.book-card .book-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.95);
}

.book-card:hover .book-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-5px);
}

.book-card .book-tooltip strong {
    display: block;
    font-size: 13px;
    margin-bottom: 8px;
    line-height: 1.3;
    color: #ffd700;
}

.book-card .book-tooltip p {
    font-size: 11px;
    line-height: 1.5;
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
}

/* Pagination */
.bookshelf-pagination {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
}

.bookshelf-pagination span {
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
}

/* Footer branding */
.bookshelf-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.bookshelf-footer .branding {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

.bookshelf-footer .nav-btn {
    width: 35px;
    height: 35px;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: background 0.3s;
}

.bookshelf-footer .nav-btn:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* Flipbook Modal */
.flipbook-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.flipbook-modal.active {
    display: flex;
}

.flipbook-container {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
}

.flipbook-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.flipbook-close:hover {
    transform: scale(1.2);
}

.flipbook-viewer {
    width: 800px;
    height: 600px;
    max-width: 85vw;
    max-height: 80vh;
}

.flipbook-nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

.flipbook-nav button {
    background: linear-gradient(135deg, #8B6914 0%, #6B5010 100%);
    color: #fff;
    border: none;
    padding: 10px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.flipbook-nav button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(139, 105, 20, 0.4);
}

.flipbook-page-info {
    color: #666;
    font-size: 14px;
    padding: 0 20px;
    display: flex;
    align-items: center;
}

/* Empty State */
.pojok-baca-empty {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.6);
}

.pojok-baca-empty i {
    font-size: 60px;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* Responsive */
@media (max-width: 992px) {
    .book-card {
        width: 140px;
        height: 190px;
    }

    .book-shelf {
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .flipbook-viewer {
        width: 100%;
        height: 400px;
    }

    .book-card {
        width: 120px;
        height: 165px;
    }

    .book-shelf {
        gap: 15px;
        padding: 15px 20px 0;
    }

    .pojok-baca-header .header-title {
        font-size: 16px;
    }

    .pojok-baca-header .header-controls {
        display: none;
    }
}

@media (max-width: 480px) {
    .book-card {
        width: 100px;
        height: 140px;
    }
}