/* ══════════════════════════════════════════════════════════════
   Medu — مشغّل الفيديوهات التعريفية (بطاقة + بوب أب)
   v1.0 · 2026
   ══════════════════════════════════════════════════════════════ */

/* ───────────── بطاقة الفيديو (الغلاف القابل للضغط) ───────────── */
.medu-vgrid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 26px;
    margin: 0 0 55px;
}

.medu-vgrid.is-single {
    grid-template-columns: 1fr;
    max-width: 980px;
    margin-inline: auto;
}

.medu-vcard {
    --vc: #7b4397;
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    background: #1a1030;
    border-radius: 22px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 14px 38px rgba(40, 20, 70, .16);
    transition: transform .35s cubic-bezier(.22, 1, .36, 1), box-shadow .35s ease;
    -webkit-tap-highlight-color: transparent;
}

.medu-vcard::before {
    content: "";
    display: block;
    padding-bottom: 56.25%;
}

.medu-vcard:hover,
.medu-vcard:focus-visible {
    transform: translateY(-7px);
    box-shadow: 0 22px 52px rgba(40, 20, 70, .26);
    outline: none;
}

.medu-vcard__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .55s cubic-bezier(.22, 1, .36, 1);
}

.medu-vcard:hover .medu-vcard__img {
    transform: scale(1.045);
}

/* الطبقة العلوية (الفلتر) — 2026-08-14
   كانت تدرّج خفيف في الأسفل فقط، فكروت الفيديو كانت شبه كروت
   البرامج العادية تحتها ومفيش حاجة تقول إن دي فيديو.
   دلوقتي فيه تعتيم بنفسجي على الكارت كله + تقليل التشبّع،
   وبيروح عند المرور بالماوس — فالصورة تولّع وتبان إنها قابلة للضغط. */
.medu-vcard__veil {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
                rgba(45, 20, 78, .52) 0%,
                rgba(45, 20, 78, .34) 45%,
                rgba(26, 16, 48, .68) 100%);
    -webkit-backdrop-filter: saturate(.72) contrast(.96);
    backdrop-filter: saturate(.72) contrast(.96);
    transition: background .35s ease, -webkit-backdrop-filter .35s ease, backdrop-filter .35s ease;
}

.medu-vcard:hover .medu-vcard__veil,
.medu-vcard:focus-visible .medu-vcard__veil {
    background: linear-gradient(180deg,
                rgba(45, 20, 78, .10) 0%,
                rgba(45, 20, 78, .04) 45%,
                rgba(26, 16, 48, .48) 100%);
    -webkit-backdrop-filter: saturate(1) contrast(1);
    backdrop-filter: saturate(1) contrast(1);
}

/* زر التشغيل */
.medu-vcard__play {
    position: absolute;
    bottom: 26px;
    right: 26px;
    width: 66px;
    height: 66px;
    border-radius: 50%;
    background: var(--vc);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    box-shadow: 0 8px 26px rgba(0, 0, 0, .35);
    transition: transform .3s cubic-bezier(.34, 1.56, .64, 1), background .3s ease;
}

.medu-vcard__play::after {
    content: "";
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, .55);
    animation: meduPulse 2.4s ease-out infinite;
}

@keyframes meduPulse {
    0%   { transform: scale(.9);  opacity: .85; }
    70%  { transform: scale(1.3); opacity: 0; }
    100% { transform: scale(1.3); opacity: 0; }
}

.medu-vcard:hover .medu-vcard__play {
    transform: scale(1.12);
}

/* نص البطاقة */
.medu-vcard__meta {
    position: absolute;
    right: 0;
    left: 96px;
    bottom: 0;
    padding: 16px 22px 18px;
    text-align: right;
    color: #fff;
}

.medu-vcard__title {
    margin: 0;
    font-size: 1.12rem;
    font-weight: 800;
    line-height: 1.45;
    text-shadow: 0 2px 10px rgba(0, 0, 0, .45);
}

