/* ==========================================================
   CEP - Microsoft Teams Live Lecture
   Premium CEP Gradient Style
   ========================================================== */

.cep-live-lecture-source {
    width: 100%;
}


/* ==========================================================
   Main Card
   ========================================================== */

.cep-teams-live {
    --cep-navy: #02285b;
    --cep-blue: #003780;
    --cep-deep: #031534;
    --cep-gold: #827746;
    --cep-white: rgba(255, 255, 255, 0.92);
    --cep-soft: rgba(255, 255, 255, 0.72);
    --cep-glass: rgba(255, 255, 255, 0.09);
    --cep-glass-strong: rgba(255, 255, 255, 0.14);
    --cep-border: rgba(255, 255, 255, 0.12);

    position: relative;
    overflow: hidden;

    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    grid-template-areas:
        "header countdown"
        "schedule countdown"
        "notice button";

    gap: 14px 18px;
    align-items: stretch;

    width: 100%;
    box-sizing: border-box;

    padding: 22px;

    direction: rtl;
    text-align: right;

    color: #ffffff;

    background:
        linear-gradient(
            135deg,
            #031534 0%,
            #02285b 42%,
            #003780 100%
        );

    background-size: 180% 180%;

    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 22px;

    box-shadow:
        0 12px 38px rgba(2, 40, 91, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);

    font-family:
        "IBM Plex Sans Arabic",
        "Tajawal",
        Arial,
        sans-serif;

    animation:
        cepCardGradientShift 18s ease-in-out infinite;
}


/* subtle moving glow */

.cep-teams-live::before {
    content: "";

    position: absolute;
    top: -80px;
    left: -60px;

    width: 240px;
    height: 240px;

    background:
        radial-gradient(
            circle,
            rgba(130, 119, 70, 0.22) 0%,
            rgba(130, 119, 70, 0.10) 35%,
            transparent 70%
        );

    pointer-events: none;
    filter: blur(8px);

    animation:
        cepOrbFloat 16s ease-in-out infinite;
}


.cep-teams-live::after {
    content: "";

    position: absolute;
    right: -80px;
    bottom: -80px;

    width: 260px;
    height: 260px;

    background:
        radial-gradient(
            circle,
            rgba(255, 255, 255, 0.09) 0%,
            rgba(255, 255, 255, 0.03) 40%,
            transparent 75%
        );

    pointer-events: none;
    filter: blur(8px);

    animation:
        cepOrbFloat2 18s ease-in-out infinite;
}


/* ==========================================================
   Header
   ========================================================== */

.cep-teams-live__header {
    grid-area: header;

    position: relative;
    z-index: 2;

    display: flex;
    align-items: center;

    gap: 14px;
    min-width: 0;
}


.cep-teams-live__icon {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 56px;

    width: 56px;
    height: 56px;

    border-radius: 16px;

    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.22),
            rgba(255, 255, 255, 0.10)
        );

    border: 1px solid rgba(255, 255, 255, 0.16);

    box-shadow:
        0 8px 22px rgba(0, 0, 0, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.10);

    backdrop-filter: blur(6px);

    animation:
        cepIconFloat 4.5s ease-in-out infinite;
}


.cep-teams-live__t {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 29px;
    height: 32px;

    background: #ffffff;

    color: #5659b5;

    border-radius: 7px;

    font-family: Arial, sans-serif;
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
}


.cep-teams-live__camera {
    position: absolute;

    left: 5px;
    bottom: 8px;

    width: 10px;
    height: 11px;

    background: #ffffff;
    border-radius: 2px;
}


.cep-teams-live__camera::after {
    content: "";

    position: absolute;

    left: -4px;
    top: 2px;

    width: 0;
    height: 0;

    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
    border-right: 4px solid #ffffff;
}


.cep-teams-live__heading {
    flex: 1;
    min-width: 0;
}


.cep-teams-live__badge {
    display: inline-flex;
    align-items: center;

    margin: 0 0 4px;
    padding: 5px 10px;

    background: rgba(255, 255, 255, 0.14);

    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;

    color: rgba(255, 255, 255, 0.95);

    font-size: 10px;
    font-weight: 700;
    line-height: 1.3;

    backdrop-filter: blur(4px);
}


.cep-teams-live__badge--live {
    background: rgba(83, 193, 117, 0.18) !important;
    color: #ffffff !important;
    border-color: rgba(120, 230, 154, 0.25) !important;
}


