/* ==========================================================================
   Moroccan Red Crescent — Global Animated Loader
   SVG + CSS implementation; no GIF and no raster dependency.
   ========================================================================== */

:root {
    --mrcs-loader-red: #ed1b24;
    --mrcs-loader-red-dark: #b7000b;
    --mrcs-loader-red-light: #ff555d;
    --mrcs-loader-ink: #171717;
    --mrcs-loader-muted: #6f6f76;
    --mrcs-loader-bg: #ffffff;
}

/* Disable Akcel's legacy preloaders when the new global component is installed. */
#loading-area {
    display: none !important;
}

html.mrcs-loader-lock,
html.mrcs-loader-lock body {
    overflow: hidden !important;
    overscroll-behavior: none;
}

.mrcs-global-loader {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex !important;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    isolation: isolate;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    background:
        radial-gradient(circle at 50% 44%, rgba(237, 27, 36, .075) 0 10%, rgba(237, 27, 36, .028) 22%, rgba(255, 255, 255, .97) 50%, #fff 76%),
        linear-gradient(180deg, #fff 0%, #fff 100%);
    transition: opacity .34s ease, visibility .34s ease;
    -webkit-tap-highlight-color: transparent;
    contain: layout paint style;
}

.mrcs-global-loader::before,
.mrcs-global-loader::after {
    content: "";
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
    filter: blur(28px);
    opacity: .48;
}

.mrcs-global-loader::before {
    width: min(72vw, 760px);
    aspect-ratio: 1;
    background: radial-gradient(circle, rgba(255, 42, 51, .08), transparent 66%);
    transform: translate(-27%, -29%);
}

.mrcs-global-loader::after {
    width: min(62vw, 650px);
    aspect-ratio: 1;
    background: radial-gradient(circle, rgba(237, 27, 36, .055), transparent 68%);
    transform: translate(31%, 30%);
}

.mrcs-global-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Remove the finished overlay from layout/hit-testing after its fade. */
.mrcs-global-loader.is-gone {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.mrcs-global-loader.is-hidden .mrcs-loader-scene {
    transform: translateY(8px) scale(.985);
}

.mrcs-loader-ambient {
    position: absolute;
    width: min(520px, 86vw);
    height: 68px;
    left: 50%;
    top: calc(50% + 210px);
    transform: translateX(-50%);
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(237, 27, 36, .20), rgba(237, 27, 36, .05) 42%, transparent 72%);
    filter: blur(11px);
    opacity: .68;
    animation: mrcsLoaderGroundGlow 2.2s ease-in-out infinite;
}

.mrcs-loader-scene {
    position: relative;
    width: min(440px, calc(100vw - 28px));
    height: min(510px, calc(100svh - 24px));
    min-height: 430px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-8px);
    transition: transform .34s ease;
}

.mrcs-loader-core {
    position: absolute;
    top: 94px;
    left: 50%;
    width: clamp(164px, 18vw, 194px);
    aspect-ratio: 1 / 1;
    height: auto;
    transform: translateX(-50%);
    display: grid;
    place-items: center;
    z-index: 8;
    animation: mrcsLoaderCoreEntry 2.2s cubic-bezier(.16, 1, .3, 1) infinite;
}

.mrcs-loader-core-glow {
    position: absolute;
    inset: -28px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(237, 27, 36, .22), rgba(237, 27, 36, .08) 38%, transparent 70%);
    filter: blur(9px);
    animation: mrcsLoaderGlow 2.2s ease-in-out infinite;
}

.mrcs-loader-crescent {
    /* Never stretch the crescent: keep one square coordinate system everywhere. */
    width: clamp(154px, 17vw, 182px);
    height: auto;
    aspect-ratio: 1 / 1;
    display: block;
    overflow: visible;
    flex: 0 0 auto;
    transform-origin: 50% 50%;
    shape-rendering: geometricPrecision;
    text-rendering: geometricPrecision;
    animation: mrcsLoaderCrescentPulse 2.2s ease-in-out infinite;
}

