/* ==========================================================
   GLOBAL LOADING SYSTEM - ONLINE EXAM SYSTEM
   Centered Loader right in the middle of the screen
   ========================================================== */

/* 1. TOP PROGRESS BAR */
#appTopProgressBar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3.5px;
    background: linear-gradient(90deg, #2563eb, #3b82f6, #06b6d4, #10b981);
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.8), 0 0 5px rgba(6, 182, 212, 0.6);
    z-index: 9999999;
    opacity: 0;
    pointer-events: none;
    transition: width 0.25s cubic-bezier(0.1, 0.8, 0.3, 1), opacity 0.3s ease;
}

#appTopProgressBar.active {
    opacity: 1;
}

/* 2. CENTER SCREEN LOADER (Chính giữa màn hình) */
#appGlobalLoader {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.22);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

#appGlobalLoader.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.app-loader-box {
    background: #ffffff;
    border-radius: 20px;
    padding: 24px 34px;
    box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(226, 232, 240, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-width: 170px;
    animation: appLoaderPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes appLoaderPop {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.app-loader-spinner-wrap {
    position: relative;
    width: 44px;
    height: 44px;
}

.app-dual-spinner {
    position: absolute;
    inset: 0;
    border: 3.5px solid transparent;
    border-top-color: #2563eb;
    border-right-color: #38bdf8;
    border-radius: 50%;
    animation: appSpin 0.75s linear infinite;
}

.app-dual-spinner-inner {
    position: absolute;
    inset: 6px;
    border: 2.5px solid transparent;
    border-bottom-color: #4f46e5;
    border-radius: 50%;
    animation: appSpinReverse 1.05s linear infinite;
}

.app-loader-text {
    font-size: 14.5px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 4px;
}

.app-dots span {
    animation: appDotBlink 1.4s infinite both;
}

.app-dots span:nth-child(2) { animation-delay: 0.2s; }
.app-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes appDotBlink {
    0%, 80%, 100% { opacity: 0.2; }
    40% { opacity: 1; }
}

/* 3. COMPONENT-LEVEL IN-PLACE LOADING OVERLAY */
.is-loading-container {
    position: relative !important;
    min-height: 80px;
    pointer-events: none;
}

.component-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 50;
    border-radius: inherit;
    animation: fadeInOverlay 0.2s ease;
    pointer-events: auto;
}

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

.component-loading-overlay .comp-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: appSpin 0.75s linear infinite;
}

.component-loading-overlay .comp-text {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    letter-spacing: 0.1px;
}

/* 4. KEYFRAMES */
@keyframes appSpin {
    to { transform: rotate(360deg); }
}

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