/* css/custom-audio-player.css */

/* ── WRAPPER: MATCH CONTENT WIDTH ─────────────────────────────── */
.cap-audio-player {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 1em 0;
  box-sizing: border-box;
}

/* ── CONTROLS: FLEX LAYOUT ───────────────────────────────────── */
.cap-audio-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: #000;
  color: #fff;
  padding: 5px;
  border-radius: 0;
  box-sizing: border-box;
}

/* ── BUTTONS ─────────────────────────────────────────────────── */
.cap-play-pause-btn,
.cap-download-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 8px;
  font-size: 12px;
  color: #fff;
  margin: 0 5px;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: none;
}
.cap-play-pause-btn:focus,
.cap-play-pause-btn:active,
.cap-download-btn:focus,
.cap-download-btn:active {
  outline: none;
  background: none !important;
}
.cap-play-pause-btn:hover,
.cap-download-btn:hover {
  background-color: #4caf50;
  color: #fff;
}
.cap-download-btn {
  font-weight: bold;
}

/* ── TIMECODES ───────────────────────────────────────────────── */
.cap-current-time,
.cap-duration {
  min-width: 40px;
  font-size: 12px;
  color: #fff;
  margin: 0 5px;
  text-align: center;
}

/* ── PROGRESS BAR ─────────────────────────────────────────────── */
.cap-progress-container {
  flex: 1;
  height: 4px;
  background: #333;
  position: relative;
  margin: 0 5px;
  box-sizing: border-box;
}
.cap-progress-bar {
  width: 0; /* JS will update */
  height: 100%;
  background: #1e90ff;
  position: absolute;
  top: 0;
  left: 0;
}

/* ── HIDE NATIVE AUDIO UI ─────────────────────────────────────── */
.cap-audio-element {
  display: none;
}

/* ── MOBILE ADJUSTMENTS (≤600px) ─────────────────────────────── */
@media (max-width: 600px) {
  .cap-audio-player {
    width: 100%;
    margin: 1em 0;
  }
  .cap-audio-controls {
    flex-wrap: wrap;
  }
  .cap-play-pause-btn,
  .cap-download-btn {
    margin-top: 5px;
  }
}


/* ── RTL SUPPORT (html OR body) ───────────────────────────────── */
html[dir="rtl"] .cap-audio-controls,
body[dir="rtl"] .cap-audio-controls {
  direction: rtl;
  justify-content: space-between;
}

/* order within .cap-audio-controls */
html[dir="rtl"] .cap-play-pause-btn,
body[dir="rtl"] .cap-play-pause-btn {
  order: 1;
  margin-left: 10px;
}
html[dir="rtl"] .cap-current-time,
body[dir="rtl"] .cap-current-time {
  order: 2;
  margin-left: 10px;
}
html[dir="rtl"] .cap-progress-container,
body[dir="rtl"] .cap-progress-container {
  order: 3;
  flex-grow: 1;
  margin: 0 10px;
}
html[dir="rtl"] .cap-duration,
body[dir="rtl"] .cap-duration {
  order: 4;
  margin-right: 10px;
}
html[dir="rtl"] .cap-download-btn,
body[dir="rtl"] .cap-download-btn {
  order: 5;
}

/* keep the bar filling L→R internally */
html[dir="rtl"] .cap-progress-bar,
body[dir="rtl"] .cap-progress-bar {
  direction: ltr;
  left: auto;
  right: 0;
}


/* ── LTR SUPPORT (html OR body) ───────────────────────────────── */
html[dir="ltr"] .cap-download-btn,
body[dir="ltr"] .cap-download-btn {
  order: 1;
}
html[dir="ltr"] .cap-duration,
body[dir="ltr"] .cap-duration {
  order: 2;
}
html[dir="ltr"] .cap-progress-container,
body[dir="ltr"] .cap-progress-container {
  order: 3;
  flex-grow: 1;
}
html[dir="ltr"] .cap-current-time,
body[dir="ltr"] .cap-current-time {
  order: 4;
}
html[dir="ltr"] .cap-play-pause-btn,
body[dir="ltr"] .cap-play-pause-btn {
  order: 5;
}
