/* =================================================================
   booklet.css — Book-style PDF booklet viewer with two-page spread.
   Modal chrome, header, navigation arrows, and paper-texture
   backdrop for the rendered pages.
   ================================================================= */

/* =================================================================
   Booklet PDF viewer — book-style modal with two-page spread
   ================================================================= */

.booklet-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 6000;
    padding: 24px;
    animation: fadeIn 0.2s ease-out;
}

.booklet-frame {
    width: 100%;
    max-width: 1400px;
    height: 100%;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    background: var(--surface-elevated);
    border-radius: 16px;
    border: 1px solid rgba(var(--accent-primary-rgb), 0.18);
    box-shadow:
        0 40px 80px rgba(0, 0, 0, 0.7),
        inset 0 0 0 1px rgba(255, 255, 255, 0.02);
    overflow: hidden;
}

.booklet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(var(--accent-primary-rgb), 0.12);
    background: rgba(0, 0, 0, 0.2);
}

.booklet-title {
    font-size: 14px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent-primary);
    font-weight: 600;
}

.booklet-header-tools {
    display: flex;
    align-items: center;
    gap: 10px;
}

.booklet-page-label {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    font-family: 'Consolas', 'Monaco', monospace;
    margin-right: 6px;
}

.booklet-zoom-btn,
.booklet-close,
.booklet-mode-btn,
.booklet-popout-btn {
    height: 30px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.booklet-zoom-btn,
.booklet-close,
.booklet-popout-btn {
    width: 30px;
}

.booklet-mode-btn {
    padding: 0 12px;
    font-size: 12px;
    letter-spacing: 0.03em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.booklet-popout-btn {
    font-size: 14px;
}

.booklet-zoom-btn:hover,
.booklet-close:hover,
.booklet-mode-btn:hover,
.booklet-popout-btn:hover {
    background: rgba(var(--accent-primary-rgb), 0.15);
    color: var(--accent-primary);
    border-color: rgba(var(--accent-primary-rgb), 0.4);
}

.booklet-close {
    font-size: 20px;
}

/* Stage — the area where pages are rendered */
.booklet-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 20px 70px;   /* room for nav arrows */
    background:
        /* Subtle accent-tinted vignette so the stage breathes a hint of
           the user's accent without dominating the page. */
        radial-gradient(ellipse at center, rgba(var(--accent-primary-rgb), 0.03) 0%, transparent 70%),
        var(--surface-app);
}

.booklet-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 80px;
    background: rgba(var(--accent-primary-rgb), 0.08);
    border: 1px solid rgba(var(--accent-primary-rgb), 0.2);
    color: var(--accent-primary);
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
    z-index: 2;
}

.booklet-nav-prev { left: 12px; }
.booklet-nav-next { right: 12px; }

.booklet-nav:hover {
    background: rgba(var(--accent-primary-rgb), 0.2);
}
.booklet-nav:active {
    transform: translateY(-50%) scale(0.96);
}

.booklet-nav:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

/* Two-page spread */
.booklet-spread {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
}

.booklet-spread.single {
    gap: 0;
}

.booklet-page {
    position: relative;
    background: #fff;
    border-radius: 2px;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.6),
        0 1px 3px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Subtle gutter shadow toward the spine */
.booklet-page-left::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 24px;
    background: linear-gradient(to left, rgba(0,0,0,0.25), transparent);
    pointer-events: none;
}

.booklet-page-right::before {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 24px;
    background: linear-gradient(to right, rgba(0,0,0,0.25), transparent);
    pointer-events: none;
}

.booklet-page canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
}

.booklet-loading,
.booklet-error {
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
}

.booklet-error {
    color: #ff7a6c;
    font-style: normal;
}
