/* ------------------------------------------------------------------------------------------- */
/* STYLES PAGE OUVRAGES NUMÉRIQUES (#ebooksGrille, .ebookCard, .ebookSlideshow…)               */
/* ------------------------------------------------------------------------------------------- */

/* Grille : 2 ebooks par ligne sur desktop */
#ebooksGrille {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-top: 40px;
    margin-bottom: 20px;
}

/* Carte ebook : moitié de la largeur disponible */
.ebookCard {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    width: calc(50% - 15px); /* 2 par ligne avec gap 30px */
    box-sizing: border-box;
    border: solid 1px #7f5ba2;
    border-radius: 20px;
    padding: 20px;
    background-color: #fff;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.ebookCard:hover {
    box-shadow: 0 6px 20px rgba(127, 91, 162, 0.15);
    transform: translateY(-3px);
}

/* ---- Bloc visuel (slideshow) ---- */
.ebookVisuel {
    position: relative;
    width: 100%;
}

/* Conteneur des slides : carré parfait, image non rognée */
.ebookSlideshow {
    width: 100%;
    aspect-ratio: 1 / 1;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background-color: #f4ecbb;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chaque image slide : non rognée (contain) */
.ebookSlide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.4s ease;
}

/* Slide active */
.ebookSlide--actif {
    opacity: 1;
}

/* Placeholder si aucune image */
.ebookSlidePlaceholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Athiti", sans-serif;
    font-size: 14px;
    color: #999;
    text-align: center;
    padding: 10px;
    box-sizing: border-box;
}

/* Flèches de navigation */
.ebookNav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(127, 91, 162, 0.75);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    z-index: 2;
    line-height: 1;
    user-select: none;
    transition: background-color 0.2s ease;
}

.ebookNav:hover {
    background-color: rgba(127, 91, 162, 1);
}

.ebookNav--prev { left: 4px; }
.ebookNav--next { right: 4px; }

/* Points indicateurs */
.ebookDots {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 8px;
}

.ebookDot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #d9d9d9;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.ebookDot--actif {
    background-color: #7f5ba2;
}

/* ---- Bloc infos (sous l'image) ---- */
.ebookInfos {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Titre de l'ebook */
.ebookTitre {
    font-family: "foglihtenno04regular";
    font-size: 18px;
    color: #7f5ba2;
    line-height: 1.4;
}

/* Métadonnées : niveau / pages / prix */
.ebookMeta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-family: "Athiti", sans-serif;
    font-size: 15px;
}

.ebookMetaItem {
    background-color: #f4ecbb;
    color: #7f5ba2;
    padding: 4px 12px;
    border-radius: 50px;
    white-space: nowrap;
}

/* Prix mis en valeur */
.ebookMetaPrix {
    background-color: #7f5ba2;
    color: #fff;
    font-weight: bold;
}

/* Description tronquée par défaut à 3 lignes */
.ebookDescription {
    font-family: "Athiti", sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Quand le texte est déplié (classe ajoutée par JS) */
.ebookDescription.ebookDescription--ouverte {
    display: block;
    overflow: visible;
}

/* Lien "Lire plus / Lire moins" */
.ebookDescriptionToggle {
    font-family: "Athiti", sans-serif;
    font-size: 14px;
    color: #7f5ba2;
    cursor: pointer;
    font-style: italic;
    margin-top: -6px;
}

.ebookDescriptionToggle:hover {
    text-decoration: underline;
}

/* Sommaire affiché d'office dans un encadré */
.ebookSommaireBloc {
    border: solid 1px #e0d4f0;
    border-radius: 10px;
    padding: 12px 15px;
    background-color: #faf7ff;
}

/* Titre de l'encadré sommaire */
.ebookSommaireTitre {
    font-family: "foglihtenno04regular";
    font-size: 15px;
    color: #7f5ba2;
    margin-bottom: 8px;
}

/* Liste du sommaire */
.ebookSommaireContenu {
    font-family: "Athiti", sans-serif;
    font-size: 15px;
    color: #555;
}

.ebookSommaireContenu ul {
    margin: 0;
    padding-left: 18px;
}

.ebookSommaireContenu ul li {
    margin-bottom: 4px;
    line-height: 1.5;
}

/* Bouton commander compact */
.ebookBoutonCommander {
    display: inline-block;
    margin-top: 4px;
    background-color: #7f5ba2;
    color: #fff;
    font-family: "Arvo", serif;
    font-size: 14px;
    font-weight: bold;
    padding: 10px 22px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.2s ease;
    align-self: flex-start;
}

.ebookBoutonCommander:hover {
    background-color: #5e417a;
    transform: translateY(-1px);
    color: #fff;
}

/* ------------------------------------------------------------------------------------------- */
/* MODALE COMMANDE EBOOK                                                                        */
/* ------------------------------------------------------------------------------------------- */

/* Cache semi-transparent derrière la modale */
#ebookModaleCache {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100;
}

