@charset "utf-8";
/* =============================================================================
 * File   : /common/css2/book-preview-layer.css
 * Version: BOOK_PREVIEW_LAYER_CSS-2026-04-11-r007
 * Updated: 2026-04-11 13:20 KST
 * -----------------------------------------------------------------------------
 * Purpose
 * - 교재 미리보기 공용 레이어 스타일
 *
 * [r007]
 * - 현재 서버 r006 기준 재작성
 * - 패널 최대폭 확대(원본 2422px 대응)
 * - body 스크롤 허용으로 max-height 축소 의존도 제거
 * - JS layout class(is-double-mode / is-single-mode) 기준 1장/2장 표시 제어
 * - 실제 perPageWidth 계산 결과를 우선 적용
 * - opacity 중심 전환으로 이미지 흔들림/지글거림 완화
 * - ajax-loader.gif 로딩 반영
 * - 모바일 닫기 버튼을 타이틀 우측 유지
 * - 모바일 타이틀 ellipsis 처리
 *
 * [r006]
 * - .bpv-panel border-radius 3px 로 조정
 * - .bpv-page-card__sheet border-radius 제거
 * - .bpv-page-card__sheet padding 제거로 좌우 여백 최소화
 * - .bpv-page-card__image, .bpv-page-card__fallback-image width:100% 제거
 * - 이미지/교재 폭을 자연스럽게 유지하면서 좌우 여백이 덜 보이도록 정리
 * ========================================================================== */

html.is-book-preview-open,
body.is-book-preview-open {
    overflow: hidden;
}

.bpv-live {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.bpv-layer {
    position: fixed;
    inset: 0;
    z-index: 999999;
}

.bpv-layer[hidden] {
    display: none !important;
}

.bpv-layer,
.bpv-layer * {
    box-sizing: border-box;
}

.bpv-layer__dim {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.72);
    backdrop-filter: blur(2px);
}

.bpv-panel {
    position: relative;
    z-index: 1;
    width: min(1680px, calc(100vw - 24px));
    max-height: calc(100svh - 16px);
    margin: 8px auto;
    background: #ffffff;
    border-radius: 3px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.bpv-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 12px 16px;
    padding: 16px 18px 14px;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
    flex: 0 0 auto;
}

.bpv-head__title-wrap {
    min-width: 0;
    overflow: hidden;
}

.bpv-head__title {
    margin: 0;
    color: #111827;
    font-size: 22px;
    line-height: 1.35;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bpv-head__meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    min-width: 0;
}

.bpv-head__progress-wrap {
    width: clamp(220px, 22vw, 340px);
    min-width: 220px;
    margin-top: 0;
}

.bpv-head__progress-text {
    color: #4b5563;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 700;
    text-align: right;
}

.bpv-head__progressbar {
    position: relative;
    margin-top: 8px;
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: #eef2f7;
    overflow: hidden;
}

.bpv-head__progressbar-fill {
    display: block;
    width: 0;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #ffcf3e 0%, #ffb000 100%);
    transition: width 0.2s ease;
}

.bpv-head__close {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 999px;
    background: #111827;
    color: #ffffff;
    font-size: 28px;
    line-height: 1;
    font-weight: 400;
    cursor: pointer;
    justify-self: end;
}

.bpv-toolbar {
    padding: 0;
    border: 0;
    background: transparent;
}