.mrcs-loader-crescent-body {
    vector-effect: non-scaling-stroke;
}

.mrcs-loader-shine {
    position: absolute;
    width: 46px;
    height: 176px;
    top: 6px;
    left: -58px;
    opacity: 0;
    pointer-events: none;
    transform: skewX(-18deg) rotate(6deg);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .88), transparent);
    filter: blur(4px);
    mix-blend-mode: screen;
    animation: mrcsLoaderShine 2.2s ease-in-out infinite;
}

.mrcs-loader-spark {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    opacity: 0;
    box-shadow: 0 0 7px #fff, 0 0 18px rgba(237, 27, 36, .72), 0 0 30px rgba(237, 27, 36, .38);
    animation: mrcsLoaderSpark 2.2s ease-in-out infinite;
}

.mrcs-loader-spark--one {
    top: 29px;
    left: 37px;
}

.mrcs-loader-spark--two {
    right: 31px;
    bottom: 26px;
    animation-delay: .7s;
}

.mrcs-loader-orbit {
    position: absolute;
    top: 36px;
    left: 50%;
    border-radius: 50%;
    pointer-events: none;
    transform-origin: 50% 50%;
}

.mrcs-loader-orbit--outer {
    width: 354px;
    height: 354px;
    margin-left: -177px;
    border: 2px solid rgba(110, 110, 118, .055);
    background:
        repeating-conic-gradient(
            from 4deg,
            rgba(237, 27, 36, .00) 0 14deg,
            rgba(237, 27, 36, .78) 15deg 16.5deg,
            rgba(237, 27, 36, .00) 18deg 34deg
        );
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 0);
    mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 0);
    animation: mrcsLoaderRotate 7.8s linear infinite, mrcsLoaderOrbitEntry 2.2s ease-in-out infinite;
    z-index: 2;
}

.mrcs-loader-orbit--outer::before,
.mrcs-loader-orbit--outer::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(237, 27, 36, .08), var(--mrcs-loader-red), rgba(255, 91, 98, .45));
    box-shadow: 0 0 16px rgba(237, 27, 36, .26);
}

.mrcs-loader-orbit--outer::before {
    width: 86px;
    height: 7px;
    top: 13px;
    left: 70px;
    transform: rotate(-9deg);
}

.mrcs-loader-orbit--outer::after {
    width: 58px;
    height: 7px;
    right: 12px;
    bottom: 101px;
    transform: rotate(78deg);
    opacity: .66;
}

.mrcs-loader-orbit--mid {
    width: 310px;
    height: 310px;
    margin-left: -155px;
    top: 57px;
    border: 3px solid rgba(237, 27, 36, .07);
    border-top-color: rgba(237, 27, 36, .96);
    border-left-color: rgba(237, 27, 36, .35);
    border-bottom-color: rgba(135, 135, 143, .12);
    animation: mrcsLoaderRotateReverse 3.9s linear infinite, mrcsLoaderOrbitEntry 2.2s .08s ease-in-out infinite;
    z-index: 3;
}

.mrcs-loader-orbit--mid::before {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    top: 21px;
    right: 49px;
    border-radius: 50%;
    background: var(--mrcs-loader-red);
    box-shadow: 0 0 8px rgba(237, 27, 36, .72), 0 0 22px rgba(237, 27, 36, .28);
}

.mrcs-loader-orbit--inner {
    width: 254px;
    height: 254px;
    margin-left: -127px;
    top: 84px;
    border: 8px solid transparent;
    border-top-color: rgba(237, 27, 36, .82);
    border-right-color: rgba(237, 27, 36, .18);
    border-bottom-color: rgba(153, 153, 160, .10);
    border-radius: 50%;
    filter: drop-shadow(0 0 9px rgba(237, 27, 36, .10));
    animation: mrcsLoaderRotate 2.65s linear infinite, mrcsLoaderOrbitEntry 2.2s .15s ease-in-out infinite;
    z-index: 4;
}

