.cigpdf{
  width:100%;
  max-width: var(--cigpdf-maxw, 980px);
  margin: 16px auto;
  background: var(--cigpdf-bg, #0b0b0d);
  border-radius: 16px;
  overflow:hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.cigpdf-toolbar{
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  background: rgba(255,255,255,.06);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.cigpdf-btn{
  appearance:none;
  border:0;
  background: rgba(255,255,255,.10);
  color:#fff;
  padding:8px 10px;
  border-radius: 10px;
  cursor:pointer;
  line-height:1;
  font-weight:600;
  user-select:none;
}

.cigpdf-btn:hover{ background: rgba(255,255,255,.16); }
.cigpdf-btn:active{ transform: translateY(1px); }

.cigpdf-link{
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width: 36px;
}

.cigpdf-pageinfo{
  color: rgba(255,255,255,.9);
  font-weight:600;
  font-size:14px;
  padding:0 4px;
  min-width: 80px;
  text-align:center;
}

.cigpdf-spacer{ flex:1; }

.cigpdf-stage{
  position:relative;
  height: var(--cigpdf-h, 70vh);
  min-height: 420px;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 14px;
}

@media (max-width: 600px){
  .cigpdf-stage{ min-height: 360px; padding: 10px; }
  .cigpdf-pageinfo{ min-width: 64px; }
}

.cigpdf-book{
  width: min(900px, 100%);
  height: 100%;
  display:flex;
  align-items:center;
  justify-content:center;
  perspective: 1400px;
}

.cigpdf-sheet{
  position:relative;
  width: 100%;
  height: 100%;
  max-height: 100%;
  transform-style: preserve-3d;
}

.cigpdf-face{
  position:absolute;
  inset:0;
  background:#fff;
  border-radius: 12px;
  overflow:hidden;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
  backface-visibility:hidden;
  transform-style: preserve-3d;
}

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

.cigpdf-canvas{
  width:100%;
  height:100%;
  display:block;
}

/* Animation flip */
.cigpdf.is-flipping-next .cigpdf-sheet{
  transform-origin: left center;
  animation: cigFlipNext .55s ease-in-out forwards;
}

.cigpdf.is-flipping-prev .cigpdf-sheet{
  transform-origin: right center;
  animation: cigFlipPrev .55s ease-in-out forwards;
}

@keyframes cigFlipNext{
  0%{ transform: rotateY(0deg); }
  100%{ transform: rotateY(-180deg); }
}

@keyframes cigFlipPrev{
  0%{ transform: rotateY(0deg); }
  100%{ transform: rotateY(180deg); }
}

.cigpdf-loading{
  position:absolute;
  inset:auto 12px 12px 12px;
  color: rgba(255,255,255,.85);
  font-size: 13px;
  background: rgba(0,0,0,.35);
  padding: 8px 10px;
  border-radius: 10px;
}

.cigpdf-error{
  color:#fff;
  background: rgba(255,60,60,.18);
  border: 1px solid rgba(255,60,60,.28);
  padding: 10px 12px;
  border-radius: 12px;
  max-width: 95%;
}


.cigpdf-flip{
  width: 100%;
  height: 100%;
  display:flex;
  align-items:center;
  justify-content:center;
}

/* StPageFlip ajoute ses propres nodes, on garde un look propre */
.cigpdf .stf__parent{
  box-shadow: 0 18px 55px rgba(0,0,0,.45);
  border-radius: 14px;
  overflow: hidden;
}

.cigpdf .stf__wrapper{
  border-radius: 14px;
}


.cigpdf-page-canvas{
  image-rendering: auto;
  transform: translateZ(0);
}


/* ===== NO CONTAINER ===== */
.cigpdf{
  width:100%;
  max-width: var(--cigpdf-maxw, 100%);
  margin: 0;
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  overflow: visible !important;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* Si tu gardes la toolbar, sinon tu peux la virer */
.cigpdf-toolbar{
  display:flex;
  align-items:center;
  gap:8px;
  padding: 0 0 10px 0;
  background: transparent !important;
  border: 0 !important;
}

/* Zone flipbook : pas de padding, pas de min-height imposé */
.cigpdf-stage{
  position:relative;
  width:100%;
  height:auto;        /* important */
  min-height: 0;      /* important */
  padding: 0;         /* important */
  display:flex;
  align-items:center;
  justify-content:center;
}

.cigpdf-flip{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:center;
}

/* Neutraliser les ombres/coins injectés par la lib */
.cigpdf .stf__parent,
.cigpdf .stf__wrapper{
  border-radius: 0 !important;
  box-shadow: none !important;
  overflow: visible !important;
}

/* Loading / error : discret */
.cigpdf-loading{
  position:absolute;
  inset:auto 0 0 0;
  margin: 0 auto;
  width: fit-content;
  background: rgba(0,0,0,.55);
  color:#fff;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
}


.cigpdf-page{
  width:100%;
  height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
}
.cigpdf-page canvas{
  width:100%;
  height:100%;
}