/* Flipbook WP — Frontend reader */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0; height: 100%;
    background: #1a1a2e;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow: hidden;
}

/* ── Toolbar ──────────────────────────────────────────────────────────── */
#bgfp-toolbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 64px;
    background: rgba(8,8,24,.98);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    gap: 16px;
    z-index: 1000;
    border-bottom: 2px solid rgba(108,99,255,.5);
}

#bgfp-title {
    color: #e0e0f8;
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
    flex-shrink: 0;
}

#bgfp-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 17px;
}

#bgfp-pageinfo {
    display: flex;
    align-items: center;
    gap: 2px;
    min-width: 90px;
    justify-content: center;
}

#bgfp-current-wrap {
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 6px;
    transition: background .15s;
    font-weight: 800;
    font-size: 18px;
    color: #fff;
    min-width: 34px;
    text-align: center;
}
#bgfp-current-wrap:hover { background: rgba(255,255,255,.15); }

.bgfp-sep   { color: rgba(255,255,255,.35); margin: 0 3px; font-size: 17px; }
#bgfp-total { color: rgba(255,255,255,.55); font-size: 17px; }

#bgfp-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.bgfp-btn {
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.22);
    color: #eef;
    padding: 9px 20px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, transform .1s;
    white-space: nowrap;
    line-height: 1;
    user-select: none;
    font-weight: 600;
}
.bgfp-btn:hover:not(:disabled)  { background: rgba(255,255,255,.22); }
.bgfp-btn:active:not(:disabled) { transform: scale(.95); }
.bgfp-btn:disabled { opacity: .28; cursor: default; }

/* ── Barre de progression ────────────────────────────────────────────── */
#bgfp-progress {
    position: fixed;
    top: 64px; left: 0; right: 0;
    height: 3px;
    background: rgba(255,255,255,.05);
    z-index: 999;
}
#bgfp-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #6c63ff, #a78bfa);
    width: 0%;
    transition: width .35s ease;
}

/* ── Stage ────────────────────────────────────────────────────────────── */
#bgfp-stage {
    position: fixed;
    top: 67px; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

#bgfp-loader {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    color: #8888bb;
    font-size: 14px;
    letter-spacing: .04em;
    pointer-events: none;
}

.bgfp-spinner {
    width: 36px; height: 36px;
    border: 3px solid rgba(255,255,255,.1);
    border-top-color: #a78bfa;
    border-radius: 50%;
    animation: bgfp-spin .8s linear infinite;
}
@keyframes bgfp-spin { to { transform: rotate(360deg); } }

/* ── Flèches latérales ───────────────────────────────────────────────── */
.bgfp-side-arrow {
    flex-shrink: 0;
    width: 46px;
    height: 84px;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.11);
    color: rgba(255,255,255,.6);
    font-size: 32px;
    line-height: 1;
    border-radius: 10px;
    cursor: pointer;
    transition: background .2s, color .2s, transform .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    user-select: none;
}
.bgfp-side-arrow:hover:not(:disabled) {
    background: rgba(255,255,255,.18);
    color: #fff;
    transform: scale(1.07);
}
.bgfp-side-arrow:active:not(:disabled) { transform: scale(.94); }
.bgfp-side-arrow:disabled { opacity: .1; cursor: default; transform: none !important; }

/* ── Flipbook wrap ────────────────────────────────────────────────────── */
#bgfp-flipbook-wrap { position: relative; flex-shrink: 0; }
#bgfp-flipbook      { visibility: hidden; }

/* ── Pages ────────────────────────────────────────────────────────────── */
.bgfp-page {
    background: #fff;
    position: relative;
    overflow: hidden;
}
/* Taille du canvas gérée en inline style (JS) pour le support DPR.
   display:block évite l'espace inline par défaut.
   PAS de position:absolute — turn.js a besoin que le canvas soit dans le flux. */
.bgfp-page canvas {
    display: block;
}
.bgfp-page-loading {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: #ccc;
    font-size: 12px;
    pointer-events: none;
}

/* ── Ombres turn.js ───────────────────────────────────────────────────── */
.turn-page-wrapper {
    box-shadow: 0 12px 40px rgba(0,0,0,.6), 0 2px 8px rgba(0,0,0,.4);
}

/* ── Overlay saisie page ─────────────────────────────────────────────── */
#bgfp-page-input-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
#bgfp-page-input-box {
    background: rgba(12,12,32,.97);
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 14px;
    padding: 22px 32px;
    text-align: center;
    box-shadow: 0 24px 64px rgba(0,0,0,.7);
}
#bgfp-page-input-box label {
    display: block;
    color: rgba(255,255,255,.5);
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    margin-bottom: 12px;
}
#bgfp-page-input {
    width: 110px;
    padding: 10px 12px;
    font-size: 24px;
    text-align: center;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 8px;
    background: rgba(255,255,255,.07);
    color: #fff;
    outline: none;
    display: block;
    -moz-appearance: textfield;
}
#bgfp-page-input::-webkit-outer-spin-button,
#bgfp-page-input::-webkit-inner-spin-button { -webkit-appearance: none; }
#bgfp-page-input:focus {
    border-color: #a78bfa;
    box-shadow: 0 0 0 3px rgba(167,139,250,.22);
}

/* ── Mobile ───────────────────────────────────────────────────────────── */
@media ( max-width: 700px ) {
    /* Titre caché, boutons plus compacts */
    #bgfp-title        { display: none; }
    .bgfp-btn          { padding: 7px 11px; font-size: 13px; }
    #bgfp-toolbar      { height: 56px; padding: 0 12px; gap: 10px; }
    #bgfp-progress     { top: 56px; }
    #bgfp-stage        { top: 59px; gap: 0; }
    #bgfp-current-wrap { font-size: 16px; padding: 4px 8px; }
    .bgfp-sep, #bgfp-total { font-size: 15px; }
    /* Plein écran caché sur mobile (peu utile) */
    #bgfp-fs-btn       { display: none; }
}

@media ( max-width: 400px ) {
    #bgfp-controls     { gap: 6px; }
    .bgfp-btn          { padding: 6px 8px; font-size: 12px; }
}
