/* Glass iOS Video Player - RTL */
:root {
  --glass-stroke: rgba(255,255,255,0.22);
  --glass-shadow: 0 12px 36px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.25);
  --radius: 22px; 
  --radius-lg: 26px;
  --fg: #fff; 
  --fg-dim: rgba(255,255,255,0.75);
  --track: rgba(255,255,255,0.25);
}

/* Player Container */
.mlm-glass-video-player {
  font-family: ui-rounded, "Vazirmatn", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  margin: 16px auto;
  max-width: 100%;
  width: 100%;
  direction: rtl;
  display: block;
}

/* محدودیت عرض در دسکتاپ برای خوانایی بهتر */
@media (min-width: 1400px) {
  .mlm-glass-video-player {
    max-width: 1320px;
  }
}

@media (min-width: 1200px) and (max-width: 1399px) {
  .mlm-glass-video-player {
    max-width: 1140px;
  }
}

.mlm-glass-video-player * {
  box-sizing: border-box;
}

/* Container without outer frame */
.mlm-glass-video-player .player-shell {
  width: min(980px, 100%);
  position: relative;
  overflow: hidden;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

/* In-video overlay chip (top-right) */
.mlm-glass-video-player .overlay-top {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  pointer-events: auto;
}

.mlm-glass-video-player .overlay-top .chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255,255,255,0.18), rgba(255,255,255,0.08));
  border: 1px solid var(--glass-stroke);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(14px);
}

.mlm-glass-video-player .overlay-top .chip-avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 34px;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.35);
  background: #ddd;
  display: block;
}

.mlm-glass-video-player .overlay-top .chip-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  max-width: min(60vw, 520px);
}

.mlm-glass-video-player .overlay-top .chip-product {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--fg);
}

.mlm-glass-video-player .overlay-top .chip-product .hint {
  color: var(--fg-dim);
}

.mlm-glass-video-player .overlay-top .chip-seller {
  font-size: 11px;
  color: var(--fg-dim);
}

.mlm-glass-video-player .overlay-top .chip-btn {
  margin-inline-start: 6px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  cursor: pointer;
  text-decoration: none;
  background: linear-gradient(145deg, rgba(255,255,255,0.18), rgba(255,255,255,0.06));
  border: 1px solid rgba(255,255,255,0.22);
  transition: transform 0.08s ease, opacity 0.3s ease;
  position: relative;
}

.mlm-glass-video-player .overlay-top .chip-btn:hover {
  background: linear-gradient(145deg, rgba(255,255,255,0.25), rgba(255,255,255,0.12));
}

.mlm-glass-video-player .overlay-top .chip-btn:active {
  transform: scale(0.97);
}

.mlm-glass-video-player .overlay-top .chip-btn svg {
  width: 18px;
  height: 18px;
  fill: #fff;
  transition: all 0.3s ease;
}

/* حالت downloading */
.mlm-glass-video-player .overlay-top .chip-btn[style*="opacity: 0.5"] {
  cursor: wait;
}

.mlm-glass-video-player .overlay-top .chip-btn[style*="opacity: 0.5"] svg {
  animation: downloadPulse 1s ease-in-out infinite;
}

@keyframes downloadPulse {
  0%, 100% {
    opacity: 0.5;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

/* Video area – no border/frame */
.mlm-glass-video-player .video-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: none;
  background: transparent;
  width: 100%;
}

/* نسبت تصویر container در دسکتاپ */
@media (min-width: 1200px) {
  .mlm-glass-video-player .video-wrap {
    aspect-ratio: 16 / 9;
    background: #000;
  }
}

.mlm-glass-video-player video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 70vh;
  background: #000;
  object-fit: contain;
}

/* در دسکتاپ: video کامل container را پر می‌کند بدون کشیدگی */
@media (min-width: 1200px) {
  .mlm-glass-video-player video {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: contain;
  }
}

