/* MorningEdge Audio Player — AmplitudeJS fixed bottom bar */

.me-audio {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1050;
  background: #16142b;
  border-top: 1px solid #3D3B6A;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.me-audio--visible {
  transform: translateY(0);
}

/* Shift glossary FAB above player when visible */
.me-audio--visible ~ .glossary-trigger,
body:has(.me-audio--visible) .glossary-trigger {
  bottom: 5rem;
}

/* ── Progress bar / scrubber ── */
.me-audio__progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: height 0.15s;
}

.me-audio__progress-bar:hover {
  height: 6px;
}

.me-audio__progress-buffered {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(255, 171, 61, 0.15);
  width: 0;
}

.me-audio__progress-played {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: #FFAB3D;
  width: 0;
  transition: width 0.1s linear;
}

.me-audio__progress-bar:hover .me-audio__progress-played {
  background: #ff9914;
}

/* Segment markers on the progress bar */
.me-audio__segment-marker {
  position: absolute;
  top: -1px;
  width: 2px;
  height: calc(100% + 2px);
  border-radius: 1px;
  cursor: pointer;
  z-index: 2;
  opacity: 0.6;
  transition: opacity 0.2s, transform 0.2s;
}

.me-audio__segment-marker:hover {
  opacity: 1;
  transform: scaleY(1.5);
}

/* ── Inner layout ── */
.me-audio__inner {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 960px;
  margin: 0 auto;
  padding: 10px 16px;
}

/* ── Buttons ── */
.me-audio__btn {
  background: none;
  border: none;
  color: #F0F4FF;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.me-audio__btn:hover {
  background: #2F3652;
  color: #FFAB3D;
}

.me-audio__play {
  background: #FFAB3D;
  color: #1D1B36;
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.me-audio__play:hover {
  background: #ff9914;
  color: #1D1B36;
}

/* ── Info section ── */
.me-audio__info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.me-audio__title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #F0F4FF;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.me-audio__title:not(:empty)::after {
  content: '\2014';
  margin: 0 4px;
  color: #6b6b8a;
}

.me-audio__speaker {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: #FFAB3D;
  font-weight: 500;
  white-space: nowrap;
}

.me-audio__progress-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #6b6b8a;
}

/* ── Time display ── */
.me-audio__time {
  display: flex;
  align-items: center;
  gap: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #6b6b8a;
}

.me-audio__current-time,
.me-audio__duration {
  min-width: 32px;
}

.me-audio__time-sep {
  color: #3D3B6A;
}

/* ── Speed button ── */
.me-audio__speed-btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  min-width: 36px;
}

/* ── Close button ── */
.me-audio__close {
  opacity: 0.5;
}

.me-audio__close:hover {
  opacity: 1;
}

/* ── Trigger buttons (Listen) ── */
.me-audio__trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid #3D3B6A;
  border-radius: 6px;
  color: #F0F4FF;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.me-audio__trigger:hover {
  border-color: #FFAB3D;
  color: #FFAB3D;
}

.me-audio__trigger--chat {
  margin-left: auto;
  border: none;
  padding: 10px 16px;
  font-size: 13px;
}

.me-audio__trigger--content {
  margin-bottom: 16px;
}

.me-audio__trigger--active {
  border-color: #FFAB3D;
  color: #FFAB3D;
  background: rgba(255, 171, 61, 0.1);
}

/* ── Active message/paragraph highlight ── */
/* Uses box-shadow instead of background to avoid breaking gradient-text
   elements (h2, h3, h4) that rely on background-clip: text. */
.me-audio__active {
  box-shadow: inset 0 0 0 2000px rgba(255, 171, 61, 0.08);
  border-left: 3px solid #FFAB3D;
  padding-left: 8px;
  transition: box-shadow 0.3s, border-left 0.3s;
}

/* Gradient-text headings need their background restored when active,
   since box-shadow sits behind the background layer. Override to ensure
   the gradient text remains visible with an outline-style indicator instead. */
.me-audio__active[style*="background-clip"],
h2.me-audio__active,
h3.me-audio__active,
h4.me-audio__active,
.gradient-text.me-audio__active {
  box-shadow: none;
  border-left: 3px solid #FFAB3D;
  padding-left: 8px;
  outline: 1px solid rgba(255, 171, 61, 0.3);
  outline-offset: 4px;
  border-radius: 2px;
}

/* Landing page elements — outline only, no border-left shift.
   border-left + padding-left breaks centered/flex layouts. */
.section-heading.me-audio__active,
.hero .subtitle.me-audio__active,
.hero p.me-audio__active,
.pillar-card .me-audio__active,
.pillar-card li.me-audio__active,
.pillar-card h3.me-audio__active,
.feature-block .me-audio__active,
.feature-block h4.me-audio__active,
.feature-block p.me-audio__active,
.content-section p.me-audio__active,
.content-section li.me-audio__active,
.metrics-banner .me-audio__active {
  box-shadow: none;
  border-left: none;
  padding-left: 0;
  outline: 1px solid rgba(255, 171, 61, 0.3);
  outline-offset: 4px;
  border-radius: 2px;
}

/* ── Adjust chat height when player visible ── */
.me-audio--visible ~ .dialog-off-canvas-main-canvas .me-chat {
  height: calc(100vh - 260px);
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .me-audio__inner {
    padding: 8px 12px;
    gap: 4px;
  }

  .me-audio__speaker {
    font-size: 11px;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .me-audio__time {
    display: none;
  }

  .me-audio__progress-text {
    font-size: 10px;
  }
}
