/* ═══════════════════════════════════════════════════
   narration_player.css — Voice narration UI components
   Shared across all Mellow Math chapters
   ═══════════════════════════════════════════════════ */

/* ─── Floating trigger button (bottom-right) ─── */
.narration-trigger {
  position: fixed;
  bottom: 1.8rem;
  right: 1.8rem;
  z-index: 9997;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1rem 0.5rem 0.75rem;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 60px;
  background: rgba(12,16,30,0.85);
  color: var(--muted, #7b8db5);
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  -webkit-tap-highlight-color: transparent;
}

.narration-trigger:hover {
  border-color: rgba(255,255,255,0.2);
  background: rgba(12,16,30,0.92);
  color: var(--gold, #f0b429);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.narration-trigger.playing {
  border-color: var(--gold, #f0b429);
  color: var(--gold, #f0b429);
  box-shadow: 0 0 20px rgba(240,180,41,0.15), 0 4px 24px rgba(0,0,0,0.4);
}

.narration-trigger.playing .nt-icon {
  animation: narrate-pulse 1.5s ease-in-out infinite;
}

.nt-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.nt-icon svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.nt-label {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

@keyframes narrate-pulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* ─── Floating Mini-Player ─── */
.narration-miniplayer {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  z-index: 9998;
  width: 340px;
  max-width: 92vw;
  padding: 0.9rem 1.1rem 0.75rem;
  background: rgba(10,14,28,0.72);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 12px 48px rgba(0,0,0,0.5);
  transition: opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.narration-miniplayer.dragging {
  cursor: grabbing;
  opacity: 0.85 !important;
  transition: none;
}

.narration-miniplayer.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Top row: info + close */
.mp-row-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.mp-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mp-section-name {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.62rem;
  color: var(--gold, #f0b429);
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
  line-height: 1.4;
}

.mp-lang {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.5rem;
  color: var(--muted, #7b8db5);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 0.15rem;
}

/* Close button */
.mp-close {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.06);
  color: var(--muted, #7b8db5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  font-size: 0.65rem;
  -webkit-tap-highlight-color: transparent;
}

.mp-close:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

/* Progress bar */
.mp-progress-wrap {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
  margin-bottom: 0.55rem;
}

.mp-progress-bar {
  height: 100%;
  background: var(--gold, #f0b429);
  border-radius: 2px;
  width: 0%;
  transition: width 0.2s linear;
}

/* Controls row */
.mp-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
}

/* Time displays */
.mp-time {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.55rem;
  color: var(--muted, #7b8db5);
  white-space: nowrap;
  min-width: 30px;
}

.mp-time-current { text-align: right; }
.mp-time-total   { text-align: left; }

/* Play/Pause button */
.mp-play-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--gold, #f0b429);
  background: rgba(240,180,41,0.08);
  color: var(--gold, #f0b429);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.mp-play-btn:hover {
  background: var(--gold, #f0b429);
  color: var(--bg, #080d1a);
}

.mp-play-btn svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.mp-icon-play, .mp-icon-pause {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Rewind / Forward buttons */
.mp-rw, .mp-ff {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  color: var(--muted, #7b8db5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.mp-rw:hover, .mp-ff:hover {
  border-color: rgba(255,255,255,0.18);
  color: var(--gold, #f0b429);
  background: rgba(255,255,255,0.06);
}

.mp-rw svg, .mp-ff svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
  .narration-trigger {
    bottom: 1rem;
    right: 1rem;
    padding: 0.45rem 0.85rem 0.45rem 0.65rem;
  }

  .nt-label {
    font-size: 0.5rem;
  }

  .narration-miniplayer {
    bottom: 1rem;
    width: 300px;
    padding: 0.75rem 0.9rem 0.65rem;
  }

  .mp-section-name {
    max-width: 200px;
  }
}
