/* ==========================================================================
   WEEKLY EYE DIGITAL NEWSPAPER & PDF 3D FLIP PAGE READER
   Realistic 3D Page Turn Animation, 2-Page Spread, Zoom, Audio & Clipping
   ========================================================================== */

/* Flipbook Stage & Container */
.flipbook-viewport-wrap {
  width: 100%;
  min-height: calc(100vh - 120px);
  background: radial-gradient(circle at center, #1E293B 0%, #090E1A 100%);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  user-select: none;
}

/* Reader Top Header Bar */
.flipbook-header-bar {
  background: #0B132B;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.65rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  z-index: 20;
}

/* Control Toolbar */
.flipbook-toolbar {
  background: #0F172A;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.5rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  z-index: 15;
}

.flipbook-btn-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.flipbook-tool-btn {
  background: transparent;
  border: none;
  color: #CBD5E1;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.flipbook-tool-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
}

.flipbook-tool-btn.active {
  background: var(--brand-red);
  color: #FFFFFF;
}

/* 3D Flipbook Stage */
.flipbook-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 2600px;
  perspective-origin: 50% 50%;
  padding: 2rem 1rem 6rem;
  overflow: auto;
  position: relative;
  transition: transform 0.2s ease;
}

/* The Book Structure */
.flip-book {
  position: relative;
  display: flex;
  transform-style: preserve-3d;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.9);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  border-radius: 4px;
}

/* Center Spine Crease & Shadow */
.flip-book-spine {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 14px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, 
    rgba(0,0,0,0.5) 0%, 
    rgba(255,255,255,0.1) 40%, 
    rgba(0,0,0,0.7) 50%, 
    rgba(255,255,255,0.1) 60%, 
    rgba(0,0,0,0.5) 100%);
  z-index: 10;
  pointer-events: none;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

/* Single Page & Spread Dimensions */
.flip-page {
  width: 520px;
  height: 740px;
  background: #FDFBF7;
  color: #111827;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.04);
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
}

/* Single Page Ultra-HD Reading View */
.view-mode-single .flip-book,
.single-page-book {
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.9);
  justify-content: center;
}

.view-mode-single .flip-page,
.single-page-book .flip-page {
  width: min(92vw, 760px);
  height: min(130vw, 1060px);
  border-radius: 6px;
  background-image: none;
}

.view-mode-spread .flip-book {
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.9);
}

.view-mode-spread .flip-page {
  width: min(46vw, 540px);
  height: min(65vw, 760px);
}

@media (max-width: 1200px) {
  .view-mode-spread .flip-page {
    width: 440px;
    height: 620px;
  }
}

@media (max-width: 992px) {
  .flip-page {
    width: 360px;
    height: 510px;
  }
  .flipbook-toolbar {
    padding: 0.4rem 0.75rem;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .flipbook-btn-group {
    flex-shrink: 0;
  }
}

@media (max-width: 768px) {
  .flip-page {
    width: min(92vw, 420px);
    height: min(130vw, 590px);
  }
  .flipbook-header-bar {
    padding: 0.5rem 0.85rem;
  }
  .np-page-inner {
    padding: 0.75rem 0.75rem 1.75rem;
  }
  .np-masthead-title {
    font-size: 1.5rem;
  }
  .np-headline-main {
    font-size: 1rem;
  }
  .np-columns-grid {
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  .flip-page {
    width: min(94vw, 360px);
    height: min(136vw, 510px);
  }
  .flipbook-stage {
    padding: 1rem 0.5rem 5.5rem;
  }
  .turn-zone-btn {
    width: 40px;
    font-size: 1.8rem;
  }
}

/* Left Page Spine Shadow */
.flip-page-left {
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
  background-image: linear-gradient(to right, rgba(0,0,0,0.02) 0%, rgba(0,0,0,0) 80%, rgba(0,0,0,0.18) 100%);
}

/* Right Page Spine Shadow */
.flip-page-right {
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
  background-image: linear-gradient(to left, rgba(0,0,0,0.02) 0%, rgba(0,0,0,0) 80%, rgba(0,0,0,0.18) 100%);
}

/* Flipping Leaf (The Page in Motion) */
.flip-leaf {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.645, 0.045, 0.355, 1);
  z-index: 5;
}

.flip-leaf.flip-forward {
  right: 0;
  transform-origin: left center;
}

.flip-leaf.flip-forward.is-flipping {
  transform: rotateY(-180deg);
}

.flip-leaf.flip-backward {
  left: 0;
  transform-origin: right center;
  transform: rotateY(-180deg);
}

.flip-leaf.flip-backward.is-flipping {
  transform: rotateY(0deg);
}

.leaf-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  overflow: hidden;
  background: #FDFBF7;
}

.leaf-face-front {
  transform: rotateY(0deg);
}

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

/* Dynamic Turning Shadow Overlay */
.page-shadow-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  background: linear-gradient(to right, rgba(0,0,0,0.4) 0%, transparent 100%);
}

.flip-leaf.is-flipping .page-shadow-overlay {
  opacity: 1;
}

