/* ==========================================================================
   Premium Audiobook Player Styling — Rogue AI
   ========================================================================== */

/* Player Container */
.rogue-player-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  width: min(920px, calc(100vw - 28px));
  height: 80px;
  background: rgba(20, 28, 45, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 132, 38, 0.22);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 
              0 0 20px rgba(255, 132, 38, 0.05);
  z-index: 1000;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 20px;
  transition: transform 450ms cubic-bezier(0.16, 1, 0.3, 1),
              opacity 300ms ease,
              border-color 300ms ease;
  opacity: 0;
  pointer-events: none;
}

.rogue-player-bar.active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.rogue-player-bar:hover {
  border-color: rgba(255, 132, 38, 0.4);
}

/* Scrub Bar (Positioned precisely at the top edge of the player bar) */
.rogue-player-scrub-container {
  position: absolute;
  top: -8px;
  left: 20px;
  right: 20px;
  height: 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.rogue-player-scrub-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(58, 70, 91, 0.5);
  border-radius: 2px;
  outline: none;
  margin: 0;
  cursor: pointer;
  position: relative;
  transition: height 120ms ease;
}

.rogue-player-scrub-container:hover .rogue-player-scrub-slider {
  height: 6px;
}

/* Chrome/Safari slider thumb */
.rogue-player-scrub-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff8426;
  box-shadow: 0 0 10px rgba(255, 132, 38, 0.8), 0 0 2px #fff;
  cursor: pointer;
  transition: transform 120ms ease, background-color 120ms ease;
}

.rogue-player-scrub-container:hover .rogue-player-scrub-slider::-webkit-slider-thumb {
  transform: scale(1.3);
}

/* Firefox slider thumb */
.rogue-player-scrub-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: #ff8426;
  box-shadow: 0 0 10px rgba(255, 132, 38, 0.8), 0 0 2px #fff;
  cursor: pointer;
  transition: transform 120ms ease, background-color 120ms ease;
}

.rogue-player-scrub-container:hover .rogue-player-scrub-slider::-moz-range-thumb {
  transform: scale(1.3);
}

/* Metadata Block */
.rogue-player-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 25%;
  min-width: 160px;
}

.rogue-player-cover {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(255, 132, 38, 0.3);
  background: #111625;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  transition: transform 300ms ease;
}

.rogue-player-bar.playing .rogue-player-cover {
  transform: scale(1.04);
  box-shadow: 0 0 12px rgba(255, 132, 38, 0.25);
}

.rogue-player-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rogue-player-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #f7f8fb;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.rogue-player-subtitle {
  font-size: 0.78rem;
  font-weight: 600;
  color: #aeb8cb;
  margin-top: 2px;
}

/* Central Controls Stack */
.rogue-player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex: 1;
}

.rogue-btn {
  background: none;
  border: none;
  color: #aeb8cb;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 150ms ease, background-color 150ms ease, transform 100ms ease;
  outline: none;
}

.rogue-btn:hover {
  color: #f7f8fb;
  background-color: rgba(255, 255, 255, 0.05);
}

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

/* Play/Pause Button Specifics */
.rogue-btn-playpause {
  background: #ff8426;
  color: #111625;
  width: 44px;
  height: 44px;
  box-shadow: 0 4px 15px rgba(255, 132, 38, 0.35);
}

.rogue-btn-playpause:hover {
  background: #ff9645;
  color: #111625;
  transform: scale(1.05);
  box-shadow: 0 4px 20px rgba(255, 132, 38, 0.5);
}

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

/* Time Counters */
.rogue-player-time {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 600;
  color: #aeb8cb;
  min-width: 42px;
}

.rogue-player-time.current { text-align: right; }
.rogue-player-time.remaining { text-align: left; }

/* Right Controls Area (Speed, Volume, Close) */
.rogue-player-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  width: 25%;
  min-width: 180px;
}

/* Speed Selector Wrapper */
.rogue-speed-control {
  position: relative;
}

.rogue-speed-btn {
  font-size: 0.82rem;
  font-weight: 800;
  color: #aeb8cb;
  background: rgba(20, 28, 45, 0.6);
  border: 1px solid rgba(174, 184, 203, 0.2);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  min-width: 48px;
  text-align: center;
  transition: all 150ms ease;
}

.rogue-speed-btn:hover {
  border-color: #ff8426;
  color: #f7f8fb;
  background: rgba(20, 28, 45, 0.85);
}

/* Speed Dropdown Menu */
.rogue-speed-menu {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  background: #141c2d;
  border: 1px solid rgba(255, 132, 38, 0.3);
  border-radius: 10px;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
  padding: 6px 0;
  display: flex;
  flex-direction: column;
  min-width: 72px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 150ms ease, transform 150ms ease;
  z-index: 1010;
}

.rogue-speed-menu.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.rogue-speed-option {
  background: none;
  border: none;
  color: #aeb8cb;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: all 120ms ease;
}

.rogue-speed-option:hover {
  background: rgba(255, 132, 38, 0.12);
  color: #ff8426;
}

.rogue-speed-option.active {
  color: #ff8426;
  font-weight: 900;
}

/* Volume Controller */
.rogue-volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rogue-volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 60px;
  height: 4px;
  background: rgba(58, 70, 91, 0.5);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  transition: width 150ms ease, background-color 150ms ease;
}

.rogue-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff8426;
  cursor: pointer;
}

.rogue-volume-slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: none;
  border-radius: 50%;
  background: #ff8426;
  cursor: pointer;
}

