/* ===== Materi Player Audio/Video (custom, tema HAMIM) ===== */

/* ============================================================
   MEDIA PLAYER OVERLAY - Dashboard standalone player
   untuk Audio MP3 dan Video HLS (.m3u8) dari Maktabah
   ============================================================ */
#media-player-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 1500;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#media-player-overlay.visible {
  display: flex;
}

#media-player-container {
  background: #ffffff;
  border-radius: 20px;
  width: 100%;
  max-width: 780px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

/* --- Header --- */
#media-player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--hamim-border, #dddddd);
  flex-shrink: 0;
}

#media-player-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--hamim-dark, #414344);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  margin-right: 12px;
}

.media-action-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--hamim-bg, #f8f8f8);
  color: var(--hamim-dark, #414344);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.media-action-btn:hover {
  background: var(--hamim-border, #dddddd);
}

/* --- Body --- */
#media-player-body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px 16px;
  background: var(--hamim-bg, #f8f8f8);
}

/* Audio visual */
#media-audio-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}
.media-audio-icon {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e26100, #ff8f3d);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  box-shadow: 0 8px 28px rgba(226, 97, 0, 0.35);
  animation: media-pulse 2.4s ease-in-out infinite;
}
@keyframes media-pulse {
  0%, 100% { box-shadow: 0 8px 28px rgba(226, 97, 0, 0.35); }
  50% { box-shadow: 0 8px 40px rgba(226, 97, 0, 0.6); }
}
#media-audio-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--hamim-dark, #414344);
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Video wrap */
#media-video-wrap {
  width: 100%;
  max-width: 720px;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
#media-video-el {
  width: 100%;
  max-height: 50vh;
  display: block;
  background: #000;
}

/* --- Loading & Error state (di dalam container) --- */
#media-loading,
#media-error {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--hamim-gray, #999999);
  font-size: 14px;
  background: var(--hamim-bg, #f8f8f8);
  inset: 0;
  z-index: 2;
  border-radius: 20px;
}
#media-player-container {
  position: relative; /* for absolute loading/error */
}

/* --- Controls bar --- */
#media-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px 16px;
  background: #ffffff;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.media-ctrl-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border: none;
  border-radius: 50%;
  background: var(--hamim-bg, #f8f8f8);
  color: var(--hamim-dark, #414344);
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
  position: relative;
}
.media-ctrl-btn:hover {
  background: var(--hamim-border, #dddddd);
}
.media-ctrl-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Tombol play lebih besar dan warna hamim-orange */
.media-play-btn {
  width: 48px;
  height: 48px;
  min-width: 48px;
  background: var(--hamim-orange, #e26100);
  color: #fff;
  font-size: 22px;
}
.media-play-btn:hover {
  background: #c75400;
}

/* Label "10" di atas ikon skip */
.media-skip-label {
  position: absolute;
  bottom: 4px;
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
  color: var(--hamim-dark, #414344);
  pointer-events: none;
}
.media-ctrl-btn:hover .media-skip-label {
  color: var(--hamim-dark, #414344);
}

/* Waktu */
.media-time {
  font-size: 12px;
  color: var(--hamim-gray, #999999);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Progress range */
.media-progress {
  flex: 1;
  min-width: 60px;
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(
    to right,
    var(--hamim-orange, #e26100) var(--pct, 0%),
    #e0e0e0 var(--pct, 0%)
  );
  outline: none;
  cursor: pointer;
  --pct: 0%;
}
.media-progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--hamim-orange, #e26100);
  border: 2px solid #fff;
  box-shadow: 0 0 4px rgba(0,0,0,0.2);
  cursor: pointer;
}
.media-progress::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--hamim-orange, #e26100);
  border: 2px solid #fff;
  cursor: pointer;
}

/* Volume */
.media-volume-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.media-volume-wrap i {
  font-size: 16px;
  color: var(--hamim-gray, #999999);
}
.media-volume {
  width: 64px;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 3px;
  background: linear-gradient(
    to right,
    var(--hamim-orange, #e26100) var(--pct, 100%),
    #e0e0e0 var(--pct, 100%)
  );
  outline: none;
  cursor: pointer;
  --pct: 100%;
}
.media-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--hamim-orange, #e26100);
  border: 2px solid #fff;
  cursor: pointer;
}
.media-volume::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--hamim-orange, #e26100);
  border: 2px solid #fff;
  cursor: pointer;
}

/* Mobile responsive */
@media (max-width: 560px) {
  #media-player-container {
    max-height: 100vh;
    border-radius: 16px;
  }
  .media-volume-wrap {
    display: none;
  }
  #media-controls {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px 14px;
  }
  .media-progress {
    order: -1;
    width: 100%;
    flex-basis: 100%;
  }
  .media-time {
    font-size: 11px;
  }
  .media-audio-icon {
    width: 90px;
    height: 90px;
    font-size: 38px;
  }
}

#materi-media-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  height: 100%;
  padding: 20px;
  background: #f8f8f8;
}
#materi-media-visual {
  width: 100%;
  max-width: 760px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#materi-media-video {
  width: 100%;
  max-width: 760px;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}
#materi-media-video video {
  width: 100%;
  max-height: 55vh;
  display: block;
  background: #000;
}
#materi-media-audio {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.materi-media-audio-icon {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e26100, #ff8f3d);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  box-shadow: 0 6px 24px rgba(226, 97, 0, 0.35);
}
.materi-media-controls {
  width: 100%;
  max-width: 760px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 1px solid #dddddd;
  border-radius: 50px;
  padding: 10px 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}
.materi-media-btn {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: #e26100;
  color: #fff;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}
.materi-media-btn:hover {
  background: #c75400;
}
.materi-media-btn:disabled {
  background: #bbbbbb;
  cursor: not-allowed;
}
.materi-media-progress {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: #e0e0e0;
  outline: none;
  cursor: pointer;
}
.materi-media-progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e26100;
  border: 2px solid #fff;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.materi-media-progress::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e26100;
  border: 2px solid #fff;
  cursor: pointer;
}
.materi-media-time {
  font-size: 13px;
  color: #414344;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.materi-media-volume-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.materi-media-volume-wrap i {
  font-size: 18px;
  color: #414344;
}
.materi-media-volume {
  width: 70px;
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  border-radius: 3px;
  background: #e0e0e0;
  outline: none;
  cursor: pointer;
}
.materi-media-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #e26100;
  border: 2px solid #fff;
  cursor: pointer;
}
.materi-media-volume::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #e26100;
  border: 2px solid #fff;
  cursor: pointer;
}
#materi-media-fullscreen {
  background: #414344;
}
#materi-media-fullscreen:hover {
  background: #333536;
}
/* Mode media: sembunyikan area PDF, tampilkan player */
#materi-media-wrap[hidden] {
  display: none !important;
}
#materi-viewer-overlay.materi-media-mode #materi-canvas-wrap {
  display: none;
}
.materi-media-loading {
  color: #999999;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
@media (max-width: 700px) {
  .materi-media-controls {
    flex-wrap: wrap;
    border-radius: 16px;
    padding: 10px 12px;
  }
  .materi-media-time {
    margin-left: auto;
  }
  .materi-media-volume-wrap {
    display: none;
  }
}

