/**
 * Pym Audio Player - Complete Styles
 * استایل کامل پلیر صوتی (مدل 1 و 2)
 * Version: 1.9.0
 */

/* ========== متغیرهای CSS ========== */
:root {
  --pym-primary: #453f5e !important;
  --pym-primary-light: #5a5470 !important;
  --pym-accent: #6c63ff !important;
  --pym-bg: #ffffff !important;
  --pym-bg-secondary: #f8f9fa !important;
  --pym-text: #2c3e50 !important;
  --pym-text-light: #7f8c8d !important;
  --pym-border: #e9ecef !important;
  --pym-shadow: rgba(0, 0, 0, 0.08) !important;
  --pym-shadow-hover: rgba(0, 0, 0, 0.12) !important;
  --pym-radius: 16px !important;
  --pym-radius-sm: 8px !important;
  --pym-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* ========== Reset و Base ========== */
.pym-player *:not(input):not(button) {
  box-sizing: border-box !important;
}

.pym-player {
  width: 100% !important;
  max-width: 100% !important;
  font-family: inherit !important;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
  direction: ltr !important;
}

/* پشتیبانی RTL */
[dir="rtl"] .pym-player,
.rtl .pym-player,
body.rtl .pym-player {
  direction: rtl !important;
}

/* ========== مدل 1: پلیر مستطیلی (Horizontal) ========== */
.pym-player.pym-style-horizontal {
  position: relative !important;
  background: var(--pym-primary) !important;
  border-radius: 12px !important;
  padding: 12px 16px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2) !important;
  display: grid !important;
  grid-template-columns: auto 1fr auto !important;
  align-items: center !important;
  gap: 16px !important;
  transition: var(--pym-transition) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  overflow: visible !important;
  isolation: isolate !important;
}

/* Background blur از عکس کاور */
.pym-player.pym-style-horizontal::before {
  content: "" !important;
  position: absolute !important;
  top: -20px !important;
  left: -20px !important;
  right: -20px !important;
  bottom: -20px !important;
  background-image: var(--cover-image) !important;
  background-size: cover !important;
  background-position: center !important;
  filter: blur(40px) brightness(0.6) !important;
  -webkit-filter: blur(40px) brightness(0.6) !important;
  z-index: -1 !important;
  border-radius: 12px !important;
  clip-path: inset(20px round 12px) !important;
}

/* محتوای پلیر روی background */
.pym-player.pym-style-horizontal > * {
  position: relative !important;
  z-index: 1 !important;
}

/* بخش راست: کاور و اطلاعات */
.pym-style-horizontal .pym-info-section {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
}

.pym-style-horizontal .pym-cover-image {
  width: 56px !important;
  height: 56px !important;
  border-radius: 6px !important;
  object-fit: cover !important;
  flex-shrink: 0 !important;
}

.pym-style-horizontal .pym-player-meta {
  min-width: 0 !important;
}

