/* ==========================================================================
   CrushMate - page loading screen (phone and desktop)

   Markup: top of <body> in MainMasterPage.master.  Logic: Javascript/PageLoader.js.
   html.cm-boot-show  -> the screen is visible (page opening or loading)
   ========================================================================== */

.cm-loader {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(242, 244, 248, .78);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .25s ease, visibility 0s linear .25s;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    .cm-loader {
        background: rgba(242, 244, 248, .6);
        -webkit-backdrop-filter: blur(8px) saturate(140%);
        backdrop-filter: blur(8px) saturate(140%);
    }
}

html.cm-boot-show .cm-loader {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity .2s ease, visibility 0s;
}

/* Never inside a transaction opened in a report dialog: the dialog has its own loader. */
html.cm-embed .cm-loader {
    display: none !important;
}

/* Running bar along the top edge */
.cm-loader-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    overflow: hidden;
    background: rgba(37, 99, 235, .12);
}

.cm-loader-bar > span {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 40%;
    border-radius: 3px;
    background: linear-gradient(90deg, #60a5fa, #2563eb 55%, #22d3ee);
    animation: cmLoaderBar 1.15s cubic-bezier(.65, .05, .36, 1) infinite;
}

@keyframes cmLoaderBar {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(260%); }
}

/* Card */
.cm-loader-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 230px;
    max-width: 320px;
    padding: 28px 30px 24px;
    border: 1px solid rgba(15, 23, 42, .06);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 24px 60px rgba(11, 29, 53, .16);
    text-align: center;
    transform: translateY(8px) scale(.97);
    transition: transform .35s cubic-bezier(.32, .72, 0, 1);
}

html.cm-boot-show .cm-loader-card {
    transform: none;
}

/* Brand mark inside a spinning ring */
.cm-loader-mark {
    position: relative;
    width: 76px;
    height: 76px;
    margin-bottom: 18px;
}

.cm-loader-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 76px;
    height: 76px;
    animation: cmLoaderSpin 1s linear infinite;
}

.cm-loader-ring circle {
    fill: none;
    stroke-width: 4;
}

.cm-loader-ring .cm-track {
    stroke: #e8edf5;
}

.cm-loader-ring .cm-arc {
    stroke: url(#cmLoaderGrad);
    stroke-linecap: round;
    stroke-dasharray: 60 160;
}

.cm-loader-logo {
    position: absolute;
    top: 14px;
    left: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 15px;
    background: linear-gradient(145deg, #4f8df9, #1d4ed8);
    box-shadow: 0 8px 18px rgba(37, 99, 235, .38), inset 0 1px 0 rgba(255, 255, 255, .3);
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: .4px;
    animation: cmLoaderPulse 1.6s ease-in-out infinite;
}

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

@keyframes cmLoaderPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(.93); }
}

.cm-loader-title {
    max-width: 100%;
    overflow: hidden;
    color: #0f172a;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -.2px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cm-loader-sub {
    margin-top: 4px;
    color: #7b8798;
    font-size: 13px;
    line-height: 1.4;
}

/* Three dots after "Just a moment" */
.cm-loader-dots i {
    display: inline-block;
    width: 4px;
    height: 4px;
    margin-left: 3px;
    border-radius: 50%;
    background: currentColor;
    vertical-align: middle;
    animation: cmLoaderDot 1.2s ease-in-out infinite;
}

.cm-loader-dots i:nth-child(2) { animation-delay: .15s; }
.cm-loader-dots i:nth-child(3) { animation-delay: .3s; }

@keyframes cmLoaderDot {
    0%, 80%, 100% { opacity: .25; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-2px); }
}

/* The loading screen has its own bar; the small progress bar is for data loading inside a page. */
html.cm-boot-show .pace {
    display: none;
}

/* Data-loading progress bar (Pace): was a 2px white line nobody could see. */
.pace .pace-progress {
    height: 3px;
    background: linear-gradient(90deg, #60a5fa, #2563eb 60%, #22d3ee);
    z-index: 2060;
}

.pace .pace-progress-inner {
    box-shadow: 0 0 10px #2563eb, 0 0 5px #2563eb;
}

.pace .pace-activity {
    display: none;
}

@media (max-width: 767px) {
    .cm-loader {
        padding: 16px;
    }

    .cm-loader-card {
        width: 100%;
        max-width: 300px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cm-loader,
    .cm-loader-card {
        transition: none;
    }

    .cm-loader-ring,
    .cm-loader-logo,
    .cm-loader-dots i {
        animation: none;
    }

    .cm-loader-bar > span {
        animation-duration: 2.4s;
    }
}

@media print {
    .cm-loader {
        display: none !important;
    }
}
