* {
  box-sizing: border-box;
}

/* 無障礙樣式處理 */
*:focus {
  outline: #FFA500 dashed 3px !important;
  outline-offset: 3px !important;
  transition: outline 0.2s ease-in-out;
}

body {
  overflow: auto;
  margin: 0;
  padding: 0;
  background-image: url("../../../../images/flipbook_bg.png");
  background-repeat: repeat; /* 使背景圖片重複 */
  background-position: center;
}

.flipbook-viewport {
  overflow: hidden;
  width: 100%;
  height: 100%;
}

.flipbook-viewport .container {
  position: absolute;
  top: 50%;
  left: 50%;
  margin: auto;
}

.flipbook-viewport .flipbook {
  width: 922px;
  height: 600px;
  left: -461px;
  top: -300px;
}

.flipbook-viewport .page {
  width: 461px;
  height: 600px;
  background-color: white;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.flipbook .page {
  -webkit-box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  -moz-box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  -ms-box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  -o-box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}

.flipbook-viewport .page img {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  margin: 0;
}

.flipbook-viewport .shadow {
  -webkit-transition: -webkit-box-shadow 0.5s;
  -moz-transition: -moz-box-shadow 0.5s;
  -o-transition: -webkit-box-shadow 0.5s;
  -ms-transition: -ms-box-shadow 0.5s;

  -webkit-box-shadow: 0 0 20px #ccc;
  -moz-box-shadow: 0 0 20px #ccc;
  -o-box-shadow: 0 0 20px #ccc;
  -ms-box-shadow: 0 0 20px #ccc;
  box-shadow: 0 0 20px #ccc;
}

.flipbook .page-wrapper {
  -webkit-perspective: 2000px;
  -moz-perspective: 2000px;
  -ms-perspective: 2000px;
  perspective: 2000px;
}


.book-control {
  position: fixed;
  top: 1rem;
  left: 1rem;
  width: 100px;
  text-align: center;
  padding: 1rem;
}

.mt-5 {
  margin-top: 1.5rem;
}

.btn {
  width: 80px;
  height: 80px;
  border-radius: 50px;
  cursor: pointer;
  border: 0px;
  background-color: rgba(85, 82, 163, 0.8);
  color: #FFFFFF;
}

.zoom-number {
  color: rgb(85, 82, 163);
  padding: 0 2rem;
  margin: 10px 0;
  font-weight: bold;
}

.text-white {
  color: white;
}

.size-50-px {
  width: 50px;
  height: 50px;
}

.w-400-px {
  width: 400px;
}

.circle {
  border-radius: 50px;
  border: 0px;
  cursor: pointer;
  background: rgba(85, 82, 163, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
}

.circle:hover {
  background: rgba(85, 82, 163, 1);
}

.book-top {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
}

.book-top .info {
  width: 50%;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 25px;
  top: 10px;
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
}

.book-top .info i {
  color: rgba(85, 82, 163, 0.7);
  cursor: pointer;
}

.book-top .info i:hover {
  color: rgba(85, 82, 163, 1);
}


.book-left {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  display: flex;
}

.book-left .circle {
  align-self: center;
  position: absolute;
  left: 20px;
}

.book-right {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  display: flex;
}

.book-right .circle {
  align-self: center;
  position: absolute;
  right: 20px;
}

.book-bottom {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
}

.book-bottom .info {
  position: absolute;
  bottom: 20px;
  display: flex;
  width: 100%;
  justify-content: center;
}

.info .page-info {
  width: 100px;
  background: rgba(85, 82, 163, 0.7);
  text-align: center;
  padding: 5px 0;
  border-radius: 25px;
}

.d-flex {
  display: flex;
}

.align-items-center {
  align-items: center;
}

.m-0 {
  margin: 0;
}
.ms-5-rem {
  margin-left: 5rem;
}

.size-40-px {
  width: 40px;
  height: 40px;
}

.d-none {
  display: none !important;
}

/* 全螢幕控制項 */
.fullscreen-controls {
  margin-left: auto;
  display: flex;
  gap: 10px;
}

/* 全螢幕模式樣式 */
.fullscreen-mode {
  background-image: url("../../../../images/flipbook_bg.png");
}

.fullscreen-mode .flipbook-viewport {
  z-index: 1000;
}

.fullscreen-mode .flipbook-viewport .flipbook {
  /* 全螢幕時書本會透過 JavaScript 動態調整大小 */
}

/* 全螢幕模式下的控制項 - 完全隱藏 */
.fullscreen-mode .book-top,
.fullscreen-mode .book-left,
.fullscreen-mode .book-right,
.fullscreen-mode .book-bottom {
  opacity: 0;
  transform: translateY(-100%);
  transition: all 0.3s ease;
  z-index: 1001;
}

.fullscreen-mode .book-left {
  transform: translateX(-100%);
}

.fullscreen-mode .book-right {
  transform: translateX(100%);
}

.fullscreen-mode .book-bottom {
  transform: translateY(100%);
}

/* 當懸停時滑出顯示 */
.fullscreen-mode .book-top.show,
.fullscreen-mode .book-left.show,
.fullscreen-mode .book-right.show,
.fullscreen-mode .book-bottom.show {
  opacity: 1;
  transform: translate(0, 0);
}

/* 全螢幕模式下的控制項尺寸調整 */
.fullscreen-mode .book-top .info {
  transform: translateX(-50%) translateY(-100%) scale(0.9);
  transform-origin: center top;
}

.fullscreen-mode .book-top.show .info {
  transform: translateX(-50%) translateY(0) scale(0.9);
}

.fullscreen-mode .book-left .circle,
.fullscreen-mode .book-right .circle {
  width: 45px;
  height: 45px;
  font-size: 1rem;
}

.fullscreen-mode .book-bottom .info {
  transform: translateY(100%) scale(0.9);
  transform-origin: center bottom;
}

.fullscreen-mode .book-bottom.show .info {
  transform: translateY(0) scale(0.9);
}

/* 確保控制項在全螢幕模式下有背景 */
.fullscreen-mode .book-top .info {
  background-color: #BEBAB7;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.fullscreen-mode .book-bottom .page-info {
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.fullscreen-mode .book-left .circle,
.fullscreen-mode .book-right .circle {
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 滑鼠移動到邊緣時顯示控制項 */
.fullscreen-mode .hover-zone-top,
.fullscreen-mode .hover-zone-bottom,
.fullscreen-mode .hover-zone-left,
.fullscreen-mode .hover-zone-right {
  position: fixed;
  z-index: 1002;
  pointer-events: none; /* 懸停區域不攔截點擊事件 */
}

/* 確保控制項可以被點擊 */
.fullscreen-mode .book-top,
.fullscreen-mode .book-left,
.fullscreen-mode .book-right,
.fullscreen-mode .book-bottom {
  pointer-events: auto;
}
.fullscreen-mode .hover-zone-top {
  top: 0;
  left: 0;
  width: 100%;
  height: 80px;
}

.fullscreen-mode .hover-zone-bottom {
  bottom: 0;
  left: 0;
  width: 100%;
  height: 80px;
}

.fullscreen-mode .hover-zone-left {
  top: 0;
  left: 0;
  width: 80px;
  height: 100%;
}

.fullscreen-mode .hover-zone-right {
  top: 0;
  right: 0;
  width: 80px;
  height: 100%;
}

