/* ==============================================================
   MODERN LOADING OVERLAY & SPINNER (UI/UX REDESIGN)
============================================================== */

#loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999999999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

#loading.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#loading > div {
    background: #ffffff;
    border-radius: 20px;
    padding: 2rem 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25), 
                0 0 0 1px rgba(226, 232, 240, 0.8);
    border: 1px solid #e2e8f0;
    transform: scale(0.9);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    min-width: 260px;
    max-width: 340px;
    text-align: center;
}

#loading.active > div {
    transform: scale(1);
}

/* Dual-Ring Modern Spinner (Branded Navy & Orange) */
.loader {
    width: 52px;
    height: 52px;
    position: relative;
    display: inline-block;
    margin-bottom: 14px;
}

.loader::before,
.loader::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-sizing: border-box;
}

/* Outer ring - Brand Navy */
.loader::before {
    border: 3.5px solid #e2e8f0;
    border-top-color: #0d3b66;
    border-right-color: #0d3b66;
    animation: loaderSpin 1s cubic-bezier(0.55, 0.055, 0.675, 0.19) infinite;
}

/* Inner ring - Brand Orange */
.loader::after {
    margin: 6px;
    border: 3px solid transparent;
    border-bottom-color: #f47621;
    border-left-color: #f47621;
    animation: loaderSpinReverse 0.8s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes loaderSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes loaderSpinReverse {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}

/* Text status */
.loader2 {
    font-family: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif !important;
    font-size: 0.98rem;
    font-weight: 700;
    color: #0d3b66;
    margin: 0;
    padding: 0;
    transform: none !important;
    display: inline-block;
    letter-spacing: -0.2px;
}

/* Three dots pulsing animation */
.loader2::after {
    content: '...';
    display: inline-block;
    width: 14px;
    text-align: left;
    overflow: hidden;
    vertical-align: bottom;
    animation: animatedDots 1.4s infinite steps(4, jump-none);
    color: #f47621;
    font-weight: 800;
}

@keyframes animatedDots {
    0% { width: 0; }
    50% { width: 8px; }
    100% { width: 14px; }
}

/* Subtitle under text */
#loading > div::after {
    content: 'Vui lòng đợi trong giây lát';
    display: block;
    font-family: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif !important;
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 5px;
    font-weight: 500;
}