.cep-teams-live__title {
    margin: 0 0 3px !important;
    padding: 0 !important;

    color: #ffffff !important;

    font-size: 22px !important;
    font-weight: 800 !important;
    line-height: 1.45 !important;

    text-align: right !important;
}


.cep-teams-live__description {
    margin: 0 !important;
    padding: 0 !important;

    color: rgba(255, 255, 255, 0.76) !important;

    font-size: 12.5px !important;
    font-weight: 500 !important;
    line-height: 1.7 !important;

    text-align: right !important;
}


.cep-teams-live__description strong {
    color: #ffffff !important;
    font-weight: 800 !important;
}


/* ==========================================================
   Glass Panels Shared
   ========================================================== */

.cep-teams-live__schedule,
.cep-teams-live__notice,
.cep-countdown,
.cep-teams-live__button {
    position: relative;
    z-index: 2;
}


/* ==========================================================
   Schedule
   ========================================================== */

.cep-teams-live__schedule {
    grid-area: schedule;

    display: flex;
    align-items: center;

    gap: 11px;
    min-width: 0;

    box-sizing: border-box;

    padding: 13px 14px;

    background: rgba(255, 255, 255, 0.08);

    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 14px;

    backdrop-filter: blur(8px);

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}


.cep-teams-live__schedule-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 34px;

    width: 34px;
    height: 34px;

    background: rgba(255, 255, 255, 0.12);

    color: #ffffff;

    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;

    font-family: Arial, sans-serif;
    font-size: 17px;

    animation:
        cepSoftPulse 5s ease-in-out infinite;
}


.cep-teams-live__schedule-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;

    min-width: 0;

    gap: 2px 8px;
    line-height: 1.6;
}


.cep-teams-live__schedule-label {
    width: 100%;

    color: rgba(255, 255, 255, 0.60);

    font-size: 9px;
    font-weight: 600;
}


.cep-teams-live__schedule-content strong {
    color: #ffffff;

    font-size: 13px;
    font-weight: 800;
}


.cep-teams-live__schedule-content > span:last-child {
    color: rgba(255, 255, 255, 0.78);

    font-size: 12px;
    font-weight: 500;
}


/* ==========================================================
   Countdown Side Card
   ========================================================== */

.cep-countdown {
    grid-area: countdown;

    display: flex;
    flex-direction: column;
    justify-content: center;

    min-width: 0;

    box-sizing: border-box;

    padding: 16px;

    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.09),
            rgba(255, 255, 255, 0.05)
        );

    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 16px;

    backdrop-filter: blur(8px);

    box-shadow:
        0 10px 24px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}


.cep-countdown__top {
    display: flex;
    align-items: center;
    justify-content: flex-start;

    gap: 8px;
    margin-bottom: 12px;
}


.cep-countdown__heading {
    color: rgba(255, 255, 255, 0.94);

    font-size: 10.5px;
    font-weight: 700;
    line-height: 1.4;
}


.cep-countdown__pulse {
    position: relative;

    display: inline-block;

    flex: 0 0 7px;

    width: 7px;
    height: 7px;

    background: #d8cb80;
    border-radius: 50%;

    box-shadow:
        0 0 0 4px rgba(216, 203, 128, 0.12);
}


.cep-countdown__pulse::after {
    content: "";

    position: absolute;

    top: 50%;
    left: 50%;

    width: 7px;
    height: 7px;

    background: rgba(216, 203, 128, 0.36);

    border-radius: 50%;

    transform: translate(-50%, -50%);

    animation:
        cepCountdownPulse 2s infinite;
}


@keyframes cepCountdownPulse {
    0% {
        width: 7px;
        height: 7px;
        opacity: 0.85;
    }

    100% {
        width: 22px;
        height: 22px;
        opacity: 0;
    }
}


.cep-countdown__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    width: 100%;
}


.cep-countdown__separator {
    display: none;
}


.cep-countdown__unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    min-width: 0;
    min-height: 60px;

    padding: 7px 3px;

    background: rgba(255, 255, 255, 0.10);

    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 11px;

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}


.cep-countdown__number {
    direction: ltr;

    color: #ffffff;

    font-family: Arial, sans-serif;

    font-size: 20px;
    font-weight: 800;

    line-height: 1.05;

    font-variant-numeric: tabular-nums;
}