.mrcs-loader-traveller {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 5px #fff, 0 0 13px var(--mrcs-loader-red), 0 0 25px rgba(237, 27, 36, .68);
}

.mrcs-loader-orbit--outer > .mrcs-loader-traveller {
    right: 35px;
    top: 78px;
}

.mrcs-loader-orbit--mid > .mrcs-loader-traveller {
    left: 16px;
    top: 137px;
}

.mrcs-loader-ticks {
    position: absolute;
    width: 334px;
    height: 334px;
    top: 46px;
    left: 50%;
    margin-left: -167px;
    z-index: 5;
    pointer-events: none;
    animation: mrcsLoaderRotateReverse 9.7s linear infinite;
}

.mrcs-loader-ticks i {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--mrcs-loader-red);
    box-shadow: 0 0 7px rgba(237, 27, 36, .28);
}

.mrcs-loader-ticks i:nth-child(1) { left: 46px; top: 86px; }
.mrcs-loader-ticks i:nth-child(2) { left: 34px; top: 105px; opacity: .85; width: 5px; height: 5px; }
.mrcs-loader-ticks i:nth-child(3) { left: 26px; top: 125px; opacity: .7; width: 4px; height: 4px; }
.mrcs-loader-ticks i:nth-child(4) { right: 45px; top: 80px; }
.mrcs-loader-ticks i:nth-child(5) { right: 31px; top: 101px; opacity: .8; width: 5px; height: 5px; }
.mrcs-loader-ticks i:nth-child(6) { right: 23px; top: 122px; opacity: .65; width: 4px; height: 4px; }

.mrcs-loader-identity {
    position: absolute;
    width: 100%;
    top: 345px;
    left: 0;
    z-index: 12;
    text-align: center;
    pointer-events: none;
}

.mrcs-loader-title {
    color: var(--mrcs-loader-ink);
    font-family: "Cairo", "Cairo Variable", Tahoma, Arial, sans-serif;
    font-size: 29px;
    line-height: 1.45;
    font-weight: 650;
    letter-spacing: 0;
    opacity: 0;
    transform: translateY(12px);
    animation: mrcsLoaderTextIn 2.2s .02s ease-in-out infinite;
}

.mrcs-loader-subtitle {
    margin-top: -1px;
    color: #28282b;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: .05px;
    opacity: 0;
    transform: translateY(11px);
    animation: mrcsLoaderTextInLater 2.2s ease-in-out infinite;
}

.mrcs-loader-status {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    min-height: 22px;
    color: var(--mrcs-loader-muted);
    font-size: 12px;
    line-height: 1;
    font-family: "Cairo", "Cairo Variable", "Open Sans", Arial, sans-serif;
    opacity: 0;
    animation: mrcsLoaderStatusIn 2.2s ease-in-out infinite;
}

html[dir="rtl"] .mrcs-loader-status {
    direction: rtl;
}

.mrcs-loader-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.mrcs-loader-dots b {
    display: block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--mrcs-loader-red);
    animation: mrcsLoaderDot 1.05s ease-in-out infinite;
}

.mrcs-loader-dots b:nth-child(2) { animation-delay: .13s; }
.mrcs-loader-dots b:nth-child(3) { animation-delay: .26s; }

@keyframes mrcsLoaderRotate {
    to { transform: rotate(360deg); }
}

@keyframes mrcsLoaderRotateReverse {
    to { transform: rotate(-360deg); }
}

@keyframes mrcsLoaderOrbitEntry {
    0%, 5% { opacity: .08; filter: blur(2px); }
    23%, 87% { opacity: 1; filter: blur(0); }
    100% { opacity: .82; }
}

@keyframes mrcsLoaderCoreEntry {
    0%, 10% { opacity: 0; transform: translateX(-50%) scale(.68); filter: blur(6px); }
    31% { opacity: 1; transform: translateX(-50%) scale(1.045); filter: blur(0); }
    43%, 88% { opacity: 1; transform: translateX(-50%) scale(1); filter: blur(0); }
    94% { transform: translateX(-50%) scale(1.025); }
    100% { opacity: .96; transform: translateX(-50%) scale(1); }
}

