/* ── Flipbook plugin ── */

/* ── Wrapper ── */
.flipbook-wrapper {
    position: relative;
    width: 100%;
    margin: 2rem 0;
    background: #181818;
    border-radius: 8px;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

/* ── Loading ── */
.flipbook-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 4rem 2rem;
    color: #bbb;
}

.flipbook-loading[hidden] {
    display: none !important;
}

.flipbook-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid rgba(255, 255, 255, 0.12);
    border-top-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: fb-spin 0.75s linear infinite;
}

@keyframes fb-spin {
    to { transform: rotate(360deg); }
}

.flipbook-progress {
    width: 180px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.flipbook-progress-bar {
    height: 100%;
    width: 0;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 2px;
    transition: width 0.25s ease;
}

.flipbook-loading-text {
    font-size: 0.75rem;
    color: #777;
    font-variant-numeric: tabular-nums;
}

/* ── Stage ── */
.flipbook-stage {
    position: relative;   /* required: StPageFlip uses position:absolute internally */
    width: 100%;
    background: #111;
    display: block;
    overflow: hidden;
}

/* Force hidden on SVG icons inside buttons (theme CSS can override the [hidden] attribute) */
.fb-btn svg[hidden] {
    display: none !important;
}

/* ── Controls bar ── */
.flipbook-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    background: #222;
    border-top: 1px solid #333;
}

.flipbook-controls[hidden] {
    display: none !important;
}

/* ── Buttons ── */
.fb-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    height: auto;
    flex-shrink: 0;
}

.fb-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

/* ── Page info ── */
.fb-page-info {
    font-size: 0.72rem;
    color: #888;
    font-variant-numeric: tabular-nums;
    min-width: 4.5rem;
    text-align: center;
    flex-shrink: 0;
}

/* ── Spacer ── */
.fb-spacer {
    flex: 1;
}

/* ── Error states ── */
.fb-error {
    color: #f66;
    padding: 1.5rem;
    font-size: 0.85rem;
    text-align: center;
    line-height: 1.5;
}

.flipbook-error {
    color: #c00;
    font-style: italic;
    font-size: 0.85rem;
    padding: 0.5rem 0;
}

/* ── CSS overlay fullscreen (controls bar) ── */
/* The overlay itself is styled inline in JS. Only the controls need an override. */


/* ── Responsive ── */
@media (max-width: 640px) {
    .flipbook-wrapper {
        margin: 1rem 0;
        border-radius: 4px;
    }

    .fb-page-info {
        min-width: 3.5rem;
    }
}
