/* Container styling */
.flipbook-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
    padding: 30px;
}

/* Flipbook item styling */
.flipbook-item {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.25s ease-in-out, box-shadow 0.25s ease-in-out;
    max-width: 250px;
    text-align: center;
    padding: 15px 10px;
}

.flipbook-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

/* Thumbnail styling */
.flipbook-thumbnail {
    max-height: 160px;
    width: 100%;
    object-fit: cover;
    transition: transform 0.35s ease-in-out;
    border-radius: 8px;
}

.flipbook-thumbnail:hover {
    transform: scale(1.1);
}

/* Title styling */
.flipbook-title {
    display: block;
    padding: 12px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    transition: color 0.25s ease;
}

.flipbook-title:hover {
    color: #d22027;
}

/* Minimalistic button styling */
.flipbook-toggle {
    text-decoration: none;
    color: inherit;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .flipbook-item {
        max-width: 48%;
    }
}

@media (max-width: 480px) {
    .flipbook-item {
        max-width: 90%;
    }
}

#flipbook-toggle {
    padding: 10px 16px;
    background-color: #d22027;
    color: white;
    border: 2px solid #d22027;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 50%;
    margin-bottom: 10px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#flipbook-toggle:hover {
    background-color: white;
    color: #d22027;
    font-weight: bold;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

#loading-indicator {
    display: none;
    position: fixed;
    top: 50%;
    left: 48.5%;
    transform: translate(-50%, -50%);
    z-index: 2000;
    animation: spin 1s linear infinite;
}


/* Animation pour faire tourner la roue */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

body {
    margin: 0;
    font-family: 'Roboto', sans-serif;
    /* Empeche le debordement sur l'axe x */
    overflow-x: hidden;
}

a {
    margin: 0;
    padding: 0;
}

.navigation-arrow {
    position: absolute;
    top: 50%;
    color: #333;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease, transform 0.3s ease;
    transform: translateY(-50%);
    animation: slide-in 0.5s ease-out;
}

.navigation-arrow.left:hover::before,
.navigation-arrow.right:hover::after {
    transform: scale(1.2);
}

.navigation-arrow.left:hover {
    transform: translate(-15px, -50%) scale(1.3);
}

.navigation-arrow.right:hover {
    transform: translate(15px, -50%) scale(1.3);
}

.navigation-arrow.left {
    left: 10%;
}

.navigation-arrow.right {
    right: 10%;
}

#flipbook-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    margin-top: 10px;
    padding: 20px;
    background: linear-gradient(135deg, #e2ebf0, #f8f9fa);
    border-radius: 15px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    max-width: 95%;
    margin: auto;
    gap: 5px;
    overflow: hidden;
}

.hidden {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loaded {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#pagination-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 8px 12px;
    background-color: #d22027;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
    font-weight: bold;
}

#back-toggle {
    text-decoration: none;
    position: absolute;
    top: 18px;
    left: 30px;
    padding: 8px 12px;
    background-color: #d22027;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background-color 0.3s ease;
    font-weight: bold;
    z-index: 1000;
    content: '⮜';
}

#back-toggle::before {
    content: '⮜';
    margin-right: 8px;
}

#download-toggle,
#download-toggle-mobile {
    position: absolute;
    top: 40px;
    right: 10px;
    padding: 8px 12px;
    background-color: #d22027;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
    font-weight: bold;
}

.page-container,
#pagination-toggle,
#download-toggle,
#download-toggle-mobile {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#pagination-toggle:hover {
    background-color: white;
    color: #d22027;
    font-weight: bold;
    transition: 0.3s;
}

#back-toggle:hover {
    background-color: white;
    color: #d22027;
    font-weight: bold;
    transition: 0.3s;
}

#download-toggle:hover,
#download-toggle-mobile:hover {
    background-color: white;
    color: #d22027;
    font-weight: bold;
    transition: 0.3s;
}

.pagination-button,
.download-button,
.download-button-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background-color: #d22027;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    width: 100px;
    height: 25px !important;
    box-sizing: border-box;
    transition: background-color 0.3s ease;
    text-decoration: none;
    line-height: normal;
}

a.download-button,
a.download-button-mobile {
    display: inline-flex;
}

.pagination-button:hover,
.download-button:hover,
.download-button-mobile:hover {
    background-color: white;
    color: #d22027;
    font-weight: bold;
}

.pagination-modal {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 60%;
    overflow-y: auto;
    padding: 15px;
    width: 200px;
    opacity: 0;
    transition: all 0.3s ease;
}

.pagination-modal.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.pagination-modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pagination-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
}