.rogue-volume-control:hover .rogue-volume-slider {
  background: rgba(58, 70, 91, 0.8);
}

/* Mini Waveform Visualizer in info bar */
.rogue-visualizer {
  display: flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 16px;
  width: 20px;
  margin-left: 10px;
}

.rogue-bar {
  width: 2.5px;
  height: 100%;
  background-color: #ff8426;
  border-radius: 1px;
  transform-origin: bottom;
  animation: bounce 1ms ease-in-out infinite alternate;
  animation-play-state: paused;
}

.rogue-player-bar.playing .rogue-bar {
  animation-play-state: running;
}

.rogue-bar:nth-child(1) { animation-duration: 450ms; }
.rogue-bar:nth-child(2) { animation-duration: 350ms; animation-delay: 150ms; }
.rogue-bar:nth-child(3) { animation-duration: 550ms; animation-delay: 50ms; }
.rogue-bar:nth-child(4) { animation-duration: 400ms; animation-delay: 200ms; }

@keyframes bounce {
  0% { transform: scaleY(0.1); }
  100% { transform: scaleY(1); }
}

/* Minimized Floating Pill Badge */
.rogue-player-pill {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(20, 28, 45, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 132, 38, 0.35);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 
              0 0 15px rgba(255, 132, 38, 0.15);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ff8426;
  cursor: pointer;
  transform: scale(0) rotate(-180deg);
  opacity: 0;
  pointer-events: none;
  transition: transform 400ms cubic-bezier(0.175, 0.885, 0.32, 1.275), 
              opacity 300ms ease,
              border-color 200ms ease,
              box-shadow 200ms ease;
}

.rogue-player-pill.active {
  transform: scale(1) rotate(0);
  opacity: 1;
  pointer-events: auto;
}

.rogue-player-pill:hover {
  border-color: #ff8426;
  box-shadow: 0 12px 35px rgba(255, 132, 38, 0.25), 0 0 15px rgba(255, 132, 38, 0.3);
}

.rogue-pill-ring {
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  border: 2px solid #ff8426;
  opacity: 0;
  pointer-events: none;
}

.rogue-player-pill.playing .rogue-pill-ring {
  animation: pulse-ring 2000ms cubic-bezier(0.215, 0.610, 0.355, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.92); opacity: 0.6; }
  80%, 100% { transform: scale(1.4); opacity: 0; }
}

/* Play Inline Buttons (on Episode Cards and Headers) */
.rogue-listen-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 160ms ease;
}

.rogue-listen-trigger:active {
  transform: scale(0.97);
}

/* Primary Listen Button (Under Episode Header) */
.rogue-hero-listen-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 24px;
  background: rgba(255, 132, 38, 0.12);
  border: 1px solid rgba(255, 132, 38, 0.4);
  border-radius: 999px;
  color: #ff8426;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 200ms ease;
  margin: 16px auto 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.rogue-hero-listen-btn:hover {
  background: #ff8426;
  color: #111625;
  border-color: #ff8426;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 132, 38, 0.3);
}

.rogue-hero-listen-btn:active {
  transform: translateY(0);
}

/* Overlay Play Banner for Resume Prompt */
.rogue-resume-prompt {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: rgba(20, 28, 45, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid #ff8426;
  border-radius: 12px;
  padding: 12px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 1050;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform 400ms cubic-bezier(0.16, 1, 0.3, 1), opacity 300ms ease;
  opacity: 0;
  pointer-events: none;
}

.rogue-resume-prompt.active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.rogue-resume-text {
  font-size: 0.88rem;
  font-weight: 700;
  color: #f7f8fb;
}

.rogue-resume-btn {
  background: #ff8426;
  border: none;
  color: #111625;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.rogue-resume-btn:hover {
  background: #ff9645;
}

.rogue-resume-dismiss {
  background: none;
  border: none;
  color: #aeb8cb;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 150ms ease;
}

.rogue-resume-dismiss:hover {
  color: #ff4444;
}

/* Custom Scrollbar styling for Reader mode dynamically loaded panels */
.rogue-reader-panel::-webkit-scrollbar {
  width: 8px;
}

.rogue-reader-panel::-webkit-scrollbar-track {
  background: rgba(20, 28, 45, 0.4);
}

.rogue-reader-panel::-webkit-scrollbar-thumb {
  background: rgba(58, 70, 91, 0.6);
  border-radius: 4px;
}

.rogue-reader-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 132, 38, 0.5);
}

/* ==========================================================================
   Responsive & Adaptive Adjustments
   ========================================================================== */

@media (max-width: 768px) {
  .rogue-player-bar {
    height: 110px;
    flex-wrap: wrap;
    padding: 10px 16px;
    bottom: 12px;
    gap: 8px;
  }
  
  .rogue-player-meta {
    width: 60%;
  }
  
  .rogue-player-actions {
    width: 35%;
    min-width: unset;
    gap: 8px;
  }
  
  .rogue-player-controls {
    width: 100%;
    order: 3;
    flex: none;
    margin-top: 4px;
    justify-content: space-between;
  }
  
  .rogue-player-time {
    display: block;
  }
  
  .rogue-volume-control {
    display: none; /* Hide volume on mobile, rely on system controls */
  }
}

@media (max-width: 480px) {
  .rogue-player-title {
    font-size: 0.85rem;
  }
  
  .rogue-player-subtitle {
    font-size: 0.72rem;
  }
  
  .rogue-player-cover {
    width: 36px;
    height: 36px;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
  
  .rogue-player-bar,
  .rogue-player-pill,
  .rogue-resume-prompt {
    transition: none !important;
  }
}
