/* Flipbook - Book Style */
.sc-flipbook-wrap {
  position: relative;
  background: #111;
  border-radius: 8px;
  overflow: hidden;
  margin: 20px auto;
  max-width: 100%;
}
.sc-flipbook-viewport {
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1500px;
}
.sc-flipbook-book {
  position: relative;
  display: flex;
  transform-style: preserve-3d;
}
.sc-flipbook-page {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  box-shadow: 2px 0 8px rgba(0,0,0,0.3);
  overflow: hidden;
}
.sc-flipbook-page img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Spread: 2 trang cạnh nhau */
.sc-flipbook-spread {
  display: flex;
  transition: opacity 0.4s ease;
}
.sc-flipbook-spread.is-hidden {
  display: none;
}
.sc-flipbook-spread .sc-flipbook-page {
  width: 50%;
}

/* Flip animation */
.sc-flipbook-spread.flip-left {
  animation: flipLeft 0.5s ease-in-out;
}
.sc-flipbook-spread.flip-right {
  animation: flipRight 0.5s ease-in-out;
}
@keyframes flipLeft {
  0% { transform: rotateY(0); }
  50% { transform: rotateY(-15deg); opacity: 0.7; }
  100% { transform: rotateY(0); }
}
@keyframes flipRight {
  0% { transform: rotateY(0); }
  50% { transform: rotateY(15deg); opacity: 0.7; }
  100% { transform: rotateY(0); }
}

/* Book spine shadow */
.sc-flipbook-spread::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 100%;
  background: linear-gradient(to right,
    rgba(0,0,0,0.15) 0%,
    rgba(0,0,0,0.05) 30%,
    rgba(0,0,0,0) 50%,
    rgba(0,0,0,0.05) 70%,
    rgba(0,0,0,0.15) 100%
  );
  pointer-events: none;
  z-index: 2;
}

/* Controls */
.sc-flipbook-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 0;
  background: rgba(0,0,0,0.7);
}
.sc-flip-prev,
.sc-flip-next {
  background: none;
  border: none;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  padding: 5px 15px;
  transition: color 0.2s;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
}
.sc-flip-prev { left: 10px; }
.sc-flip-next { right: 10px; }
.sc-flip-prev:hover,
.sc-flip-next:hover {
  color: #ffba00;
}
.sc-flip-counter {
  color: #fff;
  font-size: 14px;
}
.sc-flip-fullscreen,
.sc-flip-grid {
  background: none;
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.sc-flip-fullscreen:hover,
.sc-flip-grid:hover {
  background: #ffba00;
  border-color: #ffba00;
  color: #000;
}

/* Fullscreen */
.sc-flipbook-wrap.is-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  max-height: 100vh !important;
  z-index: 99999;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}
.sc-flipbook-wrap.is-fullscreen .sc-flipbook-viewport {
  flex: 1;
}

/* Footer branding */
.sc-flipbook-brand {
  display: flex;
  justify-content: space-between;
  padding: 0 15px;
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  position: absolute;
  bottom: 45px;
  left: 0;
  right: 0;
  pointer-events: none;
}

/* Mobile: 1 trang */
@media (max-width: 767px) {
  .sc-flipbook-spread .sc-flipbook-page {
    width: 100%;
  }
  .sc-flipbook-spread .sc-flipbook-page:nth-child(2) {
    display: none;
  }
  .sc-flipbook-spread::after {
    display: none;
  }
}
