/**
 * 3D FlipBook Styles
 */

.flipbook-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.flipbook-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    perspective: 2000px;
    perspective-origin: center center;
}

.flipbook-book {
    position: relative;
    display: flex;
    transform-style: preserve-3d;
    transform-origin: center center;
}

/* Pages */
.flipbook-page {
    width: 500px;
    height: 700px;
    background-color: #fff;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    position: relative;
}

.flipbook-page-left {
    border-radius: 3px 0 0 3px;
    transform-origin: right center;
}

.flipbook-page-right {
    border-radius: 0 3px 3px 0;
    transform-origin: left center;
}

/* Shadows for 3D effect */
.flipbook-shadow {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    pointer-events: none;
}

.flipbook-shadow-left {
    right: 0;
    background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.1));
}

.flipbook-shadow-right {
    left: 0;
    background: linear-gradient(to left, transparent, rgba(0, 0, 0, 0.1));
}

/* Page flip animation */
.flipbook-flip {
    position: absolute;
    top: 0;
    width: 500px;
    height: 700px;
    transform-style: preserve-3d;
    transform-origin: left center;
    z-index: 10;
}

.flipbook-flip-next {
    right: 0;
    transform-origin: left center;
}

.flipbook-flip-prev {
    left: 0;
    transform-origin: right center;
}

.flipbook-flip-front,
.flipbook-flip-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fff;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    backface-visibility: hidden;
}

.flipbook-flip-back {
    transform: rotateY(180deg);
}

.flipbook-flip-next.flipbook-flip-active {
    animation: flipNext 0.8s ease-in-out forwards;
}

.flipbook-flip-prev.flipbook-flip-active {
    animation: flipPrev 0.8s ease-in-out forwards;
}

@keyframes flipNext {
    0% {
        transform: rotateY(0deg);
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    }
    50% {
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
    }
    100% {
        transform: rotateY(-180deg);
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    }
}

@keyframes flipPrev {
    0% {
        transform: rotateY(0deg);
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    }
    50% {
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
    }
    100% {
        transform: rotateY(180deg);
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    }
}

/* Controls */
.flipbook-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    margin-top: 20px;
}

.flipbook-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.flipbook-btn:hover:not(:disabled) {
    background: #fff;
    transform: scale(1.1);
}

.flipbook-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.flipbook-btn svg {
    width: 24px;
    height: 24px;
    fill: #333;
}

.flipbook-page-indicator {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    min-width: 120px;
    text-align: center;
}

.flipbook-page-input {
    width: 60px;
    padding: 6px 8px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

.flipbook-page-input:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Loader */
.flipbook-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    color: #fff;
}

.flipbook-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.flipbook-error {
    color: #ff6b6b;
    text-align: center;
    padding: 40px;
}

.flipbook-page-loading {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Responsive */
@media (max-width: 1100px) {
    .flipbook-page {
        width: 400px;
        height: 560px;
    }

    .flipbook-flip {
        width: 400px;
        height: 560px;
    }
}

@media (max-width: 900px) {
    .flipbook-page {
        width: 340px;
        height: 476px;
    }

    .flipbook-flip {
        width: 340px;
        height: 476px;
    }
}

@media (max-width: 750px) {
    .flipbook-book {
        flex-direction: column;
    }

    .flipbook-page {
        width: 320px;
        height: 448px;
    }

    .flipbook-page-left {
        display: none;
    }

    .flipbook-page-right {
        border-radius: 3px;
    }

    .flipbook-flip {
        width: 320px;
        height: 448px;
    }

    .flipbook-controls {
        padding: 15px;
        gap: 15px;
    }

    .flipbook-btn {
        width: 40px;
        height: 40px;
    }
}