.cep-countdown__label {
    margin-top: 4px;

    color: rgba(255, 255, 255, 0.60);

    font-size: 8px;
    font-weight: 500;
}


.cep-countdown--ready {
    background:
        linear-gradient(
            145deg,
            rgba(10, 111, 191, 0.35),
            rgba(6, 76, 130, 0.25)
        );
}


.cep-countdown--live {
    background:
        linear-gradient(
            145deg,
            rgba(18, 126, 75, 0.38),
            rgba(8, 116, 87, 0.24)
        );
}


/* ==========================================================
   Notice
   ========================================================== */

.cep-teams-live__notice {
    grid-area: notice;

    display: flex;
    align-items: center;

    gap: 10px;
    min-width: 0;

    box-sizing: border-box;

    padding: 11px 12px;

    background:
        linear-gradient(
            135deg,
            rgba(130, 119, 70, 0.18),
            rgba(130, 119, 70, 0.12)
        );

    border: 1px solid rgba(213, 198, 132, 0.16);
    border-radius: 13px;

    backdrop-filter: blur(6px);
}


.cep-teams-live__notice-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 26px;

    width: 26px;
    height: 26px;

    background: rgba(255, 255, 255, 0.16);

    color: #f6e8a3;

    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 50%;

    font-family: Arial, sans-serif;
    font-size: 13px;
    font-weight: 900;
}


.cep-teams-live__notice-content {
    flex: 1;
    min-width: 0;
}


.cep-teams-live__notice-title {
    display: inline;

    margin-left: 5px;

    color: #fff1be;

    font-size: 11px;
    font-weight: 800;
}


.cep-teams-live__notice p {
    display: inline;

    margin: 0 !important;
    padding: 0 !important;

    color: rgba(255, 255, 255, 0.80) !important;

    font-size: 11px !important;
    font-weight: 500 !important;
    line-height: 1.8 !important;

    text-align: right !important;
}


.cep-teams-live__notice p strong {
    color: #ffffff !important;
    font-weight: 800 !important;
}


/* ==========================================================
   Join Button
   ========================================================== */

.cep-teams-live__button {
    grid-area: button;

    position: relative;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    gap: 8px !important;

    width: 100% !important;
    min-height: 52px !important;

    box-sizing: border-box !important;

    padding: 11px 38px !important;

    border: 0 !important;
    border-radius: 14px !important;

    color: #ffffff !important;

    font-size: 12px !important;
    font-weight: 800 !important;

    line-height: 1.4 !important;
    text-align: center !important;
    text-decoration: none !important;

    overflow: hidden;

    transition:
        transform 0.22s ease,
        box-shadow 0.22s ease,
        background 0.22s ease !important;
}


.cep-teams-live__button--locked {
    cursor: not-allowed !important;

    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.16),
            rgba(255, 255, 255, 0.10)
        ) !important;

    border: 1px solid rgba(255, 255, 255, 0.10) !important;

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;

    color: #ffffff !important;
}


.cep-teams-live__button--available {
    cursor: pointer !important;

    background:
        linear-gradient(
            135deg,
            #ffffff,
            #eef4ff
        ) !important;

    color: #02285b !important;

    box-shadow:
        0 10px 20px rgba(0, 0, 0, 0.10) !important;
}


.cep-teams-live__button--available:hover {
    transform: translateY(-1px);

    box-shadow:
        0 12px 26px rgba(0, 0, 0, 0.14) !important;

    text-decoration: none !important;
}


.cep-teams-live__button--available .cep-teams-live__button-t {
    color: #02285b;
    background: rgba(2, 40, 91, 0.08);
    border-color: rgba(2, 40, 91, 0.08);
}


.cep-teams-live__button::before {
    content: "";

    position: absolute;
    top: 0;
    right: -120%;
    width: 70%;
    height: 100%;

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(255, 255, 255, 0.22),
            transparent
        );

    transform: skewX(-20deg);

    animation:
        cepButtonShine 5.5s linear infinite;
}


.cep-teams-live__button-t {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 24px;

    width: 24px;
    height: 24px;

    background: rgba(255, 255, 255, 0.12);

    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 6px;

    color: #ffffff;

    font-family: Arial, sans-serif;
    font-size: 13px;
    font-weight: 800;
}


.cep-teams-live__lock {
    position: absolute;
    left: 12px;

    font-size: 12px;
}


/* ==========================================================
   Footer hidden
   ========================================================== */

.cep-teams-live__footer {
    display: none !important;
}


