/* ============================================================
   Buy4earn Universal Loader — Logo + Motivational Quotes
   Works as: full-page loader, section loader, inline loader
   ============================================================ */

/* ---------- FULL PAGE LOADER (replaces old #load_screen) ---------- */
#load_screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 25%, #e8eaf6 50%, #e0f7fa 75%, #e3f2fd 100%);
    background-size: 400% 400%;
    animation: b4eLightGradient 12s ease infinite;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    overflow: hidden;
}

@keyframes b4eLightGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#load_screen.b4e-loader-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ---------- BACKGROUND PARTICLES (subtle) ---------- */
#load_screen::before,
#load_screen::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    opacity: 0.08;
    animation: b4eFloat 6s ease-in-out infinite;
}
#load_screen::before {
    width: 300px;
    height: 300px;
    background: #4361ee;
    top: -100px;
    right: -100px;
    animation-delay: 0s;
}
#load_screen::after {
    width: 200px;
    height: 200px;
    background: #1abc9c;
    bottom: -60px;
    left: -60px;
    animation-delay: -3s;
}

@keyframes b4eFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(20px, -20px) scale(1.1); }
}

/* ---------- LOGO CONTAINER ---------- */
.b4e-loader-logo-wrap {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 28px;
    z-index: 1;
}

/* Glow ring behind logo */
.b4e-loader-logo-wrap::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(67, 97, 238, 0.25) 0%, transparent 70%);
    animation: b4eGlow 2s ease-in-out infinite;
}

@keyframes b4eGlow {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
}

/* Rotating orbit ring */
.b4e-loader-orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 140px;
    height: 140px;
    transform: translate(-50%, -50%);
    border: 2px solid transparent;
    border-top-color: #4361ee;
    border-right-color: rgba(67, 97, 238, 0.3);
    border-radius: 50%;
    animation: b4eOrbit 1.8s linear infinite;
}

.b4e-loader-orbit::after {
    content: '';
    position: absolute;
    top: -2px;
    right: 20px;
    width: 8px;
    height: 8px;
    background: #4361ee;
    border-radius: 50%;
    box-shadow: 0 0 12px rgba(67, 97, 238, 0.6);
}

@keyframes b4eOrbit {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* The logo image */
.b4e-loader-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    object-fit: contain;
    animation: b4eLogoPulse 2s ease-in-out infinite;
    filter: drop-shadow(0 0 15px rgba(67, 97, 238, 0.3));
}

@keyframes b4eLogoPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.06); }
}

/* ---------- PROGRESS BAR ---------- */
.b4e-loader-progress {
    width: 200px;
    height: 3px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 24px;
    z-index: 1;
}

