/* =========================================
   Modern Loader CSS — ЭВОЛЮЦИЯ
   ========================================= */

/* ---- Backgrounds ---- */
.modern-preloader-bg {
    background: radial-gradient(ellipse at 30% 40%, #0d2137 0%, #020c1b 70%) !important;
    z-index: 9998 !important;
}

.modern-preloader {
    background: transparent !important;
    z-index: 9999 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', 'Roboto', sans-serif;
    perspective: 1200px;
    overflow: hidden;
}

/* Tech-grid overlay — sci-fi feel */
.modern-preloader::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(0deg, rgba(59,130,246,0.025) 0px, transparent 1px, transparent 60px),
        repeating-linear-gradient(90deg, rgba(59,130,246,0.025) 0px, transparent 1px, transparent 60px);
    pointer-events: none;
    z-index: 0;
    animation: grid-drift 20s linear infinite;
}

/* Hide old bg styles */
.preloader.preloader-img,
.preloader.preloader12,
.preloader.preloader5 {
    background-image: none !important;
    background-color: transparent !important;
}

/* ---- Floating Orbs ---- */
.loader-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
    z-index: 0;
    animation: orb-float linear infinite;
    opacity: 0;
}

.loader-orb-1 {
    width: 380px; height: 380px;
    background: radial-gradient(circle, rgba(59,130,246,0.18) 0%, transparent 70%);
    top: -80px; left: -100px;
    animation: orb-float 18s ease-in-out infinite;
}

.loader-orb-2 {
    width: 280px; height: 280px;
    background: radial-gradient(circle, rgba(16,185,129,0.2) 0%, transparent 70%);
    bottom: -60px; right: -60px;
    animation: orb-float 14s ease-in-out infinite reverse;
    animation-delay: -4s;
}

.loader-orb-3 {
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(99,102,241,0.15) 0%, transparent 70%);
    top: 40%; left: 60%;
    animation: orb-drift 22s ease-in-out infinite;
    animation-delay: -8s;
}

/* ---- Main Container ---- */
.modern-loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 580px;
    padding: 20px 30px;
    position: relative;
    z-index: 2;
    transform-style: preserve-3d;
    transition: transform 0.12s ease-out;
}

/* ---- Visual Core ---- */
.loader-visual {
    position: relative;
    width: 130px;
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 36px;
}

.loader-core {
    font-size: 68px;
    position: absolute;
    z-index: 3;
    animation: core-float 3.2s ease-in-out infinite;
    filter: drop-shadow(0 0 16px rgba(16, 185, 129, 0.65));
    transition: filter 0.4s ease, transform 0.4s ease;
}

/* Milestone flash on the core */
.loader-core.milestone-flash {
    animation: core-float 3.2s ease-in-out infinite, milestone-burst 0.6s ease-out;
}

.loader-pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(59, 130, 246, 0.5);
    animation: ring-pulse 2.2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    transition: border-color 0.4s ease;
}

.loader-pulse-ring.milestone-ring {
    border-color: rgba(16, 185, 129, 0.9) !important;
    animation: ring-pulse 2.2s cubic-bezier(0.4, 0, 0.6, 1) infinite, milestone-ring-burst 0.7s ease-out;
}

.loader-pulse-ring::before {
    content: '';
    position: absolute;
    top: -14px; left: -14px; right: -14px; bottom: -14px;
    border-radius: 50%;
    border: 1px dashed rgba(16, 185, 129, 0.25);
    animation: ring-spin 12s linear infinite;
}

.loader-pulse-ring::after {
    content: '';
    position: absolute;
    top: 12px; left: 12px; right: 12px; bottom: 12px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: rgba(59, 130, 246, 0.85);
    border-bottom-color: rgba(16, 185, 129, 0.85);
    animation: ring-spin-reverse 4.5s linear infinite;
}

/* ---- Text Content ---- */
.loader-content {
    text-align: center;
    width: 100%;
    position: relative;
    z-index: 2;
}

.loader-title {
    font-size: 30px;
    font-weight: 900;
    letter-spacing: 6px;
    margin: 0 0 12px 0;
    text-transform: uppercase;
    background: linear-gradient(135deg, #3b82f6 0%, #10b981 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: title-glow 3s ease-in-out infinite alternate;
}

.loader-tips {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 28px;
    min-height: 20px;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    transition: opacity 0.3s ease;
}

/* ---- Progress Area ---- */
.loader-progress-wrapper {
    width: 100%;
    height: 6px;
    background: rgba(15, 23, 42, 0.9);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.6);
    overflow: hidden;
    position: relative;
    margin-bottom: 10px;
}