/* ==========================================================
   Animations
   ========================================================== */

@keyframes cepCardGradientShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes cepOrbFloat {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(20px, 18px) scale(1.08); }
    100% { transform: translate(0, 0) scale(1); }
}

@keyframes cepOrbFloat2 {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(-18px, -14px) scale(1.06); }
    100% { transform: translate(0, 0) scale(1); }
}

@keyframes cepIconFloat {
    0%   { transform: translateY(0); }
    50%  { transform: translateY(-3px); }
    100% { transform: translateY(0); }
}

@keyframes cepSoftPulse {
    0%   { box-shadow: 0 0 0 0 rgba(255,255,255,0.00); }
    50%  { box-shadow: 0 0 0 6px rgba(255,255,255,0.02); }
    100% { box-shadow: 0 0 0 0 rgba(255,255,255,0.00); }
}

@keyframes cepButtonShine {
    0%   { right: -120%; }
    100% { right: 150%; }
}


/* ==========================================================
   Tablet
   ========================================================== */

@media (max-width: 950px) {

    .cep-teams-live {
        grid-template-columns: minmax(0, 1fr) 285px;
    }

}


/* ==========================================================
   Mobile / Narrow Tablet
   ========================================================== */

@media (max-width: 760px) {

    .cep-teams-live {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "schedule"
            "countdown"
            "notice"
            "button";

        gap: 10px;
        padding: 16px;
        border-radius: 16px;
    }

    .cep-teams-live__title {
        font-size: 19px !important;
    }

    .cep-countdown {
        padding: 14px;
    }

    .cep-countdown__grid {
        gap: 5px;
    }

    .cep-countdown__unit {
        min-height: 52px;
    }

    .cep-countdown__number {
        font-size: 18px;
    }

    .cep-teams-live__button {
        min-height: 48px !important;
    }

}


/* ==========================================================
   Small Mobile
   ========================================================== */

@media (max-width: 480px) {

    .cep-teams-live {
        padding: 14px 12px;
    }

    .cep-teams-live__header {
        gap: 10px;
        align-items: flex-start;
    }

    .cep-teams-live__icon {
        flex: 0 0 46px;
        width: 46px;
        height: 46px;
        border-radius: 13px;
    }

    .cep-teams-live__t {
        width: 25px;
        height: 28px;
        font-size: 17px;
    }

    .cep-teams-live__title {
        font-size: 17px !important;
    }

    .cep-teams-live__description {
        font-size: 11px !important;
    }

    .cep-teams-live__schedule {
        padding: 10px 11px;
    }

    .cep-teams-live__schedule-content {
        display: block;
    }

    .cep-teams-live__schedule-content strong,
    .cep-teams-live__schedule-content > span:last-child {
        display: block;
    }

    .cep-countdown__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px;
    }

    .cep-countdown__unit {
        min-height: 46px;
        padding: 5px 2px;
    }

    .cep-countdown__number {
        font-size: 16px;
    }

    .cep-countdown__label {
        font-size: 7px;
    }

    .cep-teams-live__notice {
        align-items: flex-start;
    }

    .cep-teams-live__notice-title {
        display: block;
        margin: 0 0 2px;
    }

    .cep-teams-live__notice p {
        display: block;
        font-size: 10px !important;
    }

    .cep-teams-live__button {
        min-height: 46px !important;
        padding: 10px 34px !important;
        font-size: 11.5px !important;
    }

}


/* ==========================================================
   Reduced Motion
   ========================================================== */

@media (prefers-reduced-motion: reduce) {

    .cep-teams-live,
    .cep-teams-live::before,
    .cep-teams-live::after,
    .cep-teams-live__icon,
    .cep-teams-live__schedule-icon,
    .cep-countdown__pulse::after,
    .cep-teams-live__button::before {
        animation: none !important;
    }

}

/* ==========================================================
   CEP Live Video Icon
   ========================================================== */

.cep-teams-live__video-icon {
    position: relative !important;

    display: block !important;

    width: 27px !important;
    height: 20px !important;

    box-sizing: border-box !important;

    border: 2px solid #ffffff !important;
    border-radius: 6px !important;

    background: rgba(255, 255, 255, 0.08) !important;

    animation:
        cepVideoIconBreath 3.5s
        ease-in-out infinite !important;
}


/* Lens */