@keyframes mrcsLoaderCrescentPulse {
    0%, 39%, 80%, 100% { transform: scale(1); }
    48% { transform: scale(1.018); }
    88% { transform: scale(1.028); }
}

@keyframes mrcsLoaderGlow {
    0%, 12% { opacity: .18; transform: scale(.84); }
    35% { opacity: .9; transform: scale(1.08); }
    60% { opacity: .54; transform: scale(.97); }
    88% { opacity: .95; transform: scale(1.12); }
    100% { opacity: .48; transform: scale(1); }
}

@keyframes mrcsLoaderShine {
    0%, 27% { left: -58px; opacity: 0; }
    31% { opacity: .74; }
    57% { left: 202px; opacity: 0; }
    100% { left: 202px; opacity: 0; }
}

@keyframes mrcsLoaderSpark {
    0%, 24%, 100% { opacity: 0; transform: scale(.2); }
    32% { opacity: 1; transform: scale(1); }
    43% { opacity: .18; transform: scale(.5); }
}

@keyframes mrcsLoaderTextIn {
    0%, 34% { opacity: 0; transform: translateY(12px); }
    49%, 90% { opacity: 1; transform: translateY(0); }
    100% { opacity: .88; transform: translateY(0); }
}

@keyframes mrcsLoaderTextInLater {
    0%, 43% { opacity: 0; transform: translateY(11px); }
    58%, 90% { opacity: 1; transform: translateY(0); }
    100% { opacity: .88; transform: translateY(0); }
}

@keyframes mrcsLoaderStatusIn {
    0%, 51% { opacity: 0; transform: translateY(6px); }
    67%, 100% { opacity: 1; transform: translateY(0); }
}

@keyframes mrcsLoaderGroundGlow {
    0%, 100% { opacity: .36; transform: translateX(-50%) scaleX(.82); }
    50% { opacity: .72; transform: translateX(-50%) scaleX(1.07); }
}

@keyframes mrcsLoaderDot {
    0%, 100% { opacity: .22; transform: translateY(0) scale(.85); }
    50% { opacity: 1; transform: translateY(-4px) scale(1); }
}

@media (min-width: 601px) and (max-width: 991.98px) {
    .mrcs-loader-scene {
        width: 400px;
        height: 480px;
    }

    .mrcs-loader-core {
        top: 88px;
        width: 180px;
    }

    .mrcs-loader-crescent {
        width: 169px;
    }

    .mrcs-loader-orbit--outer {
        width: 330px;
        height: 330px;
        margin-left: -165px;
        top: 32px;
    }

    .mrcs-loader-orbit--mid {
        width: 288px;
        height: 288px;
        margin-left: -144px;
        top: 53px;
    }

    .mrcs-loader-orbit--inner {
        width: 238px;
        height: 238px;
        margin-left: -119px;
        top: 78px;
    }

    .mrcs-loader-ticks {
        width: 310px;
        height: 310px;
        margin-left: -155px;
        top: 42px;
    }

    .mrcs-loader-identity {
        top: 326px;
    }

    .mrcs-loader-title {
        font-size: 27px;
    }

    .mrcs-loader-subtitle {
        font-size: 18px;
    }
}