.page-number {
    padding: 5px;
    background-color: #f0f4f8;
    border: 1px solid #ccc;
    border-radius: 3px;
    color: #555;
    text-align: center;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.page-number:hover {
    background-color: #d22027;
    color: white;
}

.page-number.active {
    background-color: #d22027;
    color: white;
    pointer-events: none;
}

.page-container {
    width: 32%;
    height: auto;
    border: 1px solid #ddd;
    background-color: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

.page-container:hover {
    transform: scale(1.015);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.page-container {
    position: relative;
    width: 32%;
    height: auto;
}

.loupe {
    position: absolute;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 5%;
    cursor: none;
    width: 300px;
    height: 200px;
    overflow: hidden;
    display: none;
    pointer-events: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    transition: transform 0.2s ease-in-out;
}

.loupe img {
    position: absolute;
    transition: transform 0.2s ease-in-out;
}

.loupe:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.2) 100%);
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
}

#mobile-pagination-toggle {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 18px;
    right: 20px;
    z-index: 1000;
    padding: 0 10px;
    background-color: #d22027;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 15px !important;
    transition: background-color 0.3s ease;
    font-weight: bold;
    width: auto;
    height: 40px !important;
}

#mobile-pagination-toggle:hover {
    background-color: white;
    color: #d22027;
}

@media (min-width: 769px) {
    #mobile-pagination-toggle {
        display: none !important;
    }

    #download-toggle-mobile {
        display: none !important;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {

    #pagination-toggle {
        display: none;
    }

    #back-toggle {
        display: block !important;
        position: fixed;
        top: 15px;
        left: 15px;
    }

    #page-scroll-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        overflow-y: auto;
        /* Limite la hauteur pour permettre le défilement */
        max-height: 100vh;
        padding: 15px;
        width: 100%;
    }

    #flipbook-container {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    .page-container {
        width: 100%;
        max-width: 90%;
        margin: 10px auto;
    }

    #arrow-left {
        display: none !important;
    }

    #arrow-right {
        display: none !important;
    }

    #flipbook-container {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    .page-container {
        width: 80%;
        margin-bottom: 20px;
        margin-top: 25px;
    }

    .pagination-container {
        right: -40px;
    }

    .pagination-modal {
        width: 150px;
        padding: 10px;
    }

    .instruction-message {
        font-size: 0.9rem;
        padding: 8px;
        top: 5px;
    }

    .loupe {
        width: 150px;
        height: 100px;
    }

    #pagination-toggle {
        bottom: 15px;
        right: 15px;
        height: 15px;
        width: 100px;
    }

    #download-toggle {
        display: none !important;
    }

    #download-toggle-mobile {
        display: block !important;
        position: fixed;
        font-size: 12px;
        left: 50%;
        transform: translateX(-50%);
        top: 10px;
        height: 30px !important;
        width: 100px;
        z-index: 1000;
    }

    .navigation-arrow {
        font-size: 1.5rem;
        padding: 8px;
        width: 50px;
        height: 50px;
    }

    #arrow-left,
    #arrow-right {
        font-size: 1.5rem;
        padding: 8px;
    }

    .navigation-arrow.left {
        left: -25px;
        top: 40%;
    }

    .navigation-arrow.right {
        right: -25px;
        top: 60%;
    }

    #mobile-pagination-toggle {
        display: flex;
        justify-content: center;
        align-items: center;
        position: fixed;
        bottom: 15px;
        right: 15px;
        z-index: 1000;
        height: 25px;
        padding: 0 8px;
        background-color: #d22027;
        color: white;
        border: none;
        border-radius: 5px;
        cursor: pointer;
        font-size: 10px;
        transition: background-color 0.3s ease;
        font-weight: bold;
    }

    #mobile-pagination-toggle:hover {
        background-color: white;
        color: #d22027;
    }

    .pagination-modal {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 1001;
        width: 200px;
        padding: 10px;
        background-color: white;
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        border-radius: 10px;
        display: none;
    }
}


@media (max-width: 480px) {

    .navigation-arrow {
        font-size: 1.2rem;
        padding: 6px;
        width: 40px;
        height: 40px;
    }

    .navigation-arrow.left {
        left: -20px;
        top: 45%;
    }

    .navigation-arrow.right {
        right: -20px;
        top: 55%;
    }

    .pagination-button,
    .download-button-mobile {
        padding: 5px 8px;
        font-size: 10px;
        width: 80px;
        height: 20px;
    }

    .instruction-message {
        font-size: 0.8rem;
        padding: 6px;
    }

    #flipbook-container {
        padding: 10px;
        gap: 15px;
        max-width: 100%;
    }

    .page-container {
        width: 100%;
        max-width: 90%;
        margin: 10px auto;
    }

    .pagination-modal {
        width: 120px;
        padding: 8px;
        top: 50%;
        left: 50%;
        max-height: 50%;
    }

    .page-number {
        padding: 3px;
        font-size: 10px;
    }

    .loupe {
        width: 80px;
        height: 60px;
    }

}