.spb-flipbook {
    margin: 30px 0;
    text-align: center;
}

.spb-flipbook h3 {
    margin-bottom: 16px;
    font-size: 22px;
}

.spb-flipbook-stage {
    perspective: 1600px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
}

.spb-flipbook-book {
    position: relative;
    display: flex;
    transform-style: preserve-3d;
    background: linear-gradient(135deg, #e9e4da 0%, #d9d2c4 50%, #e9e4da 100%);
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), inset 0 0 20px rgba(0, 0, 0, 0.08);
    padding: 0;
    overflow: hidden;
}

.spb-flipbook-page {
    position: relative;
    width: 400px;
    height: 560px;
    max-width: 46vw;
    max-height: 64vw;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.spb-flipbook-page + .spb-flipbook-page {
    border-left: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: -6px 0 12px rgba(0, 0, 0, 0.12);
}

.spb-flipbook-media {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

.spb-flipbook-book.spb-flipping .spb-flipbook-page:last-child {
    animation: spb-page-turn 0.6s ease-in-out;
    transform-origin: left center;
}

@keyframes spb-page-turn {
    0% {
        transform: rotateY(0deg);
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
    100% {
        transform: rotateY(-70deg);
        opacity: 0.3;
    }
}

.spb-flipbook-controls {
    margin-top: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
}

.spb-flipbook-controls button {
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.spb-flipbook-controls button:hover:not(:disabled) {
    background: #135e96;
}

.spb-flipbook-controls button:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

.spb-flipbook-counter {
    font-size: 14px;
    color: #555;
    min-width: 90px;
}

@media (max-width: 640px) {
    .spb-flipbook-page {
        width: 46vw;
        height: 64vw;
    }
}

.spb-preview-btn {
    display: inline-block;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 10px 22px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin: 12px 0;
    transition: background 0.2s ease;
}

.spb-preview-btn:hover {
    background: #135e96;
}

.spb-store-preview {
    margin: 12px 0;
}

.spb-store-preview .spb-preview-btn {
    width: 100%;
    margin: 0;
}

.spb-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.spb-preview-modal-content {
    background: #f7f7f7;
    border-radius: 8px;
    max-width: 960px;
    width: 100%;
    max-height: 92vh;
    overflow: auto;
    padding: 20px;
    position: relative;
}

.spb-preview-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.spb-preview-modal-header h3 {
    margin: 0;
    font-size: 20px;
}

.spb-preview-close {
    background: #d33;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.spb-preview-close:hover {
    background: #a22;
}

.spb-preview-loading {
    text-align: center;
    padding: 40px 20px;
    font-size: 16px;
    color: #666;
}

.spb-flipbook-error {
    text-align: center;
    padding: 20px;
    font-size: 14px;
    color: #d63638;
    background: #fcf0f1;
    border: 1px solid #d63638;
    border-radius: 4px;
    width: 100%;
}

.spb-preview-modal-body .spb-flipbook-page {
    width: 380px;
    height: 520px;
    max-width: 44vw;
    max-height: 60vw;
}

@media (max-width: 860px) {
    .spb-preview-modal-body .spb-flipbook-page {
        width: 40vw;
        height: 56vw;
    }
}
