/* ==========================================================================
   WORLDWIDE ALLIANCES MAGAZINE - INTERACTIVE FLIPBOOK & PDF READER
   ========================================================================== */

.reader-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: #0B1120;
  display: none;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.3s ease;
  user-select: none;
  overflow: hidden;
}

.reader-modal.active {
  display: flex;
  opacity: 1;
}

/* ==========================================================================
   READER TOP BAR
   ========================================================================== */
.reader-topbar {
  height: 64px;
  background: rgba(15, 23, 42, 0.96);
  border-bottom: 2px solid var(--brand-orange);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 10;
  backdrop-filter: blur(12px);
}

.reader-title-group {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 240px;
}

.reader-back-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.reader-back-btn:hover {
  background: var(--brand-orange);
  border-color: var(--brand-orange);
  color: #FFFFFF;
}

.reader-magazine-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 380px;
}

.reader-edition-tag {
  font-size: 0.78rem;
  font-weight: 800;
  color: #FFFFFF;
  background: var(--brand-blue);
  padding: 4px 10px;
  border-radius: 4px;
}

/* Reader Middle: Page Indicator & Lighting Controls */
.reader-center-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.reader-page-indicator {
  font-size: 0.92rem;
  font-weight: 600;
  color: #94A3B8;
  background: rgba(255, 255, 255, 0.08);
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.reader-page-indicator span {
  color: var(--brand-orange);
  font-weight: 800;
}

.reader-lighting-modes {
  display: flex;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 2px;
}

.lighting-btn {
  background: none;
  border: none;
  color: #94A3B8;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 16px;
  cursor: pointer;
  transition: var(--transition);
}

.lighting-btn.active {
  background: var(--brand-blue);
  color: #FFFFFF;
  box-shadow: var(--shadow-sm);
}

/* Reader Right Tools: Zoom, Layout, Fullscreen, Download */
.reader-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.reader-tool-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #F8FAFC;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: var(--transition);
}

.reader-tool-btn:hover {
  background: var(--brand-orange);
  border-color: var(--brand-orange);
  color: #FFFFFF;
}

.reader-tool-btn.active {
  background: var(--brand-blue);
  color: #FFFFFF;
  border-color: transparent;
}

/* ==========================================================================
   READER VIEWPORT (FLIPBOOK CANVAS AREA)
   ========================================================================== */
.reader-viewport {
  flex-grow: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 20px 60px;
  background: radial-gradient(circle at center, #1E293B 0%, #0B1120 100%);
  perspective: 2000px;
}

/* Lighting Mode Filters applied to Book Canvas */
.reader-viewport.mode-sepia .book-stage {
  filter: sepia(0.35) contrast(0.95) brightness(0.95);
}

.reader-viewport.mode-night .book-stage {
  filter: invert(0.9) hue-rotate(180deg) brightness(0.9) contrast(1.1);
}

/* The Book Stage Structure */
.book-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 
    0 25px 70px rgba(0, 0, 0, 0.9),
    0 0 40px rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  transition: transform 0.3s ease, filter 0.3s ease;
  transform-origin: center center;
}

/* Dual Page Spread (Book Mode) */
.book-spread {
  display: flex;
  background: #FFFFFF;
  position: relative;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.12);
}

.book-page-slot {
  position: relative;
  background: #FFFFFF;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
}

.book-page-slot.left-page {
  border-right: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 4px 0 0 4px;
}

.book-page-slot.right-page {
  border-left: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 0 4px 4px 0;
}

/* Realistic Center Spine Shadow */
.book-spine-shadow {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  background: linear-gradient(to right, 
    rgba(0,0,0,0.25) 0%, 
    rgba(0,0,0,0.55) 45%, 
    rgba(0,0,0,0.65) 50%, 
    rgba(0,0,0,0.55) 55%, 
    rgba(0,0,0,0.25) 100%);
  pointer-events: none;
  z-index: 5;
}

/* Page Turn Curl & Shadow Animation Overlay */
.page-flip-overlay {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background: linear-gradient(to left, rgba(0,0,0,0.15) 0%, transparent 100%);
  pointer-events: none;
  z-index: 6;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* PDF Page Canvas Elements */
.pdf-canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Floating Navigation Arrows */
.reader-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #1E293B;
  border: 2px solid var(--brand-orange);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 20;
  backdrop-filter: blur(8px);
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.reader-nav-arrow:hover {
  background: var(--brand-orange);
  color: #FFFFFF;
  transform: translateY(-50%) scale(1.12);
  box-shadow: var(--brand-glow-orange);
}

.reader-nav-arrow.arrow-prev {
  left: 20px;
}

.reader-nav-arrow.arrow-next {
  right: 20px;
}

.reader-nav-arrow.disabled {
  opacity: 0.25;
  pointer-events: none;
}

/* ==========================================================================
   READER BOTTOM TOOLBAR & SCRUBBER
   ========================================================================== */
.reader-bottombar {
  height: 66px;
  background: rgba(15, 23, 42, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  z-index: 10;
  backdrop-filter: blur(12px);
  gap: 20px;
}

.reader-scrubber-wrap {
  flex-grow: 1;
  max-width: 600px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 auto;
}

.reader-slider {
  flex-grow: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.2);
  outline: none;
  cursor: pointer;
}

.reader-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--brand-orange);
  box-shadow: 0 0 12px var(--brand-orange);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.reader-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

/* ==========================================================================
   THUMBNAILS DRAWER
   ========================================================================== */
.reader-thumbnails-drawer {
  position: absolute;
  bottom: 66px;
  left: 0;
  right: 0;
  height: 155px;
  background: rgba(11, 17, 32, 0.98);
  border-top: 2px solid var(--brand-blue);
  display: none;
  align-items: center;
  padding: 12px 24px;
  overflow-x: auto;
  gap: 16px;
  z-index: 15;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(16px);
}

.reader-thumbnails-drawer.active {
  display: flex;
  animation: slideUpThumbnails 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpThumbnails {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.thumbnail-card {
  flex-shrink: 0;
  height: 125px;
  width: 90px;
  background: #1E293B;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  transition: var(--transition);
  position: relative;
}

.thumbnail-card:hover {
  border-color: var(--brand-orange);
  transform: translateY(-4px);
}

.thumbnail-card.active {
  border: 2.5px solid var(--brand-orange);
  box-shadow: var(--brand-glow-orange);
}

.thumbnail-canvas {
  width: 100%;
  height: 100px;
  object-fit: cover;
  background: #FFFFFF;
}

.thumbnail-number {
  font-size: 0.75rem;
  color: #94A3B8;
  padding: 2px 0;
  font-weight: 800;
}

/* Loading Overlay */
.reader-loader {
  position: absolute;
  inset: 0;
  background: rgba(11, 17, 32, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 100;
}

.reader-spinner {
  width: 52px;
  height: 52px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--brand-orange);
  border-right-color: var(--brand-blue);
  border-radius: 50%;
  animation: spinLoader 0.9s infinite linear;
}

@keyframes spinLoader {
  to { transform: rotate(360deg); }
}

.reader-loading-text {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: #FFFFFF;
}