/* Hide WP native controls */
.mlm-glass-video-player video::-webkit-media-controls {
  display: none !important;
}

.mlm-glass-video-player video::-webkit-media-controls-enclosure {
  display: none !important;
}

/* Center click/tap overlay */
.mlm-glass-video-player .center-tap {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: auto;
}

.mlm-glass-video-player .big-play {
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 4;
}

.mlm-glass-video-player .big-play.hidden {
  opacity: 0;
  visibility: hidden;
}

.mlm-glass-video-player .big-play .btn {
  pointer-events: auto;
  width: 76px;
  height: 76px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255,255,255,0.30), rgba(255,255,255,0.10));
  border: 1px solid var(--glass-stroke);
  box-shadow: var(--glass-shadow);
  display: grid;
  place-items: center;
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: transform 0.08s ease;
}

.mlm-glass-video-player .big-play .btn:active {
  transform: scale(0.97);
}

.mlm-glass-video-player .big-play svg {
  width: 28px;
  height: 28px;
  fill: #fff;
}

/* Controls */
.mlm-glass-video-player .controls {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 16px;
  background: rgba(0,0,0,0.38);
  border: 1px solid rgba(255,255,255,0.18);
  backdrop-filter: blur(14px);
  justify-content: space-between;
}

.mlm-glass-video-player .btn-ctl {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: linear-gradient(145deg, rgba(255,255,255,0.16), rgba(255,255,255,0.06));
  border: 1px solid rgba(255,255,255,0.22);
  transition: transform 0.08s ease, background 0.2s ease;
}

.mlm-glass-video-player .btn-ctl:active {
  transform: scale(0.97);
}

.mlm-glass-video-player .btn-ctl svg {
  width: 18px;
  height: 18px;
  fill: #fff;
  display: block;
}

/* LEFT group = Like, Mute, Fullscreen */
.mlm-glass-video-player .controls-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* RIGHT group = Time, Progress, Play */
.mlm-glass-video-player .controls-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  justify-content: flex-end;
}

.mlm-glass-video-player .progress {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
  width: 40%;
  max-width: 520px;
}

.mlm-glass-video-player .bar {
  position: relative;
  height: 8px;
  flex: 1;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
  cursor: pointer;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
}

/* Fill LEFT → RIGHT in orange */
.mlm-glass-video-player .bar-fill {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, #ff8c00, #ff6a00);
}

.mlm-glass-video-player .bar-handle {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(255,255,255,0.6);
  box-shadow: 0 4px 10px rgba(0,0,0,0.35);
  left: 0%;
}

.mlm-glass-video-player .time {
  font-size: 12px;
  color: var(--fg-dim);
  min-width: 72px;
  text-align: center;
}

.mlm-glass-video-player .like {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(255,255,255,0.16), rgba(255,255,255,0.06));
  border: 1px solid rgba(255,255,255,0.22);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s ease;
  user-select: none;
}

.mlm-glass-video-player .like:hover {
  background: linear-gradient(145deg, rgba(255,255,255,0.22), rgba(255,255,255,0.12));
}

.mlm-glass-video-player .like:active {
  transform: scale(0.95);
}

.mlm-glass-video-player .like svg {
  width: 18px;
  height: 18px;
  fill: #fff;
  transition: fill 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mlm-glass-video-player .like.active svg {
  fill: #ff6b81;
  transform: scale(1.1);
  filter: drop-shadow(0 0 4px rgba(255, 107, 129, 0.6));
}

.mlm-glass-video-player .like .count {
  font-size: 13px;
  color: #fff;
  min-width: 1.5em;
  text-align: center;
  font-weight: 600;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* انیمیشن لایک */
@keyframes likeHeart {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.3); }
  50% { transform: scale(0.9); }
  75% { transform: scale(1.1); }
}

.mlm-glass-video-player .like.active {
  animation: likeHeart 0.5s ease;
}

