/**
 * Voiceover Styling - RIGHT-SIDE PANEL VERSION
 * 
 * Styles for right-side voiceover panel with compact 4-line preview,
 * playback controls, and main content highlighting.
 */

/* ============================================
   VOICEOVER PANEL (Right Side - Fixed Position)
   ============================================ */

.voiceover-panel {
  position: fixed;
  top: 120px; /* Below header + tabs */
  right: 0;
  width: 25%;
  min-width: 280px;
  max-width: 400px;
  height: auto;
  max-height: calc(100vh - 140px);
  background: rgba(255, 248, 240, 0.97);
  border-left: 3px solid var(--accent-gold, #d4af37);
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
  box-shadow: -3px 0 15px rgba(0, 0, 0, 0.2);
  z-index: 900;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  opacity: 0;
  transform: translateX(100%);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.voiceover-panel.voiceover-visible {
  opacity: 1;
  transform: translateX(0);
}

.voiceover-panel.voiceover-fadeout {
  opacity: 0;
  transform: translateX(100%);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Panel header */
.voiceover-panel-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid rgba(212, 175, 55, 0.3);
}

.vo-icon {
  font-size: 1.3rem;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.vo-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #8b4513;
  font-family: 'Georgia', serif;
}

/* Text preview area (4 lines, small font) */
.voiceover-text-preview {
  flex: 1;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #2c1810;
  font-family: 'Georgia', 'Times New Roman', serif;
  overflow: hidden;
  max-height: 4.8rem; /* 4 lines * 1.2rem line-height */
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
}

/* Panel controls */
.voiceover-panel-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 2px solid rgba(212, 175, 55, 0.3);
}

.vo-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--accent-gold, #d4af37);
  background: linear-gradient(135deg, #fff8f0, #f5e6d3);
  color: #6b3410;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.vo-btn:hover {
  background: linear-gradient(135deg, #f4d03f, #d4af37);
  transform: scale(1.1);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.vo-btn:active {
  transform: scale(0.95);
}

.vo-btn:focus {
  outline: 3px solid rgba(212, 175, 55, 0.5);
  outline-offset: 2px;
}

.vo-btn.vo-close {
  border-color: #c0392b;
  color: #c0392b;
}

.vo-btn.vo-close:hover {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
}

/* ============================================
   MAIN CONTENT ADJUSTMENTS
   ============================================ */

/* Adjust main content width when panel is visible */
body.voiceover-active .main-content,
body.voiceover-active .verse-canvas {
  margin-right: calc(25% + 1rem);
  transition: margin-right 0.4s ease;
}

/* ============================================
   TEXT HIGHLIGHTING IN MAIN CONTENT
   ============================================ */

.voiceover-highlight {
  background: linear-gradient(120deg, #fff4cc 0%, #ffe680 100%);
  padding: 0.2rem 0.3rem;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(212, 175, 55, 0.3);
  transition: background 0.3s ease;
  animation: highlight-pulse 1.5s ease-in-out infinite;
}

@keyframes highlight-pulse {
  0%, 100% { background: linear-gradient(120deg, #fff4cc 0%, #ffe680 100%); }
  50% { background: linear-gradient(120deg, #ffe680 0%, #ffd700 100%); }
}

/* ============================================
   PRASTAVANA MODULE (Introduction page)
   ============================================ */

.prastavana-container {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #fff8f0 0%, #f5e6d3 100%);
  overflow-y: auto;
  padding: 2rem;
}

.prastavana-content {
  /* max-width: 900px; */
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.009);
  border-radius: 12px;
  padding: 3rem;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  border-left: 5px solid var(--accent-gold);
  
  /* NEW: Fixed height and scrollable */
  max-height: calc(100vh - 280px);
  overflow-y: auto;
  overflow-x: hidden;
  position: relative; /* For sticky navigation */
}

/* Scrollbar styling for prastavana content */
.prastavana-content::-webkit-scrollbar {
  width: 8px;
}

.prastavana-content::-webkit-scrollbar-track {
  background: rgba(201, 169, 97, 0.1);
  border-radius: 4px;
}

.prastavana-content::-webkit-scrollbar-thumb {
  background: var(--accent-gold, #d4af37);
  border-radius: 4px;
}

.prastavana-content::-webkit-scrollbar-thumb:hover {
  background: #B8935A;
}

/* Title section */
.prastavana-title {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 3px double var(--accent-gold, #d4af37);
}

.prastavana-title h1 {
  font-size: 2.5rem;
  color: #8b4513;
  margin-bottom: 0.5rem;
  font-family: 'Georgia', serif;
  font-weight: 600;
}

.prastavana-title h2 {
  font-size: 2rem;
  color: #a0522d;
  margin-bottom: 0.75rem;
  font-family: 'Georgia', serif;
  font-weight: 500;
  font-style: italic;
}

.prastavana-title .subtitle {
  font-size: 1.2rem;
  color: #6b3410;
  font-style: italic;
  margin-top: 1rem;
}

/* Introduction text */
.prastavana-intro {
  color: #2c1810;
  font-family: 'Georgia', 'Times New Roman', serif;
  line-height: 1.9;
  font-size: 1.1rem;
}

.prastavana-intro h1 {
  font-size: 2rem;
  color: #8b4513;
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.prastavana-intro h2 {
  font-size: 1.6rem;
  color: #a0522d;
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.prastavana-intro h3 {
  font-size: 1.3rem;
  color: #b8762d;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.prastavana-intro p {
  margin-bottom: 1.2rem;
}

.prastavana-intro em {
  font-style: italic;
  color: #8b4513;
  font-weight: 500;
}

.prastavana-intro strong {
  font-weight: 700;
  color: #6b3410;
}

/* Navigation hint */
.prastavana-navigation {
  margin-top: 3rem;
  padding: 2rem;
  padding-bottom: 1rem; /* Extra padding for sticky positioning */
  background: linear-gradient(135deg, #fff3e0, #ffe0b2);
  border-radius: 8px;
  border-left: 5px solid var(--accent-gold, #d4af37);
  text-align: center;
  
  /* NEW: Sticky at bottom of scrollable container */
  /* position: sticky; */
  bottom: 0;
  background: rgba(255, 243, 224, 0.98); /* Match gradient but with transparency */
  backdrop-filter: blur(5px); /* Blur effect for content scrolling behind */
  z-index: 10;
}

.prastavana-navigation .nav-hint {
  font-size: 1.15rem;
  color: #6b3410;
  line-height: 1.8;
  margin: 0;
}

.prastavana-navigation strong {
  color: #8b4513;
  font-size: 1.25rem;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
  .voiceover-overlay {
    width: 95%;
    max-height: 85vh;
  }

  .voiceover-content {
    padding: 1.5rem;
    font-size: 0.95rem;
  }

  .voiceover-controls {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }

  .voiceover-skip-btn {
    width: 100%;
  }

  .prastavana-container {
    padding: 1rem;
  }

  .prastavana-content {
    padding: 2rem 1.5rem;
  }

  .prastavana-title h1 {
    font-size: 2rem;
  }

  .prastavana-title h2 {
    font-size: 1.6rem;
  }

  .prastavana-intro {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .voiceover-content h1 {
    font-size: 1.5rem;
  }

  .voiceover-content h2 {
    font-size: 1.2rem;
  }

  .prastavana-title h1 {
    font-size: 1.75rem;
  }

  .prastavana-title h2 {
    font-size: 1.4rem;
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.voiceover-skip-btn:focus {
  outline: 3px solid #d4af37;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .voiceover-overlay {
    border-width: 4px;
  }

  .voiceover-content {
    color: #000;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .voiceover-overlay {
    transition: none;
  }

  .voiceover-icon {
    animation: none;
  }

  .voiceover-skip-btn {
    transition: none;
  }
}
