/* =========================================================
   CEP CUSTOM FOOTER — PHASE 26
   Continuing Education Platform
   ========================================================= */

body.cep-footer-active {
    --cep-footer-bg: #002e64;
    --cep-footer-navy: #02285B;
    --cep-footer-blue: #003780;
    --cep-footer-gold: #827746;
    --cep-footer-gold-light: #B8A95F;
    --cep-footer-white: #FFFFFF;
    --cep-footer-muted: rgba(255,255,255,.68);
    --cep-footer-border: rgba(255,255,255,.10);
}

/* The native footer is the host; keep it visible after mounting. */

.cep-footer {
    position: relative;
    overflow: hidden;
    background: var(--cep-footer-bg);
    color: var(--cep-footer-white);
    border-top: 1px solid rgba(130,119,70,.30);
}

.cep-footer::before {
    content: "";
    position: absolute;
    width: 420px;
    height: 420px;
    inset-inline-end: -150px;
    top: -160px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.055);
    box-shadow:
        0 0 0 58px rgba(255,255,255,.012),
        0 0 0 116px rgba(255,255,255,.008);
    pointer-events: none;
}

.cep-footer::after {
    content: "";
    position: absolute;
    width: 310px;
    height: 310px;
    inset-inline-start: -95px;
    bottom: -145px;
    background: url('/cep-assets/images/icons/MNC-Logo.svg') center/contain no-repeat;
    opacity: .018;
    filter: grayscale(1) brightness(2);
    pointer-events: none;
}

.cep-footer__shell {
    position: relative;
    z-index: 2;
    width: min(1180px, calc(100% - 40px));
    margin-inline: auto;
}

.cep-footer__main {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, .8fr) minmax(0, .65fr) minmax(0, 1fr);
    gap: 34px;
    padding: 64px 0 46px;
}

.cep-footer__brand {
    max-width: 520px;
}

.cep-footer__brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 18px;
}

.cep-footer__brand-mark img {
    width: auto;
    height: 58px;
    max-width: 210px;
    object-fit: contain;
    filter: none;
    opacity: 1;
}

.cep-footer__brand-mark > div {
    display: grid;
    gap: 2px;
}

.cep-footer__brand-mark span {
    color: var(--cep-footer-gold-light);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .12em;
}

.cep-footer__brand-mark strong {
    color: #FFFFFF;
    font-size: 19px;
    line-height: 1.3;
}

.cep-footer__brand p {
    margin: 0;
    max-width: 520px;
    color: var(--cep-footer-muted);
    font-size: 14px;
    line-height: 1.9;
}

.cep-footer__accent {
    width: 54px;
    height: 3px;
    margin-top: 22px;
    border-radius: 999px;
    background: var(--cep-footer-gold);
}

.cep-footer__column h3 {
    margin: 0 0 16px;
    color: #FFFFFF !important;
    font-size: 14px;
    font-weight: 800;
}

.cep-footer__contact p {
    margin: 0 0 14px;
    color: var(--cep-footer-muted);
    font-size: 13px;
    line-height: 1.9;
}

.cep-footer__email {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: #FFFFFF !important;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 500;
}

.cep-footer__email svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: #D8CB87;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cep-footer__email bdi { overflow-wrap: anywhere; }
.cep-footer__email:hover { color: #D8CB87 !important; }

.cep-footer__links {
    display: grid;
    gap: 9px;
}

.cep-footer__links a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    color: var(--cep-footer-muted) !important;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 600;
    transition:
        color .2s ease,
        transform .2s ease;
}

.cep-footer__links a::before {
    content: "";
    width: 5px;
    height: 5px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: rgba(184,169,95,.70);
}

.cep-footer__links a:hover,
.cep-footer__links a:focus-visible {
    color: #FFFFFF !important;
    transform: translateX(3px);
}

html[dir="rtl"] .cep-footer__links a:hover,
html[dir="rtl"] .cep-footer__links a:focus-visible {
    transform: translateX(-3px);
}

.cep-footer__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 76px;
    padding: 18px 0;
    border-top: 1px solid var(--cep-footer-border);
}