/* Disabled state for controls */
.mlm-glass-video-player .is-disabled,
.mlm-glass-video-player [aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Icon visibility */
.mlm-glass-video-player #iconPause {
  display: none;
}

.mlm-glass-video-player #iconMute {
  display: none;
}

/* Hide any WP MediaElement containers */
.mlm-glass-video-player + .mejs-container,
.mlm-glass-video-player ~ .mejs-container {
  display: none !important;
}

.mlm-glass-video-player .mejs-container {
  display: none !important;
}

/* Mobile Responsive */
@media (max-width: 560px) {
  .mlm-glass-video-player .controls {
    gap: 6px;
    padding: 6px 8px;
  }

  .mlm-glass-video-player .btn-ctl {
    width: 28px;
    height: 28px;
    border-radius: 10px;
  }

  .mlm-glass-video-player .btn-ctl svg {
    width: 14px;
    height: 14px;
  }

  .mlm-glass-video-player .like {
    padding: 4px 6px;
  }

  .mlm-glass-video-player .like svg {
    width: 14px;
    height: 14px;
  }

  .mlm-glass-video-player .like .count {
    font-size: 11px;
  }

  .mlm-glass-video-player .overlay-top .chip {
    padding: 5px 7px;
    gap: 6px;
  }

  .mlm-glass-video-player .overlay-top .chip-avatar {
    width: 26px;
    height: 26px;
    min-width: 26px;
    min-height: 26px;
    flex: 0 0 26px;
    flex-shrink: 0;
  }

  .mlm-glass-video-player .overlay-top .chip-btn {
    width: 26px;
    height: 26px;
  }

  .mlm-glass-video-player .overlay-top .chip-product {
    font-size: 11px;
  }

  .mlm-glass-video-player .overlay-top .chip-seller {
    font-size: 9px;
  }

  .mlm-glass-video-player .progress {
    width: 50%;
  }

  .mlm-glass-video-player .time {
    display: none;
  }

  .mlm-glass-video-player video {
    max-height: 62svh;
  }
}

/* Fullscreen Mode - All Browsers */
/* Modern browsers */
.video-wrap:fullscreen,
.video-wrap:-webkit-full-screen,
.video-wrap:-moz-full-screen,
.video-wrap:-ms-fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  background: #000 !important;
  position: relative !important;
}

.video-wrap:fullscreen video,
.video-wrap:-webkit-full-screen video,
.video-wrap:-moz-full-screen video,
.video-wrap:-ms-fullscreen video {
  max-height: 100vh !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}

/* Controls in fullscreen */
.video-wrap:fullscreen .controls,
.video-wrap:-webkit-full-screen .controls,
.video-wrap:-moz-full-screen .controls,
.video-wrap:-ms-fullscreen .controls {
  position: fixed !important;
  bottom: 20px !important;
  left: 20px !important;
  right: 20px !important;
  z-index: 999999 !important;
  display: flex !important;
}

/* Overlay in fullscreen */
.video-wrap:fullscreen .overlay-top,
.video-wrap:-webkit-full-screen .overlay-top,
.video-wrap:-moz-full-screen .overlay-top,
.video-wrap:-ms-fullscreen .overlay-top {
  position: fixed !important;
  top: 20px !important;
  right: 20px !important;
  z-index: 999999 !important;
  display: block !important;
}

/* Center tap in fullscreen */
.video-wrap:fullscreen .center-tap,
.video-wrap:-webkit-full-screen .center-tap,
.video-wrap:-moz-full-screen .center-tap,
.video-wrap:-ms-fullscreen .center-tap {
  z-index: 999998 !important;
}

/* Also handle when video itself goes fullscreen (iOS webkit) */
video:fullscreen,
video:-webkit-full-screen,
video:-moz-full-screen,
video:-ms-fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  object-fit: contain !important;
}

/* Backdrop */
.video-wrap::backdrop,
.video-wrap::-webkit-backdrop {
  background: #000;
}

video::backdrop,
video::-webkit-backdrop {
  background: #000;
}

