/* Aparat extension: only product pages containing videos. */
.woocommerce-product-gallery .mb-aparat-slide{position:relative;overflow:hidden}
.mb-aparat-slide .mb-aparat-stage{position:relative;width:100%;aspect-ratio:1/1;background-color:#f5f2f8;background-position:center;background-size:contain;background-repeat:no-repeat;display:flex;align-items:center;justify-content:center}
.mb-aparat-play{position:relative;z-index:2;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;background:rgba(28,17,40,.77);border:0;border-radius:14px;color:#fff;padding:17px 24px;cursor:pointer;max-width:85%;font:inherit;text-align:center}
.mb-aparat-play span:first-child{font-size:28px}
.mb-aparat-play:focus-visible,.mb-aparat-shortcut button:focus-visible,.mb-aparat-edge:focus-visible{outline:3px solid #ae75ff;outline-offset:2px}
.mb-aparat-frame{position:absolute;inset:0;z-index:3;background:#000}
.mb-aparat-frame[hidden]{display:none}
.mb-aparat-frame iframe{display:block;width:100%;height:100%;border:0}
.mb-aparat-playing .mb-aparat-play{display:none}
.mb-aparat-shortcut{position:relative;display:flex;justify-content:flex-end;margin:8px 0 6px;direction:rtl}
.mb-aparat-shortcut-main{border:1px solid #8f56c8;color:#6721a3;background:#f7f0ff;border-radius:9px;padding:8px 12px;cursor:pointer;font:inherit;font-weight:600}
.mb-aparat-video-menu{position:absolute;z-index:12;top:100%;right:0;min-width:200px;max-width:100%;background:#fff;box-shadow:0 6px 22px #0002;border-radius:9px;padding:5px}
.mb-aparat-video-menu[hidden]{display:none}
.mb-aparat-video-menu button{display:block;width:100%;border:0;background:transparent;padding:10px;text-align:right;cursor:pointer;font:inherit}
.mb-aparat-video-menu button:hover{background:#f5ecff}
.mb-aparat-edge{display:none;position:absolute;z-index:4;top:28%;height:44%;width:32px;border:0;background:rgba(20,10,30,.18);color:white;font-size:24px;cursor:pointer}
.mb-aparat-edge-prev{left:0;border-radius:0 8px 8px 0}.mb-aparat-edge-next{right:0;border-radius:8px 0 0 8px}
.mb-aparat-playing .mb-aparat-edge{display:block}
@media(max-width:767px){.mb-aparat-edge{width:38px}.mb-aparat-shortcut-main{min-height:42px}}
@media(prefers-reduced-motion:reduce){.mb-aparat-shortcut *, .mb-aparat-stage *{animation:none!important;transition:none!important}}

/* Beta 2: retain aspect-ratio for photos while centering vertical/horizontal video. */
.woocommerce-product-gallery:has(.mb-aparat-slide) .mb-aparat-slide,
.woocommerce-product-gallery:has(.mb-aparat-slide) .mb-aparat-stage {height:var(--mb-aparat-gallery-height,auto);}
.woocommerce-product-gallery .mb-aparat-stage{aspect-ratio:auto!important;min-height:0;overflow:hidden}
.woocommerce-product-gallery .mb-aparat-frame{display:flex;justify-content:center;align-items:center;overflow:hidden}
.woocommerce-product-gallery .mb-aparat-frame iframe{width:100%;height:100%;max-height:100%;object-fit:contain;margin:auto}
.woocommerce-product-gallery .mb-aparat-frame[hidden]{display:none}
.woocommerce-product-gallery:has(.mb-aparat-slide) .flex-viewport img{user-select:none;-webkit-user-drag:none}
.woocommerce-product-gallery:has(.mb-aparat-slide){position:relative}
.mb-aparat-gallery-arrows{position:absolute;inset-inline:0;top:0;pointer-events:none;z-index:8;height:var(--mb-aparat-gallery-height,auto)}
.mb-aparat-main-arrow{position:absolute;top:50%;transform:translateY(-50%);width:40px;height:52px;border:0;border-radius:8px;background:rgba(35,18,52,.42);color:white;cursor:pointer;font-size:29px;pointer-events:auto}
.mb-aparat-main-previous{right:0}.mb-aparat-main-next{left:0}
/* The third-party player remains interactive, while navigation stays accessible. */
.mb-aparat-edge-prev{right:0;left:auto;border-radius:8px 0 0 8px}
.mb-aparat-edge-next{left:0;right:auto;border-radius:0 8px 8px 0}
@media(max-width:767px){.mb-aparat-main-arrow{width:32px;height:44px;font-size:23px}}

/* Beta 3: the Aparat iframe is a centered 16:9 viewing surface, not a square top-aligned canvas. */
.woocommerce-product-gallery .mb-aparat-frame{inset:0!important;display:flex;align-items:center;justify-content:center;background:#090909!important}
.woocommerce-product-gallery .mb-aparat-frame iframe{position:relative!important;flex:none!important;width:100%!important;height:auto!important;aspect-ratio:16 / 9!important;max-height:100%!important;object-fit:contain!important;margin:auto!important}
.woocommerce-product-gallery .mb-aparat-frame[hidden]{display:none!important}
/* Fullscreen video is an overlay within PhotoSwipe, never a navigation out of it. */
#photoswipe-fullscreen-dialog .mb-pswp-video-overlay{position:absolute;inset:0;z-index:115;display:flex;align-items:center;justify-content:center;background:#080808;color:#fff}
#photoswipe-fullscreen-dialog .mb-pswp-video-overlay[hidden]{display:none!important}
#photoswipe-fullscreen-dialog .mb-pswp-video-overlay .mb-aparat-stage{width:100%;height:100%;min-height:0;aspect-ratio:auto;background-size:contain;background-repeat:no-repeat;background-position:center;display:flex;align-items:center;justify-content:center;position:relative}
#photoswipe-fullscreen-dialog .mb-pswp-video-overlay .mb-aparat-frame{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:#090909}
#photoswipe-fullscreen-dialog .mb-pswp-video-overlay .mb-aparat-frame[hidden]{display:none!important}
#photoswipe-fullscreen-dialog .mb-pswp-video-overlay .mb-aparat-frame iframe{display:block;width:100%;height:auto;max-height:100%;aspect-ratio:16 / 9;border:0}
#photoswipe-fullscreen-dialog .mb-pswp-video-overlay .mb-aparat-play{z-index:2}
#photoswipe-fullscreen-dialog .mb-pswp-video-overlay .mb-aparat-playing .mb-aparat-play{display:none}
#photoswipe-fullscreen-dialog .mb-pswp-video-overlay .mb-pswp-video-close{position:absolute;top:max(58px,env(safe-area-inset-top));right:16px;z-index:6;background:#251734de;color:#fff;border:1px solid #aaa;border-radius:8px;padding:9px 14px;cursor:pointer}
#photoswipe-fullscreen-dialog .mb-pswp-video-overlay .mb-aparat-stage{padding-bottom:110px;box-sizing:border-box}
#photoswipe-fullscreen-dialog .mb-aparat-stage.mb-aparat-playing > .mb-aparat-play{display:none}

/* Beta 4: fullscreen video shares the photo viewing area, never the thumbnail strip.
   The actual strip height is measured in JS to accommodate desktop, mobile and safe areas. */
#photoswipe-fullscreen-dialog .mb-pswp-video-overlay{top:44px;bottom:120px;inset-inline:0;overflow:hidden}
#photoswipe-fullscreen-dialog .mb-pswp-video-overlay .mb-aparat-stage{padding:0!important;width:100%;height:100%;max-height:100%;overflow:hidden;box-sizing:border-box}
#photoswipe-fullscreen-dialog .mb-pswp-video-overlay .mb-aparat-frame iframe{width:100%;height:auto;max-height:100%;max-width:100%;aspect-ratio:16/9;object-fit:contain}
#photoswipe-fullscreen-dialog .mb-pswp-video-overlay .mb-pswp-video-close{top:10px}

/* Beta 5: size the iframe itself to the image viewport, never crop controls. */
#photoswipe-fullscreen-dialog .mb-pswp-video-overlay .mb-aparat-frame {
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: visible !important;
}
#photoswipe-fullscreen-dialog .mb-pswp-video-overlay .mb-aparat-frame[hidden] { display:none!important; }
#photoswipe-fullscreen-dialog .mb-pswp-video-overlay .mb-aparat-frame iframe {
    display: block !important;
    position: relative !important;
    margin: auto !important;
    aspect-ratio: 16 / 9 !important;
    object-fit: contain !important;
    border: 0 !important;
}

/* Menu positioning fix: attach list to the video button, not the gallery-wide row. */
.mb-aparat-shortcut .mb-aparat-shortcut-anchor{position:relative;display:inline-flex;flex-direction:column;align-items:stretch;max-width:100%;min-width:0}
.mb-aparat-shortcut .mb-aparat-shortcut-anchor .mb-aparat-video-menu{position:absolute;top:calc(100% + 6px);right:0;left:auto;min-width:min(220px,calc(100vw - 32px));max-width:min(320px,calc(100vw - 32px));width:max-content;box-sizing:border-box;z-index:30;direction:rtl}
.mb-aparat-shortcut .mb-aparat-shortcut-anchor .mb-aparat-video-menu button{overflow-wrap:anywhere}