.cep-footer__copyright {
    color: rgba(255,255,255,.58);
    font-size: 12px;
    line-height: 1.6;
}

.cep-footer__bottom-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cep-footer__lang,
.cep-footer__top {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 7px 12px;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 999px;
    background: rgba(255,255,255,.045);
    color: rgba(255,255,255,.82) !important;
    text-decoration: none !important;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    transition:
        background-color .2s ease,
        border-color .2s ease,
        color .2s ease,
        transform .2s ease;
}

.cep-footer__lang:hover,
.cep-footer__top:hover,
.cep-footer__lang:focus-visible,
.cep-footer__top:focus-visible {
    background: var(--cep-footer-gold);
    border-color: var(--cep-footer-gold);
    color: #FFFFFF !important;
    transform: translateY(-1px);
}

.cep-footer__top {
    font-family: inherit;
}

.cep-footer__top svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Arabic */
html[dir="rtl"] .cep-footer,
html[dir="rtl"] .cep-footer__brand,
html[dir="rtl"] .cep-footer__column,
html[dir="rtl"] .cep-footer__copyright {
    direction: rtl;
    text-align: right;
}

/* English */
html[dir="ltr"] .cep-footer,
html[dir="ltr"] .cep-footer__brand,
html[dir="ltr"] .cep-footer__column,
html[dir="ltr"] .cep-footer__copyright {
    direction: ltr;
    text-align: left;
}

@media (max-width: 900px) {
    .cep-footer__main {
        grid-template-columns: 1fr 1fr;
        gap: 36px 28px;
        padding-top: 52px;
    }

    .cep-footer__brand { grid-column: auto; }
}

@media (max-width: 620px) {
    .cep-footer__shell {
        width: min(100% - 28px, 1180px);
    }

    .cep-footer__main {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 44px 0 34px;
    }

    .cep-footer__brand {
        grid-column: auto;
    }

    .cep-footer__bottom {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
        padding: 20px 0 24px;
    }

    .cep-footer__bottom-actions {
        width: 100%;
        justify-content: space-between;
    }
}

.cep-footer a:focus-visible,
.cep-footer button:focus-visible {
    outline: 3px solid rgba(184,169,95,.42);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .cep-footer * {
        transition: none !important;
    }
}


/* =========================================================
   PHASE 24 — CEP DARK LOGO
   ========================================================= */
@media (max-width: 620px) {
    .cep-footer__brand-mark img {
        height: 50px;
        max-width: 180px;
    }
}


/* =========================================================
   PHASE 25 — FOOTER PLACEMENT + EXACT BACKGROUND
   ========================================================= */

#cep-custom-footer.cep-footer {
    position: relative !important;
    inset: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;

    float: none !important;
    clear: both !important;

    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;

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

    display: block !important;
    z-index: 2 !important;

    background: #002e64 !important;
}

/* The footer must participate in normal document flow. */
body.cep-footer-mounted > #cep-custom-footer {
    position: relative !important;
}

/* Prevent theme styles from turning it into a floating/footer drawer. */
#cep-custom-footer,
#cep-custom-footer * {
    box-sizing: border-box;
}


/* =========================================================
   PHASE 26 — USE THE NATIVE MOODLE FOOTER AS THE HOST
   This guarantees the CEP footer stays at the real page end.
   ========================================================= */

/* Reset the real Moodle footer after JS converts it to our host. */
.cep-native-footer-host {
    display: block !important;
    position: relative !important;
    inset: auto !important;
    float: none !important;
    clear: both !important;

    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;

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

    border: 0 !important;
    background: #002e64 !important;
    box-shadow: none !important;
    overflow: hidden !important;
}

/* Remove theme pseudo-elements/background layers that may survive. */
.cep-native-footer-host::before,
.cep-native-footer-host::after {
    display: none !important;
    content: none !important;
}

/* The CEP footer now lives INSIDE the real theme footer. */
.cep-native-footer-host > #cep-custom-footer.cep-footer {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    background: #002e64 !important;
}

/* Hide typical theme footer children if a theme script re-injects them. */
.cep-native-footer-host > :not(#cep-custom-footer) {
    display: none !important;
}