.b4e-loader-progress-bar {
    height: 100%;
    width: 30%;
    background: linear-gradient(90deg, #4361ee, #1abc9c);
    border-radius: 3px;
    animation: b4eProgress 1.5s ease-in-out infinite;
}

@keyframes b4eProgress {
    0% { width: 0%; margin-left: 0%; }
    50% { width: 60%; margin-left: 20%; }
    100% { width: 0%; margin-left: 100%; }
}

/* ---------- QUOTE TEXT ---------- */
.b4e-loader-quote {
    max-width: 420px;
    padding: 0 20px;
    text-align: center;
    z-index: 1;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.b4e-loader-quote p {
    color: rgba(27, 46, 75, 0.85);
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-style: italic;
    line-height: 1.6;
    margin: 0;
    animation: b4eQuoteFade 4s ease-in-out infinite;
    letter-spacing: 0.3px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

@keyframes b4eQuoteFade {
    0% { opacity: 0; transform: translateY(8px); }
    15% { opacity: 1; transform: translateY(0); }
    85% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-8px); }
}

/* ---------- BRAND TEXT ---------- */
.b4e-loader-brand {
    position: absolute;
    bottom: 24px;
    color: rgba(67, 97, 238, 0.75);
    font-family: 'Nunito', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    z-index: 1;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

/* ====================================================================
   SECTION LOADER — use inside any div with class .b4e-section-loader
   ==================================================================== */
.b4e-section-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    min-height: 200px;
}

.b4e-section-loader .b4e-loader-logo-wrap {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
}

.b4e-section-loader .b4e-loader-logo-wrap::before {
    width: 80px;
    height: 80px;
}

.b4e-section-loader .b4e-loader-orbit {
    width: 80px;
    height: 80px;
}

.b4e-section-loader .b4e-loader-orbit::after {
    width: 6px;
    height: 6px;
    right: 12px;
}

.b4e-section-loader .b4e-loader-logo {
    width: 44px;
    height: 44px;
}

.b4e-section-loader .b4e-loader-progress {
    width: 120px;
    height: 2px;
    margin-bottom: 14px;
}

.b4e-section-loader .b4e-loader-quote p {
    font-size: 11px;
    color: #888ea8;
}

.b4e-section-loader .b4e-loader-quote {
    max-width: 300px;
    min-height: 40px;
}

/* Section loader on transparent/light background */
.b4e-section-loader .b4e-loader-progress {
    background: rgba(0, 0, 0, 0.08);
}

/* ====================================================================
   INLINE LOADER — tiny version for buttons / table cells
   ==================================================================== */
.b4e-inline-loader {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.b4e-inline-loader .b4e-loader-logo {
    position: static;
    transform: none;
    width: 24px;
    height: 24px;
    animation: b4eInlineSpin 1.2s linear infinite;
}

@keyframes b4eInlineSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.b4e-inline-loader span {
    font-size: 13px;
    color: #888ea8;
    font-family: 'Nunito', sans-serif;
}

/* ====================================================================
   DARK/LIGHT THEME COMPATIBILITY
   ==================================================================== */
body.dark #load_screen,
[data-bs-theme="dark"] #load_screen {
    background: linear-gradient(135deg, #0e1726 0%, #1a1c2e 50%, #0e1726 100%);
    animation: none;
}

body.dark #load_screen .b4e-loader-quote p,
[data-bs-theme="dark"] #load_screen .b4e-loader-quote p {
    color: rgba(255, 255, 255, 0.7);
    text-shadow: none;
    font-weight: 400;
}

body.dark #load_screen .b4e-loader-brand,
[data-bs-theme="dark"] #load_screen .b4e-loader-brand {
    color: rgba(255, 255, 255, 0.2);
    text-shadow: none;
    font-weight: 600;
}

body.dark #load_screen .b4e-loader-progress,
[data-bs-theme="dark"] #load_screen .b4e-loader-progress {
    background: rgba(255, 255, 255, 0.1);
}

body.light .b4e-section-loader .b4e-loader-quote p {
    color: rgba(0, 0, 0, 0.45);
}

/* Dark mode — section & inline loaders */
body.dark .b4e-section-loader {
    background: #0e1726;
    border-radius: 12px;
}
body.dark .b4e-section-loader .b4e-loader-quote p {
    color: #888ea8;
}
body.dark .b4e-section-loader .b4e-loader-progress {
    background: rgba(255, 255, 255, 0.08);
}
body.dark .b4e-inline-loader span {
    color: #bfc9d4;
}

/* Light mode — section loader bg */
body.light .b4e-section-loader {
    background: #f8fafc;
    border-radius: 12px;
}
body.light .b4e-inline-loader span {
    color: #64748b;
}

/* ====================================================================
   RESPONSIVE
   ==================================================================== */
@media (max-width: 576px) {
    .b4e-loader-logo-wrap {
        width: 90px;
        height: 90px;
        margin-bottom: 20px;
    }
    .b4e-loader-logo-wrap::before {
        width: 110px;
        height: 110px;
    }
    .b4e-loader-orbit {
        width: 110px;
        height: 110px;
    }
    .b4e-loader-logo {
        width: 60px;
        height: 60px;
    }
    .b4e-loader-progress {
        width: 160px;
    }
    .b4e-loader-quote {
        max-width: 300px;
    }
    .b4e-loader-quote p {
        font-size: 12px;
    }
}

@media (max-width: 360px) {
    .b4e-loader-logo-wrap {
        width: 70px;
        height: 70px;
    }
    .b4e-loader-logo-wrap::before {
        width: 90px;
        height: 90px;
    }
    .b4e-loader-orbit {
        width: 90px;
        height: 90px;
    }
    .b4e-loader-logo {
        width: 48px;
        height: 48px;
    }
    .b4e-loader-quote {
        max-width: 260px;
    }
}
