/* ==========================================================
   AUDIO DROPDOWN PLAYER
========================================================== */

.essay-audio-dropdown {
  position: fixed;
  top: 70px; /* Below Reading Assistant */
  left: 0;
  right: 0;
  z-index: 999; /* BELOW Assistant (1000) so Assistant appears on top */
  background: rgba(239, 230, 211, 0.98);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transform: translateY(-100%);
  transition: transform 0.3s ease;
  opacity: 0;
  pointer-events: none; /* Don't block clicks when hidden */
}

.essay-audio-dropdown.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto; /* Enable clicks when visible */
}

.essay-audio-player-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 6px 24px;
  height: 36px; /* Reduced from 45px (20% shorter) */
}

/* Play/Pause Button */
.audio-play-btn {
  width: 28px;
  height: 28px;
  background: #6B7F5B;
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  padding: 0;
}

.audio-play-btn:hover {
  background: #5a6b4d;
  transform: scale(1.05);
}

.audio-play-btn svg {
  width: 14px;
  height: 14px;
}

.audio-play-btn.playing .audio-play-icon {
  display: none;
}

.audio-play-btn.playing .audio-pause-icon {
  display: block !important;
}

/* Time Display */
.audio-time-current,
.audio-time-total {
  font-size: 12px;
  font-weight: 600;
  color: rgba(26, 26, 26, 0.7);
  min-width: 42px;
  text-align: center;
  flex-shrink: 0;
}

/* Scrubber */
.audio-scrubber-wrapper {
  flex: 1;
  min-width: 200px;
}

.audio-scrubber {
  width: 100%;
  height: 5px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(107, 127, 91, 0.2);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.audio-scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: #6B7F5B;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.audio-scrubber::-webkit-slider-thumb:hover {
  background: #5a6b4d;
  transform: scale(1.2);
}

.audio-scrubber::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #6B7F5B;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.audio-scrubber::-moz-range-thumb:hover {
  background: #5a6b4d;
  transform: scale(1.2);
}

/* Speed Control */
.audio-speed-control {
  position: relative;
  flex-shrink: 0;
}

.audio-speed-btn {
  padding: 4px 10px;
  background: rgba(107, 127, 91, 0.1);
  border: 1px solid rgba(107, 127, 91, 0.2);
  border-radius: 6px;
  color: #6B7F5B;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 45px;
  height: 26px;
}

.audio-speed-btn:hover {
  background: rgba(107, 127, 91, 0.2);
}

.audio-speed-dropdown {
  position: absolute;
  top: calc(100% + 8px); /* Drop DOWN */
  right: 0;
  background: rgba(239, 230, 211, 0.98);
  border: 1px solid rgba(26, 26, 26, 0.12);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  padding: 6px;
  display: none;
  z-index: 1000;
}

.audio-speed-dropdown.show {
  display: block;
}

.audio-speed-option {
  display: block;
  width: 100%;
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-radius: 4px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: rgba(26, 26, 26, 0.8);
  cursor: pointer;
  transition: all 0.2s ease;
}

.audio-speed-option:hover {
  background: rgba(107, 127, 91, 0.1);
  color: #6B7F5B;
}

.audio-speed-option.active {
  background: rgba(107, 127, 91, 0.15);
  color: #6B7F5B;
}

/* Volume Control */
.audio-volume-control {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.audio-volume-btn {
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  color: #6B7F5B;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.audio-volume-btn:hover {
  color: #5a6b4d;
}

.audio-volume-btn svg {
  width: 18px;
  height: 18px;
}

.audio-volume-slider {
  width: 70px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(107, 127, 91, 0.2);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.audio-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: #6B7F5B;
  border-radius: 50%;
  cursor: pointer;
}

.audio-volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: #6B7F5B;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

/* Close Button */
.audio-close-btn {
  width: 28px;
  height: 28px;
  background: rgba(107, 127, 91, 0.15);
  border: none;
  border-radius: 50%;
  color: #6B7F5B;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  line-height: 1;
  padding: 0;
}

.audio-close-btn:hover {
  background: rgba(107, 127, 91, 0.3);
  transform: rotate(90deg);
}

/* Dark Mode */
body.essay-dark-mode .essay-audio-dropdown {
  background: rgba(42, 42, 42, 0.98);
}

body.essay-dark-mode .audio-time-current,
body.essay-dark-mode .audio-time-total {
  color: rgba(255, 255, 255, 0.7);
}

body.essay-dark-mode .audio-speed-dropdown {
  background: rgba(42, 42, 42, 0.98);
  border-color: rgba(255, 255, 255, 0.1);
}

body.essay-dark-mode .audio-speed-option {
  color: rgba(255, 255, 255, 0.8);
}

/* Responsive */
@media (max-width: 768px) {
  .essay-audio-player-compact {
    padding: 5px 16px;
    gap: 6px;
    height: 32px;
  }
  
  .audio-play-btn {
    width: 26px;
    height: 26px;
  }
  
  .audio-play-btn svg {
    width: 12px;
    height: 12px;
  }
  
  .audio-scrubber-wrapper {
    min-width: 80px;
  }
  
  .audio-volume-control {
    display: none; /* Hide volume on mobile, use device controls */
  }
  
  .audio-time-current,
  .audio-time-total {
    font-size: 11px;
    min-width: 35px;
  }
  
  .audio-speed-btn {
    padding: 3px 8px;
    font-size: 11px;
    min-width: 38px;
    height: 24px;
  }
  
  .audio-close-btn {
    width: 26px;
    height: 26px;
    font-size: 20px;
  }
}