@media (max-width: 600px) {
    .mrcs-loader-scene {
        width: 330px;
        height: 430px;
        transform: translateY(-2px);
    }

    .mrcs-loader-core {
        top: 78px;
        width: 154px;
        height: auto;
        aspect-ratio: 1 / 1;
    }

    .mrcs-loader-crescent {
        width: 146px;
        height: auto;
        aspect-ratio: 1 / 1;
    }

    .mrcs-loader-shine {
        height: 144px;
    }

    .mrcs-loader-orbit--outer {
        width: 286px;
        height: 286px;
        margin-left: -143px;
        top: 23px;
    }

    .mrcs-loader-orbit--mid {
        width: 250px;
        height: 250px;
        margin-left: -125px;
        top: 41px;
    }

    .mrcs-loader-orbit--inner {
        width: 206px;
        height: 206px;
        margin-left: -103px;
        top: 63px;
        border-width: 7px;
    }

    .mrcs-loader-ticks {
        width: 270px;
        height: 270px;
        margin-left: -135px;
        top: 31px;
    }

    .mrcs-loader-ticks i:nth-child(1) { left: 39px; top: 69px; }
    .mrcs-loader-ticks i:nth-child(2) { left: 29px; top: 87px; }
    .mrcs-loader-ticks i:nth-child(3) { left: 23px; top: 105px; }
    .mrcs-loader-ticks i:nth-child(4) { right: 38px; top: 65px; }
    .mrcs-loader-ticks i:nth-child(5) { right: 27px; top: 84px; }
    .mrcs-loader-ticks i:nth-child(6) { right: 20px; top: 103px; }

    .mrcs-loader-identity {
        top: 292px;
    }

    .mrcs-loader-title {
        font-size: 23px;
    }

    .mrcs-loader-subtitle {
        font-size: 16px;
    }

    .mrcs-loader-status {
        margin-top: 17px;
        font-size: 11px;
    }

    .mrcs-loader-ambient {
        top: calc(50% + 165px);
        width: min(360px, 82vw);
        height: 54px;
    }
}

@media (max-width: 420px) and (max-height: 720px) {
    .mrcs-loader-scene {
        transform: scale(.88);
        transform-origin: center center;
    }

    .mrcs-loader-ambient {
        top: calc(50% + 145px);
    }
}

@media (max-width: 360px) {
    .mrcs-loader-scene {
        transform: scale(.91);
    }
}

/*
 * Desktop/Windows compatibility:
 * Some desktop systems report prefers-reduced-motion: reduce even when the
 * user expects the branded loader to animate.  Do not freeze the loader.
 * Keep a slower, gentler motion while leaving content immediately readable.
 */
@media (prefers-reduced-motion: reduce) {
    .mrcs-loader-orbit--outer {
        animation: mrcsLoaderRotate 12s linear infinite !important;
    }

    .mrcs-loader-orbit--mid {
        animation: mrcsLoaderRotateReverse 9s linear infinite !important;
    }

    .mrcs-loader-orbit--inner {
        animation: mrcsLoaderRotate 7s linear infinite !important;
    }

    .mrcs-loader-ticks {
        animation: mrcsLoaderRotateReverse 16s linear infinite !important;
    }

    .mrcs-loader-core {
        animation: none !important;
        opacity: 1 !important;
        transform: translateX(-50%) scale(1) !important;
        filter: none !important;
    }

    .mrcs-loader-core-glow {
        animation: mrcsLoaderGlow 4.8s ease-in-out infinite !important;
    }

    .mrcs-loader-crescent {
        animation: mrcsLoaderCrescentPulse 4s ease-in-out infinite !important;
    }

    .mrcs-loader-shine {
        animation: mrcsLoaderShine 5.5s ease-in-out infinite !important;
    }

    .mrcs-loader-spark {
        animation: mrcsLoaderSpark 5s ease-in-out infinite !important;
    }

    .mrcs-loader-dots b {
        animation: mrcsLoaderDot 1.5s ease-in-out infinite !important;
    }

    .mrcs-loader-dots b:nth-child(2) { animation-delay: .18s !important; }
    .mrcs-loader-dots b:nth-child(3) { animation-delay: .36s !important; }

    .mrcs-loader-title,
    .mrcs-loader-subtitle,
    .mrcs-loader-status {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
    }

    /* Preserve the normal loader fade-out instead of disabling transitions. */
    .mrcs-global-loader,
    .mrcs-loader-scene {
        transition-duration: .34s !important;
    }
}
