/* ============================================================
   GR1P 3D PDF Catalogue Flipbook — scoped under .gr1p-flipbook-wrapper
   ============================================================ */

.gr1p-flipbook-wrapper {
    max-width: 1200px;
    margin: 48px auto;
    background: linear-gradient(135deg, #20242b 0%, #2d323b 100%);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    color: #f2f2f2;
    font-family: inherit;
}

/* ---------- Toolbar ---------- */

.gr1p-flipbook-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.35);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.gr1p-flipbook-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    color: #ffffff;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.gr1p-flipbook-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.3);
}

.gr1p-flipbook-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.gr1p-flipbook-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.7);
    outline-offset: 2px;
}

.gr1p-flipbook-counter {
    font-size: 0.9rem;
    min-width: 9em;
    text-align: center;
    white-space: nowrap;
}

.gr1p-flipbook-spacer {
    flex: 1;
}

/* ---------- Stage / pages ---------- */

.gr1p-flipbook-stage {
    position: relative;
    margin: 0 auto;
    overflow: hidden;
    touch-action: pan-y;
}

.gr1p-flipbook-page {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gr1p-flipbook-page canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    background: #ffffff;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.55);
}

/* ---------- Loading / error states ---------- */

.gr1p-flipbook-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.85);
    pointer-events: none;
}

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

.gr1p-flipbook-spinner {
    width: 26px;
    height: 26px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: gr1p-flipbook-spin 0.9s linear infinite;
}

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

.gr1p-flipbook-error {
    padding: 32px 20px;
    text-align: center;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
}

.gr1p-flipbook-missing {
    text-align: center;
    color: #b3261e;
}

/* ---------- Fullscreen ---------- */

.gr1p-flipbook-wrapper:fullscreen {
    max-width: none;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    display: flex;
    flex-direction: column;
}

.gr1p-flipbook-wrapper:fullscreen .gr1p-flipbook-stage {
    flex: 0 1 auto;
    margin: auto;
}

/* ---------- Mobile (single page mode) ---------- */

@media (max-width: 640px) {
    .gr1p-flipbook-wrapper {
        margin: 32px auto;
    }

    .gr1p-flipbook-toolbar {
        flex-wrap: wrap;
        justify-content: center;
        row-gap: 8px;
        padding: 10px 12px;
    }

    .gr1p-flipbook-counter {
        order: -1;
        flex-basis: 100%;
        min-width: 0;
    }
}
