/* ==========================================================================
   HERCARE — 3D REALISTIC PAPER-TURN FLIPBOOK STYLESHEET
   Features: 3D perspective, spine shading, drag-to-curl physics, 2-page spread
   ========================================================================== */

.paper-turn-section {
  padding: 110px 0;
  position: relative;
  background: radial-gradient(ellipse at 50% 40%, rgba(192, 132, 252, 0.06) 0%, rgba(3, 3, 6, 0) 70%);
}

.book-viewport {
  position: relative;
  width: 100%;
  max-width: 1240px;
  height: 600px;
  perspective: 2400px;
  -webkit-perspective: 2400px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
}

/* 3D Book Frame */
.book-3d-wrapper {
  position: relative;
  width: 100%;
  height: 580px;
  transform-style: preserve-3d;
  transition: transform 0.6s var(--ease-spring);
  box-shadow: 0 35px 80px -15px rgba(0, 0, 0, 0.95), 0 0 50px rgba(244, 63, 94, 0.12);
  border-radius: 12px;
}

/* Realistic Book Spine & Cover Backing */
.book-spine-backdrop {
  position: absolute;
  inset: -12px -16px;
  background: linear-gradient(135deg, #181824 0%, #0D0D14 50%, #08080C 100%);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8), 0 20px 50px rgba(0, 0, 0, 0.8);
  z-index: 0;
}

.book-spine-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 24px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, rgba(0,0,0,0.6) 0%, rgba(255,255,255,0.06) 50%, rgba(0,0,0,0.6) 100%);
  z-index: 5;
  pointer-events: none;
}

/* Pages Spread Container (Left Page & Right Page) */
.book-spread {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  z-index: 1;
}

/* Page Surface */
.book-page {
  flex: 1;
  height: 100%;
  background: linear-gradient(135deg, #0E0E16 0%, #13131D 100%);
  color: #FFFFFF;
  padding: 44px 40px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  user-select: none;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Left Page Inner Shadow */
.book-page-left {
  border-right: none;
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
  background-image: linear-gradient(to right, rgba(0,0,0,0.1), rgba(0,0,0,0.45));
}

/* Right Page Inner Shadow */
.book-page-right {
  border-left: none;
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
  background-image: linear-gradient(to left, rgba(0,0,0,0.1), rgba(0,0,0,0.45));
}

/* Realistic Paper Fold Shadow in the Center */
.book-page-left::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 40px;
  background: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.6) 100%);
  pointer-events: none;
}

.book-page-right::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 40px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.6) 0%, transparent 100%);
  pointer-events: none;
}

/* Page Turning Flip Leaf */
.page-flip-leaf {
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.25, 1, 0.35, 1), box-shadow 0.8s ease;
  z-index: 10;
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
  cursor: grab;
}

.page-flip-leaf:active {
  cursor: grabbing;
}

.page-flip-leaf.flipped {
  transform: rotateY(-180deg);
}

.leaf-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  padding: 44px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 8px;
  background: linear-gradient(135deg, #0E0E16 0%, #13131D 100%);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.leaf-front {
  z-index: 2;
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}

.leaf-back {
  transform: rotateY(180deg);
  z-index: 1;
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
  background-image: linear-gradient(to right, rgba(0,0,0,0.1), rgba(0,0,0,0.45));
}

/* Page Header & Badge */
.page-top-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
  margin-bottom: 20px;
}

.page-section-tag {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary-light);
}

.page-number {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Page Content Typography */
.page-heading {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: #FFFFFF;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.page-text {
  font-family: var(--font-primary);
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

/* Page Content Elements */
.page-infographic-box {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0;
}

.phase-bar-diagram {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
}

.phase-bar-seg {
  height: 100%;
}

.phase-bar-m { width: 18%; background: var(--phase-menstrual); }
.phase-bar-f { width: 28%; background: var(--phase-follicular); }
.phase-bar-o { width: 14%; background: var(--phase-ovulation); }
.phase-bar-l { width: 40%; background: var(--phase-luteal); }

/* Realistic Page Peel Curl Corner */
.page-peel-corner {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, transparent 50%, rgba(244, 63, 94, 0.25) 50%, rgba(255, 255, 255, 0.3) 100%);
  border-top-left-radius: 12px;
  cursor: pointer;
  transition: all 0.3s var(--ease-spring);
  box-shadow: -3px -3px 10px rgba(0, 0, 0, 0.4);
}

.page-peel-corner:hover {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, transparent 50%, rgba(244, 63, 94, 0.4) 50%, rgba(255, 255, 255, 0.5) 100%);
}

.page-peel-corner::after {
  content: '👉';
  font-size: 0.75rem;
  position: absolute;
  bottom: 6px;
  right: 6px;
  opacity: 0.8;
}

/* Book Bottom Navigation Controls */
.book-navigation-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.book-turn-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.25s var(--ease-spring);
}

.book-turn-btn:hover:not(:disabled) {
  background: rgba(244, 63, 94, 0.15);
  border-color: var(--primary);
  color: #FFFFFF;
  transform: translateY(-2px);
}

.book-turn-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.book-page-indicator {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Responsive Book Layout */
@media (max-width: 840px) {
  .book-3d-wrapper {
    height: 520px;
  }
  .book-page {
    padding: 24px 20px;
  }
  .leaf-face {
    padding: 24px 20px;
  }
  .page-heading {
    font-size: 1.25rem;
  }
  .page-text {
    font-size: 0.8125rem;
  }
}

@media (max-width: 640px) {
  .book-spread {
    flex-direction: column;
  }
  .book-page-left {
    display: none;
  }
  .book-3d-wrapper {
    height: 480px;
  }
  .page-flip-leaf {
    width: 100%;
  }
  .book-spine-line {
    display: none;
  }
}