.pym-style-horizontal .pym-player-title {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #ffffff !important;
  margin: 0 0 2px 0 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.pym-style-horizontal .pym-info-section .pym-player-description {
  font-family: inherit !important;
  font-size: 11px !important;
  color: rgba(255, 255, 255, 0.7) !important;
  font-weight: inherit !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* بخش وسط: کنترل‌ها و پروگرس */
.pym-style-horizontal .pym-controls-section {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 8px !important;
}

/* دکمه‌های کنترل پخش */
.pym-style-horizontal .pym-playback-controls {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  order: 1 !important;
}

/* دکمه‌های جلو/عقب 15 ثانیه */
.pym-style-horizontal .pym-seek-btn {
  width: 35px !important;
  height: 35px !important;
  border-radius: 50% !important;
  background: rgba(81, 86, 73, 0.19) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  border: 2px solid rgba(255, 255, 255, 0.3) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.3s ease !important;
  color: #ffffff !important;
  font-size: 14px !important;
  position: relative !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
}

.pym-style-horizontal .pym-seek-btn:hover {
  background: rgba(81, 86, 73, 0.35) !important;
  transform: scale(1.05) !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
  box-shadow: 0 12px 48px rgba(81, 86, 73, 0.4) !important;
}

.pym-style-horizontal .pym-seek-text {
  display: none !important;
}

.pym-style-horizontal .pym-progress-container {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 8px !important;
  width: 100% !important;
  order: 2 !important;
}

/* نمایش زمان‌ها زیر پروگرس بار */
.pym-style-horizontal .pym-time-display {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  width: 100% !important;
}

.pym-style-horizontal .pym-time {
  font-size: 11px !important;
  color: rgba(255, 255, 255, 0.8) !important;
}

.fas.fa-play {
  margin-left: 2px !important;
}

.pym-style-horizontal .pym-play-btn {
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  background: rgba(81, 86, 73, 0.19) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  border: 2px solid rgba(255, 255, 255, 0.3) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.3s ease !important;
  color: #ffffff !important;
  font-size: 14px !important;
  flex-shrink: 0 !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
}

.pym-style-horizontal .pym-play-btn:hover {
  background: rgba(81, 86, 73, 0.35) !important;
  transform: scale(1.05) !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
  box-shadow: 0 12px 48px rgba(81, 86, 73, 0.4) !important;
}

.pym-style-horizontal .pym-progress-bar {
  width: 100% !important;
  height: 4px !important;
  background: rgba(255, 255, 255, 0.2) !important;
  border-radius: 2px !important;
  cursor: pointer !important;
  position: relative !important;
  overflow: hidden !important;
}

.pym-style-horizontal .pym-progress-filled {
  height: 100% !important;
  background: #ffffff !important;
  border-radius: 2px !important;
  transition: width 0.1s linear !important;
  position: relative !important;
}

.pym-style-horizontal .pym-progress-filled::after {
  content: "" !important;
  position: absolute !important;
  right: 0 !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 8px !important;
  height: 8px !important;
  background: #ffffff !important;
  border-radius: 50% !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) !important;
}

.pym-style-horizontal .pym-time-display {
  font-size: 11px !important;
  color: rgba(255, 255, 255, 0.9) !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

/* بخش چپ: کنترل‌های ثانویه */
.pym-style-horizontal .pym-secondary-controls {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.pym-style-horizontal .pym-control-btn {
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  background: rgba(81, 86, 73, 0.19) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  border: 2px solid rgba(255, 255, 255, 0.3) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.3s ease !important;
  color: #ffffff !important;
  font-size: 13px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
}

.pym-style-horizontal .pym-control-btn:hover {
  background: rgba(81, 86, 73, 0.35) !important;
  transform: scale(1.05) !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
  box-shadow: 0 12px 48px rgba(81, 86, 73, 0.4) !important;
}

/* Volume Control with Tooltip */
.pym-style-horizontal .pym-volume-control {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
}

.pym-style-horizontal .pym-volume-slider-wrapper {
  position: absolute !important;
  bottom: 100% !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transition: all 0.2s ease !important;
  z-index: 1000 !important;
  pointer-events: none !important;
  padding-bottom: 12px !important;
}

.pym-style-horizontal .pym-volume-slider-wrapper.pym-active,
.pym-style-horizontal .pym-volume-control:hover .pym-volume-slider-wrapper,
.pym-style-horizontal .pym-volume-slider-wrapper:hover {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.pym-style-horizontal .pym-volume-slider-wrapper::before {
  content: "" !important;
  position: absolute !important;
  top: 0 !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: 130px !important;
  height: 30px !important;
  background: rgba(0, 0, 0, 0.2) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border-radius: 10px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
  z-index: 0 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.pym-style-horizontal .pym-volume-slider {
  width: 100px !important;
  height: 4px !important;
  top: 1px !important;
  border-radius: 2px !important;
  background: transparent !important;
  outline: none !important;
  cursor: pointer !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  padding: 14px 15px !important;
  position: relative !important;
  display: block !important;
  z-index: 1 !important;
}

.pym-style-horizontal .pym-volume-slider::-webkit-slider-runnable-track {
  width: 100% !important;
  height: 4px !important;
  border-radius: 2px !important;
  background: rgba(255, 255, 255, 0.3) !important;
}

.pym-style-horizontal .pym-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none !important;
  appearance: none !important;
  width: 12px !important;
  height: 12px !important;
  border-radius: 50% !important;
  background: #ffffff !important;
  cursor: pointer !important;
  margin-top: -4px !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2) !important;
}

.pym-style-horizontal .pym-volume-slider::-moz-range-track {
  width: 100% !important;
  height: 4px !important;
  border-radius: 2px !important;
  background: rgba(255, 255, 255, 0.3) !important;
}

.pym-style-horizontal .pym-volume-slider::-moz-range-thumb {
  width: 12px !important;
  height: 12px !important;
  border-radius: 50% !important;
  background: #ffffff !important;
  cursor: pointer !important;
  border: none !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2) !important;
}

.pym-style-horizontal .pym-volume-slider::-moz-range-progress {
  height: 4px !important;
  border-radius: 2px !important;
  background: #ffffff !important;
}

/* Speed Menu with Tooltip */
.pym-style-horizontal .pym-speed-control {
  position: relative !important;
}

.pym-style-horizontal .pym-speed-bridge {
  position: absolute !important;
  bottom: calc(100% - 5px) !important;
  right: 20% !important;
  transform: translateX(50%) !important;
  width: 120px !important;
  height: 56px !important;
  z-index: 998 !important;
  pointer-events: none !important;
  opacity: 0 !important;
}

.pym-style-horizontal .pym-speed-menu-wrapper {
  position: absolute !important;
  bottom: 100% !important;
  right: 20% !important;
  transform: translateX(50%) !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transition: all 0.2s ease !important;
  z-index: 999 !important;
  pointer-events: none !important;
  padding-bottom: 12px !important;
}

.pym-style-horizontal .pym-speed-menu-wrapper.pym-active,
.pym-style-horizontal .pym-speed-btn:hover ~ .pym-speed-menu-wrapper,
.pym-style-horizontal .pym-speed-bridge:hover ~ .pym-speed-menu-wrapper,
.pym-style-horizontal .pym-speed-menu-wrapper:hover {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.pym-style-horizontal .pym-speed-btn:hover ~ .pym-speed-bridge,
.pym-style-horizontal .pym-speed-bridge:hover,
.pym-style-horizontal .pym-speed-menu-wrapper:hover ~ .pym-speed-bridge {
  pointer-events: auto !important;
  opacity: 1 !important;
}

/* جلوگیری از تداخل منوی سرعت با اسلایدر صدا */
.pym-style-horizontal
  .pym-volume-control:hover
  ~ .pym-speed-control
  .pym-speed-menu-wrapper,
.pym-style-horizontal
  .pym-volume-control:hover
  ~ .pym-speed-control
  .pym-speed-bridge,
.pym-style-horizontal
  .pym-secondary-controls:has(.pym-volume-slider-wrapper:hover)
  .pym-speed-menu-wrapper,
.pym-style-horizontal
  .pym-secondary-controls:has(.pym-volume-slider-wrapper:hover)
  .pym-speed-bridge {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.pym-style-horizontal .pym-speed-menu {
  position: relative !important;
  overflow: hidden !important;
  background: rgba(0, 0, 0, 0.3) !important;
  border-radius: 10px !important;
  padding: 10px 14px !important;
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
  white-space: nowrap !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.pym-style-horizontal .pym-speed-menu::before {
  content: "" !important;
  position: absolute !important;
  top: -50px !important;
  left: -50px !important;
  right: -50px !important;
  bottom: -50px !important;
  background-image: var(--cover-image) !important;
  background-size: cover !important;
  background-position: center !important;
  filter: blur(30px) brightness(0.6) saturate(1.2) !important;
  -webkit-filter: blur(30px) brightness(0.6) saturate(1.2) !important;
  z-index: -1 !important;
}

.pym-style-horizontal .pym-speed-option {
  padding: 6px 10px !important;
  color: #ffffff !important;
  font-size: 13px !important;
  cursor: pointer !important;
  border-radius: 6px !important;
  transition: all 0.2s ease !important;
  background: transparent !important;
  border: none !important;
  display: inline-flex !important;
  align-items: center !important;
  padding-bottom: 2px !important;
}

.pym-style-horizontal .pym-speed-option:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  transform: translateY(-1px) !important;
}

.pym-style-horizontal .pym-speed-option.active {
  color: #21241b !important;
  background: rgba(234, 236, 231, 0.19) !important;
  border: 1px solid #ffffff45 !important;
}

/* ========== مدل 2: پلیر کارتی (Card/Vertical) ========== */
.pym-player.pym-style-card {
  position: relative !important;
  background: #515649 !important;
  border-radius: 16px !important;
  padding: 24px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
  max-width: 320px !important;
  margin: 20px auto !important;
  transition: var(--pym-transition) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  overflow: visible !important;
  isolation: isolate !important;
}

/* Background blur از عکس کاور */
.pym-player.pym-style-card::before {
  content: "" !important;
  position: absolute !important;
  top: -20px !important;
  left: -20px !important;
  right: -20px !important;
  bottom: -20px !important;
  background-image: var(--cover-image) !important;
  background-size: cover !important;
  background-position: center !important;
  filter: blur(40px) brightness(0.6) !important;
  -webkit-filter: blur(40px) brightness(0.6) !important;
  z-index: -1 !important;
  border-radius: 16px !important;
  clip-path: inset(20px round 16px) !important;
}

/* محتوای پلیر روی background */
.pym-player.pym-style-card > * {
  position: relative !important;
  z-index: 1 !important;
}

.pym-player.pym-style-card:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
  transform: translateY(-4px) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

.pym-style-card .pym-cover-image {
  width: 100% !important;
  aspect-ratio: 1 !important;
  border-radius: var(--pym-radius-sm) !important;
  object-fit: cover !important;
  margin-bottom: 20px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2) !important;
}

.pym-style-card .pym-player-meta {
  text-align: center !important;
  margin-bottom: 24px !important;
  color: #fff !important;
}

.pym-style-card .pym-player-title {
  font-size: 18px !important;
  font-weight: 600 !important;
  color: #ffffff !important;
  margin-bottom: 6px !important;
}

.pym-style-card .pym-player-meta .pym-player-description {
  font-family: inherit !important;
  font-size: 14px !important;
  color: rgba(255, 255, 255, 0.7) !important;
  font-weight: inherit !important;
  line-height: 1.5 !important;
}

.pym-style-card .pym-progress-section {
  margin-bottom: 20px !important;
}

.pym-style-card .pym-progress-bar {
  width: 100% !important;
  height: 6px !important;
  background: rgba(255, 255, 255, 0.2) !important;
  border-radius: 3px !important;
  cursor: pointer !important;
  position: relative !important;
  margin-bottom: 12px !important;
}

.pym-style-card .pym-progress-filled {
  height: 100% !important;
  background: #ffffff !important;
  border-radius: 3px !important;
  transition: width 0.1s linear !important;
}

.pym-style-card .pym-time-display {
  display: flex !important;
  justify-content: space-between !important;
  font-size: 12px !important;
  color: rgba(255, 255, 255, 0.8) !important;
}

.pym-style-card .pym-controls-row {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 16px !important;
  margin-bottom: 20px !important;
}

.pym-style-card .pym-play-btn {
  width: 56px !important;
  height: 56px !important;
  border-radius: 50% !important;
  background: rgba(81, 86, 73, 0.19) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  border: 3px solid rgba(255, 255, 255, 0.3) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.3s ease !important;
  color: #ffffff !important;
  font-size: 20px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
}

.pym-style-card .pym-play-btn:hover {
  background: rgba(81, 86, 73, 0.35) !important;
  transform: scale(1.1) !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
  box-shadow: 0 12px 48px rgba(81, 86, 73, 0.4) !important;
}

.pym-style-card .pym-control-btn {
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  background: rgba(81, 86, 73, 0.19) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  border: 2px solid rgba(255, 255, 255, 0.3) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.3s ease !important;
  color: #ffffff !important;
  font-size: 16px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
  position: relative !important;
}

.pym-style-card .pym-control-btn:hover {
  background: rgba(81, 86, 73, 0.35) !important;
  transform: scale(1.05) !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
  box-shadow: 0 12px 48px rgba(81, 86, 73, 0.4) !important;
}

/* دکمه‌های seek در مدل 2 */
.pym-style-card .pym-seek-text {
  display: none !important;
}

.pym-style-card .pym-secondary-controls {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 12px !important;
}

/* Volume Control for Card - با تولتیپ مثل مدل 1 */
.pym-style-card .pym-volume-control {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
}

.pym-style-card .pym-volume-slider-wrapper {
  position: absolute !important;
  bottom: 100% !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transition: all 0.2s ease !important;
  z-index: 1000 !important;
  pointer-events: none !important;
  padding-bottom: 12px !important;
}

.pym-style-card .pym-volume-slider-wrapper.pym-active,
.pym-style-card .pym-volume-control:hover .pym-volume-slider-wrapper,
.pym-style-card .pym-volume-slider-wrapper:hover {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.pym-style-card .pym-volume-slider-wrapper::before {
  content: "" !important;
  position: absolute !important;
  top: 0 !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: 130px !important;
  height: 30px !important;
  background: rgba(0, 0, 0, 0.2) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border-radius: 10px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
  z-index: 0 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.pym-style-card .pym-volume-slider {
  width: 100px !important;
  height: 4px !important;
  top: 1px !important;
  border-radius: 2px !important;
  background: transparent !important;
  outline: none !important;
  cursor: pointer !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  padding: 14px 15px !important;
  position: relative !important;
  display: block !important;
  z-index: 1 !important;
}

.pym-style-card .pym-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none !important;
  appearance: none !important;
  width: 12px !important;
  height: 12px !important;
  border-radius: 50% !important;
  background: #ffffff !important;
  cursor: pointer !important;
  margin-top: -4px !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2) !important;
}

.pym-style-card .pym-volume-slider::-moz-range-thumb {
  width: 12px !important;
  height: 12px !important;
  border-radius: 50% !important;
  background: #ffffff !important;
  cursor: pointer !important;
  border: none !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2) !important;
}

.pym-style-card .pym-volume-slider::-webkit-slider-runnable-track {
  width: 100% !important;
  height: 4px !important;
  border-radius: 2px !important;
  background: rgba(255, 255, 255, 0.3) !important;
}

.pym-style-card .pym-volume-slider::-moz-range-track {
  width: 100% !important;
  height: 4px !important;
  border-radius: 2px !important;
  background: rgba(255, 255, 255, 0.3) !important;
}

.pym-style-card .pym-volume-slider::-moz-range-progress {
  height: 4px !important;
  border-radius: 2px !important;
  background: #ffffff !important;
}

/* Speed Control for Card */
.pym-style-card .pym-speed-control {
  position: relative !important;
}

.pym-style-card .pym-speed-bridge {
  position: absolute !important;
  bottom: calc(100% - 5px) !important;
  right: 20% !important;
  transform: translateX(50%) !important;
  width: 120px !important;
  height: 56px !important;
  z-index: 998 !important;
  pointer-events: none !important;
  opacity: 0 !important;
}

.pym-style-card .pym-speed-menu-wrapper {
  position: absolute !important;
  bottom: 100% !important;
  right: 20% !important;
  transform: translateX(50%) !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transition: all 0.2s ease !important;
  z-index: 999 !important;
  pointer-events: none !important;
  padding-bottom: 12px !important;
}

.pym-style-card .pym-speed-menu-wrapper.pym-active,
.pym-style-card .pym-speed-btn:hover ~ .pym-speed-menu-wrapper,
.pym-style-card .pym-speed-bridge:hover ~ .pym-speed-menu-wrapper,
.pym-style-card .pym-speed-menu-wrapper:hover {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.pym-style-card .pym-speed-btn:hover ~ .pym-speed-bridge,
.pym-style-card .pym-speed-bridge:hover,
.pym-style-card .pym-speed-menu-wrapper:hover ~ .pym-speed-bridge {
  pointer-events: auto !important;
  opacity: 1 !important;
}

/* جلوگیری از تداخل منوی سرعت با اسلایدر صدا */
.pym-style-card
  .pym-volume-control:hover
  ~ .pym-speed-control
  .pym-speed-menu-wrapper,
.pym-style-card
  .pym-volume-control:hover
  ~ .pym-speed-control
  .pym-speed-bridge,
.pym-style-card
  .pym-secondary-controls:has(.pym-volume-slider-wrapper:hover)
  .pym-speed-menu-wrapper,
.pym-style-card
  .pym-secondary-controls:has(.pym-volume-slider-wrapper:hover)
  .pym-speed-bridge {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.pym-style-card .pym-speed-menu {
  background: rgba(0, 0, 0, 0.2) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border-radius: 10px !important;
  padding: 10px 14px !important;
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
  white-space: nowrap !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.pym-style-card .pym-speed-option {
  padding: 6px 10px !important;
  color: #ffffff !important;
  font-size: 13px !important;
  cursor: pointer !important;
  border-radius: 6px !important;
  transition: all 0.2s ease !important;
  background: transparent !important;
  border: none !important;
  display: inline-flex !important;
  align-items: center !important;
  padding-bottom: 2px !important;
}

.pym-style-card .pym-speed-option:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  transform: translateY(-1px) !important;
}

.pym-style-card .pym-speed-option.active {
  color: #21241b !important;
  background: rgba(234, 236, 231, 0.19) !important;
  border: 1px solid #ffffff45 !important;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .pym-style-horizontal {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .pym-style-horizontal .pym-info-section {
    order: 1 !important;
  }

  .pym-style-horizontal .pym-controls-section {
    order: 2 !important;
  }

  .pym-style-horizontal .pym-secondary-controls {
    order: 3 !important;
    justify-content: center !important;
  }

  .pym-player.pym-style-card {
    max-width: 100% !important;
  }
}

/* ========== Accessibility ========== */
.pym-player button:focus-visible {
  outline: 2px solid var(--pym-accent) !important;
  outline-offset: 2px !important;
}

.pym-player input[type="range"]:focus-visible {
  outline: 2px solid var(--pym-accent) !important;
  outline-offset: 2px !important;
}

/* ========== Loading State ========== */
.pym-player.loading {
  opacity: 0.6 !important;
  pointer-events: none !important;
}

/* ========== Error State ========== */
.pym-error {
  color: #ff4444 !important;
  padding: 20px !important;
  text-align: center !important;
  background: rgba(255, 68, 68, 0.1) !important;
  border-radius: 8px !important;
}

/* ========== Responsive: Mobile ========== */
@media (max-width: 640px) {
  /* مدل 1: تغییر layout به vertical */
  .pym-player.pym-style-horizontal {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto auto !important;
    gap: 12px !important;
    padding: 16px !important;
  }

  /* اطلاعات در بالا */
  .pym-style-horizontal .pym-info-section {
    order: 1 !important;
  }

  /* پروگرس بار در وسط */
  .pym-style-horizontal .pym-controls-section {
    order: 2 !important;
    flex-direction: column !important;
    gap: 10px !important;
  }

  /* دکمه‌های کنترل در پایین */
  .pym-style-horizontal .pym-secondary-controls {
    order: 3 !important;
    justify-content: center !important;
  }

  /* زمان‌ها در موبایل هم نمایش داده می‌شوند */
  .pym-style-horizontal .pym-time-display {
    display: flex !important;
    justify-content: space-between !important;
  }

  .pym-style-horizontal .pym-time {
    font-size: 11px !important;
    color: rgba(255, 255, 255, 0.8) !important;
  }

  /* دکمه‌های seek کوچکتر در موبایل */
  .pym-style-horizontal .pym-seek-btn {
    width: 36px !important;
    height: 36px !important;
    font-size: 13px !important;
  }

  /* دکمه پلی بزرگتر */
  .pym-style-horizontal .pym-play-btn {
    width: 48px !important;
    height: 48px !important;
    font-size: 18px !important;
  }

  /* پروگرس container عرض کامل */
  .pym-style-horizontal .pym-progress-container {
    width: 100% !important;
  }

  /* کاور کوچکتر */
  .pym-style-horizontal .pym-cover-image {
    width: 48px !important;
    height: 48px !important;
  }

  /* منوی سرعت در موبایل - نمایش با کلیک */
  .pym-style-horizontal .pym-speed-menu-wrapper,
  .pym-style-card .pym-speed-menu-wrapper {
    bottom: 100% !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
  }

  /* منوی سرعت در موبایل - چیدمان عمودی */
  .pym-style-horizontal .pym-speed-menu,
  .pym-style-card .pym-speed-menu {
    padding: 8px !important;
    gap: 2px !important;
  }

  .pym-style-horizontal .pym-speed-option,
  .pym-style-card .pym-speed-option {
    padding: 6px 12px !important;
    width: 100% !important;
    justify-content: center !important;
  }

  button.pym-speed-option.active {
    padding: 4px 8px 2px 8px !important;
  }
}

/* ========== Touch-friendly styles for mobile ========== */
@media (hover: none) and (pointer: coarse) {
  /* دکمه‌های بزرگتر برای لمس راحت‌تر */
  .pym-player .pym-control-btn,
  .pym-player .pym-video-btn {
    min-width: 44px !important;
    min-height: 44px !important;
  }

  /* در موبایل hover غیرفعال - فقط با کلیک باز شود */
  .pym-style-horizontal .pym-volume-control:hover .pym-volume-slider-wrapper,
  .pym-style-horizontal .pym-speed-control:hover .pym-speed-menu-wrapper,
  .pym-style-card .pym-volume-control:hover .pym-volume-slider-wrapper,
  .pym-style-card .pym-speed-control:hover .pym-speed-menu-wrapper {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  /* فقط با کلاس pym-active نمایش داده شود */
  .pym-style-horizontal .pym-volume-slider-wrapper.pym-active,
  .pym-style-horizontal .pym-speed-menu-wrapper.pym-active,
  .pym-style-card .pym-volume-slider-wrapper.pym-active,
  .pym-style-card .pym-speed-menu-wrapper.pym-active {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }
}
