/* Base Loader Styles */
body.loading {
    overflow: hidden;
    height: 100vh;
}

.book-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.book-container {
    display: flex;
    flex-direction: row;
    align-items: center;
}

.book {
    width: 120px;
    height: 90px;
    position: relative;
    perspective: 800px;
    margin: 0 auto;
    /* Ensures horizontal centering */
}

.page {
    position: absolute;
    width: 50%;
    height: 100%;
    background: #293462;
    transform-origin: var(--transform-origin);
    animation: flip 2s infinite ease-in-out;
    border-radius: var(--page-radius);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* LTR Specific Styles */
[dir="ltr"] {
    --transform-origin: right center;
    --page-radius: 0 4px 4px 0;
    --text-align: center;
}

/* RTL Specific Styles */
[dir="rtl"] {
    --transform-origin: left center;
    --page-radius: 4px 0 0 4px;
    --text-align: center;
}

.page:nth-child(1) {
    z-index: 3;
    animation-delay: 0s;
    background: #3a4b8c;
}

.page:nth-child(2) {
    z-index: 2;
    animation-delay: 0.2s;
    background: #2d3a6b;
}

.page:nth-child(3) {
    z-index: 1;
    animation-delay: 0.4s;
    background: #293462;
}

@keyframes flip {

    0%,
    20% {
        transform: rotateY(0);
    }

    40%,
    100% {
        transform: rotateY(-180deg);
    }
}

.loader-text {
    font-size: 2rem;
    color: #293462;
    font-weight: 500;
    margin-top: 2rem;
    padding: 0 20px;
    text-align: center;
}