/* Interactive Page Corner Curl Effect */
.page-corner-curl {
  position: absolute;
  width: 60px;
  height: 60px;
  cursor: pointer;
  z-index: 12;
  transition: all 0.3s ease;
}

.page-corner-curl.curl-bottom-right {
  bottom: 0;
  right: 0;
  background: linear-gradient(135deg, transparent 50%, rgba(211, 47, 47, 0.25) 50%, rgba(0,0,0,0.15) 100%);
  border-bottom-right-radius: 4px;
}

.page-corner-curl.curl-bottom-right:hover {
  width: 85px;
  height: 85px;
  background: linear-gradient(135deg, transparent 50%, rgba(211, 47, 47, 0.7) 50%, rgba(0,0,0,0.3) 100%);
}

.page-corner-curl.curl-bottom-left {
  bottom: 0;
  left: 0;
  background: linear-gradient(225deg, transparent 50%, rgba(211, 47, 47, 0.25) 50%, rgba(0,0,0,0.15) 100%);
  border-bottom-left-radius: 4px;
}

.page-corner-curl.curl-bottom-left:hover {
  width: 85px;
  height: 85px;
  background: linear-gradient(225deg, transparent 50%, rgba(211, 47, 47, 0.7) 50%, rgba(0,0,0,0.3) 100%);
}

/* Large Left/Right Turn Touch Areas */
.turn-zone-btn {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 2.5rem;
  background: rgba(0, 0, 0, 0.25);
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: all 0.25s ease;
  z-index: 25;
}

.turn-zone-btn:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.6);
  color: #FFFFFF;
}

.turn-zone-prev {
  left: 10px;
  border-radius: 8px 0 0 8px;
}

.turn-zone-next {
  right: 10px;
  border-radius: 0 8px 8px 0;
}

/* Realistic Newspaper Print Themes */
.theme-vintage-newsprint .flip-page,
.theme-vintage-newsprint .leaf-face {
  background-color: #F8F5EE;
  color: #1F2421;
}

.theme-modern-white .flip-page,
.theme-modern-white .leaf-face {
  background-color: #FFFFFF;
  color: #0F172A;
}

.theme-dark-contrast .flip-page,
.theme-dark-contrast .leaf-face {
  background-color: #111827;
  color: #F3F4F6;
}

/* Newspaper Page Graphic Components */
.np-page-inner {
  height: 100%;
  padding: 1.25rem 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  position: relative;
  box-sizing: border-box;
}

.np-masthead {
  border-bottom: 2px solid #111827;
  padding-bottom: 0.5rem;
  margin-bottom: 0.65rem;
  text-align: center;
}

.np-masthead-title {
  font-family: var(--font-headline);
  font-size: 2.1rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: #991B1B;
  line-height: 1;
}

.np-dateline-bar {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid #111827;
  border-bottom: 1px solid #111827;
  padding: 2px 0;
  margin-top: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
}

.np-columns-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  flex: 1;
  overflow: hidden;
}

.np-column-rule {
  border-right: 1px solid #D1D5DB;
  padding-right: 0.75rem;
}

.np-headline-main {
  font-family: var(--font-hindi);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 0.5rem;
  color: #000000;
  text-rendering: optimizeLegibility;
}

.np-photo-box {
  width: 100%;
  aspect-ratio: 1080 / 720;
  object-fit: cover;
  border: 1px solid #D1D5DB;
  border-radius: 2px;
  margin-bottom: 0.45rem;
  display: block;
}

.np-article-text {
  font-family: var(--font-hindi);
  font-size: 0.88rem;
  line-height: 1.6;
  color: #1F2937;
  text-align: justify;
  text-rendering: optimizeLegibility;
}

.np-page-footer {
  position: absolute;
  bottom: 0.5rem;
  left: 1.25rem;
  right: 1.25rem;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid #9CA3AF;
  padding-top: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #4B5563;
}

/* Article Clipping Tool (कतरन टूल) Overlay */
.clipping-selection-overlay {
  position: absolute;
  border: 2px dashed #D32F2F;
  background: rgba(211, 47, 47, 0.15);
  cursor: crosshair;
  z-index: 30;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

/* Bottom Thumbnail Filmstrip */
.flipbook-filmstrip-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 95px;
  background: rgba(11, 19, 43, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0 1.5rem;
  z-index: 20;
  transition: transform 0.3s ease;
}

.flipbook-filmstrip-drawer.is-hidden {
  transform: translateY(90px);
}

.filmstrip-thumb {
  height: 70px;
  aspect-ratio: 3/4;
  border-radius: 4px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.filmstrip-thumb:hover {
  transform: translateY(-4px) scale(1.05);
  border-color: var(--brand-gold);
}

.filmstrip-thumb.active {
  border-color: var(--brand-red);
  box-shadow: 0 0 12px rgba(211, 47, 47, 0.6);
  transform: translateY(-4px);
}

.filmstrip-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.filmstrip-thumb-num {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.75);
  color: #FFFFFF;
  font-size: 0.65rem;
  font-weight: 700;
  text-align: center;
  padding: 1px 0;
}
