.player-container {
  direction: ltr;
  position: relative;
  width: 100%;
  max-width: 900px;
  aspect-ratio: 16 / 9;
  margin: 0 auto;
  background: #000;
  overflow: hidden;
  border-radius: 6px;
  transition: all 0.4s ease;
}

.player-container.theater {
  width: 95%;
  max-width: 95%;
  margin: 20px auto;
  background-color: #000;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.85);
}

.player-container video {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  z-index: 1;
}

.player-container #videoCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.player-container .controls {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.55);
  z-index: 10;
}

.player-container .controls-left,
.player-container .controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-container .controls button {
  position: relative;
  margin: 0 4px;
  padding: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

.player-container .controls button:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 6px;
  border-radius: 3px;
  background: transparent;
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
}

.player-container #playPause {
  width: 28px;
  display: inline-block;
  text-align: center;
}

.player-container #playPause:hover,
.player-container #theaterBtn:hover,
.player-container #ccBtn:hover,
.player-container #settingsBtn:hover,
.player-container #fullscreenBtn:hover,
.player-container #volumeBtn svg:hover {
  transform: scale(1.1);
}

.player-container .volume-container {
  display: flex;
  align-items: center;
  gap: 6px;
}

.player-container .volume-icon {
  color: #eee;
  font-size: 18px;
  cursor: pointer;
  transition: color 0.3s ease;
}

.player-container .volume-icon:hover,
.player-container #volumeBtn:hover {
  color: #fff;
}

.player-container #volumeBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  flex-shrink: 0;
  color: #eee;
  font-size: 18px;
  cursor: pointer;
  transition: color 0.3s ease;
}

.player-container #volumeBtn svg {
  width: 36px;
  height: 36px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.player-container #volumeBtn svg polygon {
  fill: #e8e5e5;
}

.player-container #volumeBtn svg path,
.player-container #volumeBtn svg line {
  stroke: #fcb248;
  stroke-width: 3;
  stroke-linecap: round;
}

.player-container .volume-slider {
  appearance: none;
  -webkit-appearance: none; /* پیشگیری از ظاهر پیش‌فرض وب‌کیت */
  width: 45px;
  height: 6px;
  margin-left: 8px;
  background: linear-gradient(
    to right,
    #fcb248 0%,
    #fcb248 var(--volume-fill, 100%),
    #222 var(--volume-fill, 100%),
    #222 100%
  );
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  opacity: 1;
  pointer-events: auto;
}

.player-container .volume-slider::-webkit-slider-runnable-track,
.player-container .volume-slider::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(
    to right,
    #fcb248 0%,
    #fcb248 var(--volume-fill, 50%),
    #222 var(--volume-fill, 50%),
    #222 100%
  );
}

.player-container .volume-slider::-moz-range-track {
  background: transparent;
}

.player-container .volume-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
  border: none;
  transform: translateY(0); 
}

.player-container .volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.player-container .volume-slider:active::-webkit-slider-thumb,
.player-container .volume-slider:active::-moz-range-thumb {
  background: #fcb248;
}

.player-container .progress-container {
  position: absolute;
  bottom: 44px;
  left: 0;
  right: 0;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  z-index: 20;
}

.player-container .progress-bar {
  width: 0%;
  height: 100%;
  background: #fcb248;
  z-index: 2;
}

.player-container .preview-thumb {
  position: absolute;
  bottom: 54px;
  width: 140px;
  height: 78px;
  display: none;
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 5px;
}

.player-container #theaterBtn {
  display: flex;
  align-items: center !important;
  justify-content: center !important;
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  line-height: 32px !important;
  font-size: 13px !important;
  color: #fff;
  flex-shrink: 0 !important;
}

.player-container .theater-btn {
  font-size: 17px;
}

.player-container #ccBtn {
  color: #fff;
  opacity: 0.6;
  transition: opacity 0.3s ease, color 0.3s ease;
}

.player-container #ccBtn.active {
  color: #fcb248;
  opacity: 1;
}

.player-container .quality-menu {
  position: relative;
  display: inline-block;
}

.player-container #settingsBtn {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.player-container #qualityMenu {
  position: absolute;
  bottom: 35px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  flex-direction: column;
  min-width: 80px;
  padding: 5px 0;
  text-align: center;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 6px;
}

