/* ==========================================================================
   PDF Flipbook v5 – StPageFlip with correct sizing
   ========================================================================== */

:root {
    --pdfb-bg: rgba(10, 10, 14, 0.94);
    --pdfb-toolbar-bg: rgba(22, 22, 28, 0.97);
    --pdfb-text: #fff;
    --pdfb-text-muted: rgba(255,255,255,0.5);
    --pdfb-radius: 12px;
    --pdfb-ease: 0.35s cubic-bezier(0.4,0,0.2,1);
}

/* ── Modal ── */
.pdfb-modal-overlay {
    position: fixed; inset: 0; z-index: 999990;
    background: var(--pdfb-bg);
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    opacity: 0; visibility: hidden;
    transition: opacity var(--pdfb-ease), visibility var(--pdfb-ease);
}
.pdfb-modal-overlay[aria-hidden="false"] { opacity: 1; visibility: visible; }

.pdfb-modal-inner {
    position: absolute; inset: 15px;
    display: flex; flex-direction: column;
    background: rgba(18,18,24,0.85);
    border-radius: var(--pdfb-radius);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.3), 0 20px 60px rgba(0,0,0,0.5);
    overflow: hidden;
}

/* ── Toolbar ── */
.pdfb-modal-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px; height: 52px; flex-shrink: 0;
    background: var(--pdfb-toolbar-bg);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.pdfb-toolbar-left, .pdfb-toolbar-center, .pdfb-toolbar-right {
    display: flex; align-items: center; gap: 4px;
}
.pdfb-toolbar-left { flex: 1; min-width: 0; }
.pdfb-toolbar-right { flex: 1; justify-content: flex-end; }

.pdfb-modal-title {
    font-size: 13px; font-weight: 600; color: var(--pdfb-text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.pdfb-tbtn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border: none; border-radius: 8px;
    background: transparent; color: var(--pdfb-text); cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    text-decoration: none; padding: 0;
}
.pdfb-tbtn:hover { background: rgba(255,255,255,0.1); }
.pdfb-tbtn:active { transform: scale(0.92); }
.pdfb-tbtn svg { display: block; }

.pdfb-page-display {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 500; color: var(--pdfb-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    user-select: none; min-width: 70px; justify-content: center;
}
.pdfb-sep { color: var(--pdfb-text-muted); font-weight: 400; }

/* ── Viewer Area ── */
.pdfb-viewer-area {
    flex: 1; display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden; min-height: 0;
}

/* ── Flipbook ── */
.pdfb-flipbook {
    margin: 0 auto;
}

.pdfb-page {
    background: #fff;
}
.pdfb-page img {
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

/* Hide pages not yet managed by StPageFlip */
.pdfb-flipbook > .pdfb-page:not(.stf__item) {
    position: absolute !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* ── Loading ── */
.pdfb-loading {
    position: absolute; inset: 0; display: flex;
    align-items: center; justify-content: center; z-index: 10;
}
.pdfb-loading.pdfb-hidden { display: none; }
.pdfb-loading-content {
    display: flex; flex-direction: column; align-items: center; gap: 24px;
}
.pdfb-logo { opacity: 0.9; }
.pdfb-progress-wrap {
    width: 200px; height: 3px; background: rgba(255,255,255,0.1);
    border-radius: 3px; overflow: hidden;
}
.pdfb-progress-bar {
    height: 100%; width: 0%; background: rgba(255,255,255,0.8);
    border-radius: 3px; transition: width 0.3s ease;
}
.pdfb-progress-text {
    font-size: 12px; font-weight: 500; color: var(--pdfb-text-muted);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0.05em; font-variant-numeric: tabular-nums;
}

/* ── Inline Preview ── */
.pdfb-inline-trigger { margin: 1.5em 0; max-width: 100%; }
.pdfb-inline-preview {
    position: relative; overflow: hidden;
    border: 1px solid #e0e0e0;
    background: #f5f5f5; cursor: pointer; aspect-ratio: 16/9; max-height: 400px;
}
.pdfb-inline-canvas-wrap {
    width: 100%; height: 100%; display: flex;
    align-items: center; justify-content: center;
}
.pdfb-inline-canvas { display: block; max-width: 100%; max-height: 100%; }
.pdfb-inline-loading {
    position: absolute; inset: 0; display: flex;
    align-items: center; justify-content: center; background: #f5f5f5; z-index: 2;
}
.pdfb-inline-loading .pdfb-spinner {
    width: 24px; height: 24px; border: 2.5px solid #e5e7eb;
    border-top-color: #1a1a1a; border-radius: 50%;
    animation: pdfb-spin 0.7s linear infinite;
}
@keyframes pdfb-spin { to { transform: rotate(360deg); } }
.pdfb-inline-loading.pdfb-hidden { display: none; }
.pdfb-inline-overlay {
    position: absolute; inset: 0; display: flex;
    align-items: center; justify-content: center;
    background: rgba(0,0,0,0); transition: background 0.3s; z-index: 3;
}
.pdfb-inline-preview:hover .pdfb-inline-overlay { background: rgba(0,0,0,0.3); }
/* Button matches site style — outlined box */
.pdfb-open-btn {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 14px 32px; border: 1px solid #1a1a1a;
    background: #fff; color: #1a1a1a;
    font-size: 14px; font-weight: 600; letter-spacing: 0.02em;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    cursor: pointer; opacity: 0; transform: translateY(6px);
    transition: opacity 0.3s, transform 0.3s, background 0.2s;
}
.pdfb-open-btn:hover { background: #1a1a1a; color: #fff; }
.pdfb-inline-preview:hover .pdfb-open-btn { opacity: 1; transform: translateY(0); }
.pdfb-inline-title {
    padding: 10px 2px 4px; font-size: 13px; font-weight: 400; color: #666;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ── Button Shortcode ── */
.pdfb-button {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 15px; font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    cursor: pointer; transition: all 0.2s; text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.pdfb-button svg { flex-shrink: 0; }

/* Minimal — just icon + text, no background */
.pdfb-button--minimal {
    padding: 0; border: none; background: none;
    color: #1a1a1a; gap: 8px;
}
.pdfb-button--minimal:hover { opacity: 0.7; }
.pdfb-button--minimal:active { opacity: 0.5; }

/* Default — solid dark button */
.pdfb-button--default {
    padding: 14px 28px; border-radius: 12px;
    background: #1a1a1a; color: #fff; border: 2px solid #1a1a1a;
}
.pdfb-button--default:hover { background: #333; border-color: #333; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,0.15); }

/* Outline */
.pdfb-button--outline {
    padding: 14px 28px; border-radius: 12px;
    background: transparent; color: #1a1a1a; border: 2px solid #d1d5db;
}
.pdfb-button--outline:hover { border-color: #1a1a1a; transform: translateY(-1px); }

/* Dark */
.pdfb-button--dark {
    padding: 14px 28px; border-radius: 12px;
    background: #0f172a; color: #fff; border: 2px solid #0f172a;
}
.pdfb-button--dark:hover { background: #1e293b; transform: translateY(-1px); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .pdfb-modal-inner { inset: 8px; border-radius: 10px; }
    .pdfb-modal-toolbar { height: 44px; padding: 0 10px; }
    .pdfb-modal-title { font-size: 11px; }
    .pdfb-tbtn { width: 34px; height: 34px; }
    .pdfb-tbtn svg { width: 18px; height: 18px; }
}