.cep-teams-live__video-icon::before {
    content: "" !important;

    position: absolute !important;

    top: 50% !important;
    left: 50% !important;

    width: 6px !important;
    height: 6px !important;

    transform:
        translate(-50%, -50%) !important;

    background: #ffffff !important;

    border-radius: 50% !important;

    box-shadow:
        0 0 0 3px
        rgba(255, 255, 255, 0.12) !important;
}


/* Camera side */

.cep-teams-live__video-icon::after {
    content: "" !important;

    position: absolute !important;

    top: 50% !important;
    left: -8px !important;

    width: 0 !important;
    height: 0 !important;

    transform:
        translateY(-50%) !important;

    border-top:
        6px solid transparent !important;

    border-bottom:
        6px solid transparent !important;

    border-right:
        8px solid #ffffff !important;
}


/* ==========================================================
   Button Video Icon
   ========================================================== */

.cep-teams-live__button-video {
    position: relative !important;

    display: inline-block !important;

    flex: 0 0 22px !important;

    width: 22px !important;
    height: 17px !important;

    box-sizing: border-box !important;

    border:
        1.8px solid currentColor !important;

    border-radius:
        5px !important;

    color:
        rgba(255, 255, 255, 0.95) !important;
}


.cep-teams-live__button-video::before {
    content: "" !important;

    position: absolute !important;

    top: 50% !important;
    left: 50% !important;

    width: 5px !important;
    height: 5px !important;

    transform:
        translate(-50%, -50%) !important;

    background:
        currentColor !important;

    border-radius:
        50% !important;
}


.cep-teams-live__button-video::after {
    content: "" !important;

    position: absolute !important;

    top: 50% !important;
    left: -6px !important;

    width: 0 !important;
    height: 0 !important;

    transform:
        translateY(-50%) !important;

    border-top:
        5px solid transparent !important;

    border-bottom:
        5px solid transparent !important;

    border-right:
        6px solid currentColor !important;
}


/* ==========================================================
   Animation
   ========================================================== */

@keyframes cepVideoIconBreath {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.88;
    }

    50% {
        transform: scale(1.07);
        opacity: 1;
    }

}


/* Active button */

.cep-teams-live__button--available
.cep-teams-live__button-video {
    color: #02285b !important;
}


/* Reduced motion */

@media (prefers-reduced-motion: reduce) {

    .cep-teams-live__video-icon {
        animation: none !important;
    }

}

/* ==========================================================
   FIX: Moodle Editing Controls Above CEP Teams Block
   ========================================================== */

/*
 * Keep the CEP block itself in a normal stacking context.
 */
.cep-teams-live {
    z-index: 0 !important;
}


/*
 * Decorative background layers must always stay behind
 * the actual block content and Moodle controls.
 */
.cep-teams-live::before,
.cep-teams-live::after {
    z-index: 0 !important;
    pointer-events: none !important;
}


/*
 * CEP content should be above its own decoration,
 * but not above Moodle editing controls.
 */
.cep-teams-live__header,
.cep-teams-live__schedule,
.cep-countdown,
.cep-teams-live__notice,
.cep-teams-live__button {
    position: relative;
    z-index: 1 !important;
}


/* ==========================================================
   Moodle Edit Mode
   ========================================================== */

/*
 * Moodle block controls.
 */
body.editing .block .block-controls,
body.editing .block .action-menu,
body.editing .block [data-region="block-controls"] {
    position: relative !important;
    z-index: 10000 !important;
}


/*
 * Dropdown menus / action menus.
 */
body.editing .block .dropdown-menu,
body.editing .action-menu .dropdown-menu,
body.editing [role="menu"] {
    z-index: 10001 !important;
}


/*
 * Moodle editing overlays and contextual controls.
 */
body.editing .editing_move,
body.editing .editing_delete,
body.editing .editing_update,
body.editing .editing_roles,
body.editing .editing_hide,
body.editing .editing_show,
body.editing .editing_assign,
body.editing .editing_highlight {
    position: relative;
    z-index: 10002 !important;
}


/* ==========================================================
   Extra protection for Moodle/Page Builder controls
   ========================================================== */

body.editing .block {
    overflow: visible !important;
}


body.editing .block-content,
body.editing .content {
    overflow: visible;
}


/*
 * Generic Moodle floating / contextual menus.
 */
body.editing .popover,
body.editing .dropdown,
body.editing .dropdown-menu,
body.editing .moodle-actionmenu {
    z-index: 10005 !important;
}