.medu-vcard__sub {
    margin: 4px 0 0;
    font-size: .84rem;
    font-weight: 500;
    opacity: .85;
}

.medu-vcard__badge {
    position: absolute;
    top: 16px;
    left: 16px;
    padding: 6px 14px;
    border-radius: 30px;
    background: rgba(255, 255, 255, .92);
    color: var(--vc);
    font-size: .76rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ───────────── البوب أب (Lightbox) ───────────── */
.medu-vlb {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3vh 3vw;
    background: rgba(18, 10, 34, .84);
    -webkit-backdrop-filter: blur(9px);
    backdrop-filter: blur(9px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s ease;
}

.medu-vlb.is-open {
    opacity: 1;
    visibility: visible;
}

.medu-vlb__box {
    position: relative;
    width: min(96vw, 1500px);
    max-height: 94vh;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
    transform: scale(.92) translateY(18px);
    transition: transform .38s cubic-bezier(.22, 1, .36, 1);
}

.medu-vlb.is-open .medu-vlb__box {
    transform: scale(1) translateY(0);
}

.medu-vlb__box video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    display: block;
}

/* زر الإغلاق */
.medu-vlb__close {
    position: absolute;
    top: -6px;
    left: -6px;
    transform: translate(0, 0);
    z-index: 4;
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    background: #fff;
    color: #3a2060;
    font-size: 1.35rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
    transition: transform .25s ease, background .25s ease, color .25s ease;
}

.medu-vlb__close:hover {
    background: #7b4397;
    color: #fff;
    transform: rotate(90deg);
}

/* عنوان أعلى البوب أب */
.medu-vlb__title {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    z-index: 3;
    padding: 16px 74px 34px 22px;
    background: linear-gradient(180deg, rgba(0, 0, 0, .62), rgba(0, 0, 0, 0));
    color: #fff;
    font-size: 1.05rem;
    font-weight: 800;
    text-align: right;
    pointer-events: none;
    transition: opacity .3s ease;
}

.medu-vlb.is-playing .medu-vlb__title {
    opacity: 0;
}

.medu-vlb__hint {
    position: absolute;
    bottom: -34px;
    right: 0;
    left: 0;
    text-align: center;
    color: rgba(255, 255, 255, .68);
    font-size: .82rem;
}

/* منع تمرير الصفحة أثناء الفتح */
body.medu-vlb-open {
    overflow: hidden;
}

/* إخفاء العناصر العائمة (شارة الطالب / أيقونات السوشيال / زر أعلى الصفحة)
   عشان ما تظهرش فوق الفيديو */
body.medu-vlb-open .mgs-badge,
body.medu-vlb-open .floating-social,
body.medu-vlb-open #scroll-top,
body.medu-vlb-open .scroll-top,
body.medu-vlb-open #medu-assistant-launcher,
body.medu-vlb-open .medu-assistant-launcher {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity .25s ease;
}

/* ───────────── الشاشات الصغيرة ───────────── */
@media (max-width: 991.98px) {
    .medu-vgrid {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-bottom: 40px;
    }

    .medu-vcard__play {
        width: 58px;
        height: 58px;
        font-size: 1.2rem;
        bottom: 18px;
        right: 18px;
    }
}

@media (max-width: 575.98px) {
    .medu-vlb {
        padding: 0;
    }

    .medu-vlb__box {
        width: 100vw;
        border-radius: 0;
    }

    .medu-vlb__close {
        top: 10px;
        left: 10px;
        width: 46px;
        height: 46px;
    }

    .medu-vlb__hint {
        display: none;
    }

    .medu-vcard__title {
        font-size: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .medu-vcard,
    .medu-vcard__img,
    .medu-vlb,
    .medu-vlb__box {
        transition: none;
    }

    .medu-vcard__play::after {
        animation: none;
    }
}