.modern-progress-bar {
    height: 100%;
    width: 0%;
    border-radius: 10px;
    background: linear-gradient(90deg, #1d4ed8, #3b82f6, #10b981);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.6);
    transition: width 0.15s linear, background 0.4s ease, box-shadow 0.4s ease;
    position: relative;
    overflow: hidden;
}

.modern-progress-bar::after {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 60px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    animation: progress-shine 1.8s linear infinite;
}

/* Milestone states */
.modern-progress-bar.milestone-25 {
    background: linear-gradient(90deg, #1d4ed8, #3b82f6, #6366f1);
    box-shadow: 0 0 18px rgba(99, 102, 241, 0.7);
}
.modern-progress-bar.milestone-50 {
    background: linear-gradient(90deg, #1d4ed8, #10b981, #06b6d4);
    box-shadow: 0 0 18px rgba(6, 182, 212, 0.7);
}
.modern-progress-bar.milestone-75 {
    background: linear-gradient(90deg, #10b981, #34d399, #6ee7b7);
    box-shadow: 0 0 20px rgba(52, 211, 153, 0.8);
}
.modern-progress-bar.milestone-100 {
    background: linear-gradient(90deg, #10b981, #059669);
    box-shadow: 0 0 24px rgba(16, 185, 129, 1);
}

.loader-percentage {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #475569;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-weight: bold;
    letter-spacing: 1px;
}
.loader-percent-value {
    color: #94a3b8;
    font-size: 13px;
}

/* ---- Version Label ---- */
.loader-version {
    position: fixed;
    bottom: 18px;
    right: 24px;
    font-size: 11px;
    color: rgba(71, 85, 105, 0.7);
    font-family: 'Fira Code', monospace;
    letter-spacing: 1px;
    z-index: 10001;
    pointer-events: none;
}

/* ---- Animations ---- */
@keyframes core-float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.06); filter: drop-shadow(0 0 28px rgba(16, 185, 129, 0.9)); }
}

@keyframes ring-pulse {
    0%   { transform: scale(0.82); opacity: 0.45; }
    50%  { transform: scale(1.12); opacity: 1; }
    100% { transform: scale(0.82); opacity: 0.45; }
}

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

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

@keyframes progress-shine {
    0%   { transform: translateX(-100px); }
    100% { transform: translateX(calc(var(--bar-width, 400px) + 100px)); }
}

@keyframes title-glow {
    0%   { filter: drop-shadow(0 0 3px rgba(59, 130, 246, 0.3)); }
    100% { filter: drop-shadow(0 0 12px rgba(16, 185, 129, 0.7)); }
}

@keyframes orb-float {
    0%   { transform: translate(0, 0) scale(1); opacity: 1; }
    33%  { transform: translate(30px, -40px) scale(1.05); }
    66%  { transform: translate(-20px, 20px) scale(0.95); }
    100% { transform: translate(0, 0) scale(1); opacity: 1; }
}

@keyframes orb-drift {
    0%   { transform: translate(0, 0); opacity: 0.8; }
    50%  { transform: translate(-60px, 30px); opacity: 1; }
    100% { transform: translate(0, 0); opacity: 0.8; }
}

@keyframes grid-drift {
    0%   { background-position: 0 0; }
    100% { background-position: 60px 60px; }
}

@keyframes milestone-burst {
    0%   { transform: scale(1); filter: drop-shadow(0 0 16px rgba(16,185,129,0.65)); }
    30%  { transform: scale(1.25); filter: drop-shadow(0 0 40px rgba(16,185,129,1)); }
    100% { transform: scale(1); filter: drop-shadow(0 0 16px rgba(16,185,129,0.65)); }
}

@keyframes milestone-ring-burst {
    0%   { transform: scale(1) ; opacity: 1; }
    50%  { transform: scale(1.4); opacity: 0.3; }
    100% { transform: scale(1);  opacity: 1; }
}

/* ---- Mobile ---- */
@media screen and (max-width: 768px) {
    .modern-loader-container { padding: 16px; width: 88%; max-width: 100%; }
    .loader-title { font-size: 22px; letter-spacing: 4px; }
    .loader-visual { width: 90px; height: 90px; margin-bottom: 22px; }
    .loader-core { font-size: 44px; }
    .loader-tips { font-size: 11px; }
    .loader-version { font-size: 10px; bottom: 12px; right: 14px; }
    .loader-orb-1 { width: 200px; height: 200px; }
    .loader-orb-2 { width: 160px; height: 160px; }
    .loader-orb-3 { display: none; }
}