.bpv-toolbar__controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.bpv-body {
    position: relative;
    padding: 14px 18px 18px;
    background: #f7f8fb;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.bpv-loading,
.bpv-empty {
    min-height: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.bpv-loading__spinner {
    width: 48px;
    height: 48px;
    background: url("https://www.erumenb.com/content/img/ajax-loader.gif") no-repeat center center;
    background-size: 48px 48px;
}

.bpv-loading__text,
.bpv-empty__text {
    margin: 14px 0 0;
    color: #111827;
    font-size: 16px;
    line-height: 1.6;
    font-weight: 700;
}

.bpv-stage {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 16px;
    min-height: 320px;
    user-select: none;
    -webkit-user-select: none;
}

.bpv-page-card {
    flex: 1 1 0;
    min-width: 0;
    user-select: none;
    -webkit-user-select: none;
}

.bpv-page-card__sheet {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 100%;
    padding: 8px;
    background: linear-gradient(180deg, #fcfcfd 0%, #f7f7f9 100%);
    border: 1px solid #e5e7eb;
    border-radius: 0;
    box-shadow:
        0 4px 12px rgba(17, 24, 39, 0.05),
        inset 0 0 0 1px rgba(255,255,255,0.7);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

.bpv-page-card__image,
.bpv-page-card__fallback-image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: none;
    margin: 0;
    border-radius: 0;
    background: #ffffff;
    border: 1px solid #e8edf3;
    box-shadow: 0 2px 6px rgba(17, 24, 39, 0.04);
    object-fit: contain;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    -moz-user-select: none;
    -ms-user-select: none;
    transform: none !important;
    filter: none !important;
    image-rendering: auto;
    vertical-align: top;
}

.bpv-page-card__image[hidden] {
    display: none !important;
}

.bpv-page-card__placeholder {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 320px;
    padding: 0;
    overflow: hidden;
    border-radius: 0;
    background: #eef1f5;
    user-select: none;
    -webkit-user-select: none;
}

.bpv-page-card__placeholder[hidden] {
    display: none !important;
}

.bpv-page-card.is-empty .bpv-page-card__sheet {
    background: linear-gradient(180deg, #fbfcfe 0%, #f3f5f8 100%);
}

.bpv-btn {
    min-width: 52px;
    height: 46px;
    padding: 0 16px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background: #ffffff;
    color: #111827;
    font-size: 22px;
    line-height: 1;
    font-weight: 800;
    cursor: pointer;
    transition:
        background-color 0.18s ease,
        border-color 0.18s ease,
        opacity 0.18s ease,
        transform 0.18s ease,
        box-shadow 0.18s ease;
    box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
}

.bpv-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    box-shadow: 0 4px 10px rgba(17, 24, 39, 0.07);
}

.bpv-btn:active {
    transform: translateY(1px);
}

.bpv-btn.is-disabled {
    opacity: 0.32;
    cursor: not-allowed;
    box-shadow: none;
}

.bpv-toast {
    position: absolute;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%) translateY(10px);
    min-width: 180px;
    max-width: calc(100% - 32px);
    padding: 11px 14px;
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.94);
    color: #ffffff;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 700;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.18s ease,
        transform 0.18s ease;
}

.bpv-toast.is-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   Layout mode
   ========================================================================== */

.bpv-layer.is-single-mode .bpv-stage {
    gap: 0;
}

.bpv-layer.is-single-mode .bpv-page-card--left {
    flex: 1 1 100%;
    max-width: 100%;
}

.bpv-layer.is-single-mode .bpv-page-card--right {
    display: none !important;
}

.bpv-layer.is-double-mode .bpv-page-card--right {
    display: block;
}

/* ==========================================================================
   Motion
   ========================================================================== */

.bpv-stage.is-anim-next .bpv-page-card__sheet,
.bpv-stage.is-anim-prev .bpv-page-card__sheet {
    animation: bpvPageFadeIn 0.18s ease-out both;
    will-change: opacity;
}

@keyframes bpvPageFadeIn {
    0% {
        opacity: 0.84;
    }
    100% {
        opacity: 1;
    }
}

@media all and (max-width: 991px) {
    .bpv-panel {
        width: calc(100vw - 16px);
        max-height: calc(100svh - 8px);
        margin: 4px auto;
        border-radius: 3px;
    }

    .bpv-head {
        grid-template-columns: minmax(0, 1fr) 44px;
        align-items: center;
        gap: 10px 12px;
        padding: 14px 14px 12px;
    }

    .bpv-head__title {
        font-size: 18px;
    }

    .bpv-head__close {
        grid-column: 2;
        grid-row: 1;
        align-self: center;
        justify-self: end;
    }

    .bpv-head__meta {
        grid-column: 1 / -1;
        justify-content: space-between;
        gap: 10px;
    }

    .bpv-head__progress-wrap {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
    }

    .bpv-head__progress-text {
        text-align: left;
    }

    .bpv-body {
        padding: 12px;
    }

    .bpv-page-card__sheet {
        padding: 6px;
    }

    .bpv-page-card__placeholder {
        min-height: 240px;
    }

    .bpv-toolbar__controls {
        gap: 8px;
    }

    .bpv-btn {
        min-width: 48px;
        height: 42px;
        font-size: 20px;
        border-radius: 10px;
    }

    .bpv-toast {
        bottom: 18px;
        font-size: 13px;
    }
}

@media all and (max-width: 640px) {
    .bpv-head__meta {
        flex-direction: column;
        align-items: stretch;
    }

    .bpv-toolbar__controls {
        justify-content: space-between;
    }

    .bpv-btn {
        flex: 1 1 0;
    }
}