/* Conteneur de la modale (centré) */
#ebookModale {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 101;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

/* Boîte blanche de la modale */
#ebookModaleContenu {
    background-color: #fff;
    border: solid 2px #7f5ba2;
    border-radius: 20px;
    padding: 35px 30px 30px 30px;
    position: relative;
    font-family: "Athiti", sans-serif;
}

/* Bouton fermeture × */
#ebookModaleFermer {
    position: absolute;
    top: 14px;
    right: 20px;
    font-size: 26px;
    color: #7f5ba2;
    cursor: pointer;
    line-height: 1;
    font-family: "Arvo", serif;
}

#ebookModaleFermer:hover {
    color: #5e417a;
}

/* Titre de la modale */
.ebookModaleTitre {
    font-family: "foglihtenno04regular";
    font-size: 22px;
    color: #7f5ba2;
    margin-bottom: 12px;
}

/* Texte d'intro avec le titre de l'ebook */
.ebookModaleIntro {
    font-size: 16px;
    color: #333;
    background-color: #f4ecbb;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.ebookModaleIntro strong {
    color: #7f5ba2;
}

/* Champs du formulaire */
.ebookModaleChamp {
    margin-bottom: 14px;
}

.ebookModaleChamp label {
    display: block;
    font-size: 15px;
    font-weight: bold;
    color: #555;
    margin-bottom: 5px;
}

/* Champ obligatoire */
.ebookModaleObligatoire {
    color: #c0392b;
}

.ebookModaleChamp input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    font-family: "Athiti", sans-serif;
    font-size: 16px;
    border: solid 1px #7f5ba2;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s ease;
}

.ebookModaleChamp input:focus {
    border-color: #5e417a;
    box-shadow: 0 0 0 3px rgba(127, 91, 162, 0.12);
}

/* Message d'erreur */
.ebookModaleErreur {
    display: none;
    background-color: #fdecea;
    color: #c0392b;
    border: solid 1px #f5c6cb;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    margin-bottom: 14px;
}

/* Bouton de validation finale */
.ebookModaleValider {
    text-align: center;
    margin-top: 6px;
}

#ebookModaleValiderBtn {
    display: inline-block;
    background-color: #7f5ba2;
    color: #fff;
    font-family: "Arvo", serif;
    font-size: 15px;
    font-weight: bold;
    padding: 13px 30px;
    border-radius: 50px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    user-select: none;
}

#ebookModaleValiderBtn:hover {
    background-color: #5e417a;
    transform: translateY(-1px);
}

/* ------------------------------------------------------------------------------------------- */
/* RESPONSIVE ouvrages numériques — 600px : 1 ebook par ligne                                 */
/* ------------------------------------------------------------------------------------------- */
@media screen and (max-width: 600px) {
    #ebooksGrille {
        gap: 25px;
        margin-top: 25px;
    }

    .ebookCard {
        width: 100%;
        padding: 18px;
        border-radius: 14px;
    }

    .ebookTitre {
        font-size: 16px;
    }

    /* Modale plein écran sur mobile */
    #ebookModale {
        top: 0;
        left: 0;
        transform: none;
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    #ebookModaleContenu {
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: 25px 18px 20px 18px;
    }
}
