/**
 * Stylesheet Komponen Audio Materi Shorof
 * Miftah Kaidah Shorof - Pondok Pesantren Al-Ikhlas Mantingan
 * Bersih, Elegan, Pesantren Emerald & Gold, Bebas Border-Left, Aksesibel
 */

:root {
  --audio-emerald: #144233;
  --audio-emerald-dark: #0a261c;
  --audio-emerald-surface: #edf5f0;
  --audio-gold: #c88a22;
  --audio-gold-light: #fede94;
  --audio-gold-hover: #e09f2c;
  --audio-gold-soft: #fbf5e8;
  --audio-text-dark: #103326;
  --audio-text-muted: #5e786b;
  --audio-border: #e6dfd1;
}

/* ==========================================================
   AUDIO PLAYER PANEL INSIDE LIGHTBOX / MODAL
   ========================================================== */
.materi-audio-player {
  width: 100%;
  background: var(--audio-gold-soft);
  border: 1.5px solid rgba(200, 138, 34, 0.35);
  border-radius: 16px;
  padding: 0.75rem 0.95rem;
  margin-top: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(16, 51, 38, 0.06);
  transition: all 0.22s ease;
  box-sizing: border-box;
}

.materi-audio-player.is-active-playing {
  background: #ffffff;
  border-color: var(--audio-gold);
  box-shadow: 0 6px 20px rgba(200, 138, 34, 0.2);
}

.audio-player-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Tombol Utama Play / Pause Audio */
.btn-audio-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: var(--audio-emerald);
  color: #ffffff;
  border: 1.5px solid var(--audio-emerald);
  padding: 0.65rem 1.25rem;
  min-height: 44px;
  border-radius: 30px;
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 12px rgba(20, 66, 51, 0.25);
  user-select: none;
}

.btn-audio-toggle:hover {
  background: #1b5743;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(20, 66, 51, 0.35);
}

.btn-audio-toggle:active {
  transform: translateY(0);
}

.btn-audio-toggle.is-playing {
  background: var(--audio-gold);
  border-color: var(--audio-gold);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(200, 138, 34, 0.35);
}

.btn-audio-toggle.is-playing:hover {
  background: var(--audio-gold-hover);
  border-color: var(--audio-gold-hover);
}

.audio-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.audio-btn-label {
  white-space: nowrap;
}

/* Equalizer Soundwave Bars */
.soundwave-bars {
  display: none;
  align-items: flex-end;
  gap: 3px;
  height: 16px;
  padding: 0 2px;
}

.btn-audio-toggle.is-playing .soundwave-bars {
  display: inline-flex;
}

.soundwave-bars .bar {
  width: 3px;
  background-color: #ffffff;
  border-radius: 2px;
  animation: soundwaveAnim 1s ease-in-out infinite alternate;
}

.soundwave-bars .bar-1 { height: 6px; animation-delay: 0.05s; }
.soundwave-bars .bar-2 { height: 14px; animation-delay: 0.25s; }
.soundwave-bars .bar-3 { height: 10px; animation-delay: 0.15s; }
.soundwave-bars .bar-4 { height: 16px; animation-delay: 0.35s; }

@keyframes soundwaveAnim {
  0% { height: 4px; }
  100% { height: 16px; }
}

/* Secondary Actions (Stop & Speed) */
.audio-aux-controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.btn-audio-stop {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-height: 40px;
  background: #ffffff;
  border: 1.5px solid var(--audio-border);
  border-radius: 50%;
  color: var(--audio-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-audio-stop:hover {
  background: #fee2e2;
  border-color: #ef4444;
  color: #b91c1c;
  transform: scale(1.05);
}

.btn-audio-speed {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 0.75rem;
  background: #ffffff;
  border: 1.5px solid var(--audio-border);
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--audio-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-audio-speed:hover {
  border-color: var(--audio-gold);
  color: var(--audio-gold);
}

/* Card Content Display in Lightbox */
.audio-card-content {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(200, 138, 34, 0.25);
  border-radius: 10px;
  padding: 0.4rem 0.75rem;
  text-align: center;
}

.audio-chip-ar {
  font-family: var(--font-arabic, 'Amiri', serif);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--audio-emerald);
  direction: rtl;
  line-height: 1.2;
}

.audio-chip-dot {
  color: var(--audio-gold);
  font-size: 0.75rem;
}

.audio-chip-latin {
  font-size: 0.85rem;
  font-weight: 800;
  color: #1e293b;
}

.audio-chip-meaning {
  font-size: 0.82rem;
  font-weight: 700;
  color: #b45309;
}

/* Details & Feedback Row */
.audio-details-row {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 0.15rem;
  font-size: 0.78rem;
}

.audio-status-msg {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--audio-text-muted);
  text-align: center;
}

/* ==========================================================
   THUMBNAIL BADGE (ON IMAGE CARDS IN MATERI)
   ========================================================== */
.card-audio-pill {
  position: absolute;
  bottom: 0.4rem;
  right: 0.4rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(16, 51, 38, 0.9);
  backdrop-filter: blur(4px);
  color: var(--audio-gold-light);
  border: 1px solid rgba(254, 222, 148, 0.5);
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  transition: all 0.2s ease;
}

.visual-thumb-btn:hover .card-audio-pill {
  background: var(--audio-gold);
  color: #ffffff;
  border-color: #ffffff;
  transform: scale(1.05);
}

/* Responsive Tweaks */
/* Mini Audio Trigger for Topic Cards */
.btn-audio-mini-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--audio-emerald);
  color: #ffffff;
  border: 1px solid var(--audio-gold);
  border-radius: 20px;
  padding: 0.35rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 0.5rem;
  box-shadow: 0 2px 8px rgba(16, 51, 38, 0.2);
  user-select: none;
}

.btn-audio-mini-trigger:hover {
  background: var(--audio-gold);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-audio-mini-trigger.is-playing {
  background: var(--audio-gold);
  animation: pulseGold 1.5s infinite;
}

@keyframes pulseGold {
  0% { box-shadow: 0 0 0 0 rgba(200, 138, 34, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(200, 138, 34, 0); }
  100% { box-shadow: 0 0 0 0 rgba(200, 138, 34, 0); }
}

@media (max-width: 550px) {
  .materi-audio-player {
    padding: 0.75rem 0.85rem;
  }
  .audio-player-main-row {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-audio-toggle {
    width: 100%;
  }
  .audio-aux-controls {
    justify-content: flex-end;
  }
  .audio-details-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }
  .audio-status-msg {
    text-align: left;
  }
}


