/* assets/css/canvas_book_reader.css — Canvas Reader Papperpop */
.cbr-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(10, 10, 10, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    display: none;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
    font-family: 'Figtree', sans-serif;
    color: #ffffff;
    user-select: none;
    -webkit-user-select: none;
}

.cbr-overlay.active {
    display: flex !important;
}

/* Header Bar */
.cbr-header {
    width: 100%;
    height: 56px;
    background: rgba(20, 20, 20, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    box-sizing: border-box;
    flex-shrink: 0;
    z-index: 10;
}

.cbr-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: 45%;
}

.cbr-btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #ffffff;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.cbr-btn-back:hover {
    background: #ffce28;
    color: #111111;
    border-color: #ffce28;
}

.cbr-book-title {
    font-size: 15px;
    font-weight: 700;
    color: #f3f4f6;
    letter-spacing: 0.3px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cbr-header-center {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cbr-page-indicator {
    font-size: 13.5px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.12);
    padding: 4px 14px;
    border-radius: 9999px;
    letter-spacing: 0.5px;
    color: #e5e7eb;
}

.cbr-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cbr-btn-icon {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.cbr-btn-icon:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

.cbr-btn-close {
    background: #ef4444;
    border-color: #ef4444;
    font-size: 16px;
    font-weight: 800;
}

.cbr-btn-close:hover {
    background: #dc2626;
    border-color: #dc2626;
}

/* Main Canvas Body */
.cbr-body {
    flex: 1;
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 16px;
    box-sizing: border-box;
}

.cbr-canvas-wrapper {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 1px rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    background: #1e1e1e;
    transition: transform 0.15s ease-out;
}

#cbrCanvas {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 170px);
    object-fit: contain;
    background-color: #ffffff;
}

/* Navigation Arrow Buttons */
.cbr-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(20, 20, 20, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    z-index: 20;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.cbr-nav-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-50%) scale(1.08);
}

.cbr-nav-prev {
    left: 24px;
}

.cbr-nav-next {
    right: 24px;
}

.cbr-nav-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
    transform: translateY(-50%) scale(1) !important;
}

/* Bottom Strip: Thumbnails */
.cbr-footer {
    width: 100%;
    background: rgba(20, 20, 20, 0.9);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 20px;
    box-sizing: border-box;
    flex-shrink: 0;
    z-index: 10;
}

.cbr-thumbnails-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    max-width: 100%;
    padding: 4px 0;
    scrollbar-width: thin;
}

.cbr-thumbnails-row::-webkit-scrollbar {
    height: 4px;
}

.cbr-thumbnails-row::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 4px;
}

.cbr-thumb {
    width: 42px;
    height: 56px;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    object-fit: cover;
    background: #2b2b2b;
    opacity: 0.6;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.cbr-thumb:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.cbr-thumb.active {
    border-color: #f59e0b;
    opacity: 1;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.cbr-hint-text {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
}

/* Responsive Mobile Rules */
@media (max-width: 768px) {
    .cbr-header {
        height: 50px;
        padding: 0 12px;
    }
    .cbr-book-title {
        font-size: 13px;
    }
    .cbr-page-indicator {
        font-size: 12px;
        padding: 3px 10px;
    }
    .cbr-btn-icon {
        width: 32px;
        height: 32px;
    }
    .cbr-nav-btn {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
    .cbr-nav-prev {
        left: 8px;
    }
    .cbr-nav-next {
        right: 8px;
    }
    .cbr-thumb {
        width: 32px;
        height: 44px;
    }
    .cbr-hint-text {
        display: none;
    }
    #cbrCanvas {
        max-height: calc(100vh - 140px);
    }
}