.player-container .quality-option {
  padding: 5px 0;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

.player-container .quality-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.player-container .quality-option.active {
  background: #fcb248;
}

.player-container .gesture-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 10;
  padding: 14px 22px;
  transform: translate(-50%, -50%);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 28px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.player-container .gesture-overlay.show {
  opacity: 1;
}

.player-container .gesture-bar {
  position: absolute;
  top: 50%;
  width: 10px;
  height: 120px;
  transform: translateY(-50%);
  border-radius: 5px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 9999;
}

.player-container .gesture-bar.left {
  left: 20px;
}

.player-container .gesture-bar.right {
  right: 20px;
}

.player-container .gesture-bar .bar-fill {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 0%;
  background: #fcb248;
  transition: height 0.05s ease;
}

.player-container .gesture-bar.show {
  opacity: 1;
}

.player-container #gestureIndicator {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 90px;
  height: 90px;
  transform: translate(-50%, -50%);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.player-container #gestureIcon {
  margin-bottom: 8px;
  color: #fff;
  font-size: 40px;
}

.player-container .gesture-svg {
  width: 48px;
  height: 48px;
}

.player-container .gesture-svg polygon {
  fill: #555;
}

.player-container .gesture-svg path,
.player-container .gesture-svg line {
  stroke: #fcb248;
  stroke-width: 3;
  stroke-linecap: round;
}

.player-container.hide-controls .controls {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.player-container.hide-controls .progress-container {
  bottom: 0;
}

.player-container .subtitle-display {
  position: absolute;
  bottom: 70px;
  z-index: 3;
  width: 100%;
  text-align: center;
  pointer-events: none;
  transition: bottom 0.3s ease;
}

.player-container .subtitle-display span {
  display: inline-block;
  min-width: 0;
  min-height: 0;
  padding: 6px 14px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
  color: #fff;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.6;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
  transition: background 0.25s ease, opacity 0.25s ease;
}

.player-container.hide-controls .subtitle-display {
  bottom: 20px;
}

.player-container button:focus,
.player-container .control-icon:focus,
.player-container *:focus {
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
}

#playPause.pp-btn,
#playPause.pp-btn::before,
#playPause.pp-btn::after {
  all: unset;
}

#playPause.pp-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 24px !important;
  height: 24px !important;
  margin: 0 !important;
  padding: 0 !important;
  background: none !important;
  border: none !important;
}

#playPause.pp-btn.play::before {
  content: '';
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid #fff;
}

#playPause.pp-btn.pause {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

#playPause.pp-btn.pause::before,
#playPause.pp-btn.pause::after {
  content: '';
  width: 3px;
  height: 12px;
  background: #fff;
  border-radius: 1px;
}

#playPause.pp-btn.restart::before {
  content: '';
  display: block;
  width: 16px;
  height: 16px;
  background: #fff;
  mask: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="white" xmlns="http://www.w3.org/2000/svg"><path d="M12 5V1L7 6l5 5V7c3.309 0 6 2.691 6 6s-2.691 6-6 6-6-2.691-6-6H4c0 4.411 3.589 8 8 8s8-3.589 8-8-3.589-8-8-8z"/></svg>') center / contain no-repeat;
}

.dt-indicator {
  position: absolute;
  top: 40%;
  padding: 8px 14px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
  color: #fff;
  font-size: 24px;
  user-select: none;
  pointer-events: none;
  animation: dtFade 0.45s ease;
}

.dt-left {
  left: 20px;
}

.dt-right {
  right: 20px;
}

@keyframes dtFade {
  0% {
    opacity: 0;
    transform: scale(0.7);
  }
  20% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.1);
  }
}

#fullscreenBtn.active {
  color: #fcb248 !important;
}

#playerBox.theater {
  width: 100% !important;
  height: auto;
}

.col-lg-8.theater-mode {
  order: 1;
  width: 100% !important;
  max-width: 100%;
  flex: 0 0 100%;
}

.video-loader {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.video-loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.video-spinner {
  width: 56px;
  height: 56px;
  border: 4px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.25);
  animation: videoSpinnerRotate 0.8s linear infinite;
}

@keyframes videoSpinnerRotate {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 768px) {
  .player-container #theaterBtn {
    display: none !important;
  }
}

@media (max-width: 450px) {
  .player-container #timeDisplay {
    display: none !important;
  }
}