#page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 999999;
    opacity: 0;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

    #page-loader.visible {
        opacity: 1;
    }

    #page-loader.fade-out {
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    }

[data-bs-theme="dark"] #page-loader {
    background: #0a0a0a;
}

#page-loader::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 30%, rgba(234, 88, 12, 0.02) 0%, transparent 40%), radial-gradient(circle at 80% 70%, rgba(249, 115, 22, 0.02) 0%, transparent 40%), radial-gradient(circle at 50% 50%, rgba(55, 65, 81, 0.02) 0%, transparent 50%);
    animation: mesh-flow 20s ease-in-out infinite;
    pointer-events: none;
}

[data-bs-theme="dark"] #page-loader::before {
    background: radial-gradient(circle at 20% 30%, rgba(234, 88, 12, 0.06) 0%, transparent 40%), radial-gradient(circle at 80% 70%, rgba(249, 115, 22, 0.06) 0%, transparent 40%), radial-gradient(circle at 50% 50%, rgba(55, 65, 81, 0.04) 0%, transparent 50%);
}

@keyframes mesh-flow {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }

    33% {
        transform: translate(-10%, 10%) scale(1.05);
        opacity: 0.9;
    }

    66% {
        transform: translate(10%, -10%) scale(0.95);
        opacity: 0.95;
    }
}

#page-loader::after {
    content: '';
    position: absolute;
    width: 800px;
    height: 800px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(249, 115, 22, 0.03) 0%, transparent 70%);
    filter: blur(80px);
    animation: float-orb 12s ease-in-out infinite;
    pointer-events: none;
}

[data-bs-theme="dark"] #page-loader::after {
    background: radial-gradient(circle, rgba(249, 115, 22, 0.08) 0%, transparent 70%);
}

@keyframes float-orb {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }

    50% {
        transform: translate(-45%, -45%) scale(1.15);
        opacity: 0.8;
    }
}

.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4rem;
    position: relative;
    z-index: 2;
    animation: container-fade-in 1s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes container-fade-in {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.advanced-spinner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5em;
    font-size: 12px;
}

.spinner-ring {
    position: relative;
    width: 1em;
    height: 4em;
    background: linear-gradient(180deg, #374151, #1f2937);
    border-radius: 0.2em;
    animation: escaleY 1s infinite ease-in-out;
    animation-delay: -0.16s;
    box-shadow: 0 0 25px rgba(55, 65, 81, 0.3), 0 0 45px rgba(31, 41, 55, 0.2), inset 0 2px 8px rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .spinner-ring {
    box-shadow: 0 0 35px rgba(55, 65, 81, 0.5), 0 0 65px rgba(31, 41, 55, 0.3), inset 0 2px 8px rgba(255, 255, 255, 0.15);
}

.spinner-ring:nth-child(1) {
    animation-delay: -0.32s;
    background: linear-gradient(180deg, #ea580c, #c2410c);
}

[data-bs-theme="dark"] .spinner-ring:nth-child(1) {
    background: linear-gradient(180deg, #f97316, #ea580c);
}

.spinner-ring:nth-child(2) {
    animation-delay: -0.16s;
    background: linear-gradient(180deg, #4b5563, #374151);
}

[data-bs-theme="dark"] .spinner-ring:nth-child(2) {
    background: linear-gradient(180deg, #6b7280, #4b5563);
}

.spinner-ring:nth-child(3) {
    animation-delay: 0s;
    background: linear-gradient(180deg, #f97316, #ea580c);
}

[data-bs-theme="dark"] .spinner-ring:nth-child(3) {
    background: linear-gradient(180deg, #fb923c, #f97316);
}

@keyframes escaleY {
    0%, 80%, 100% {
        height: 4em;
        transform: scaleY(1);
    }

    40% {
        height: 5em;
        transform: scaleY(1.25);
        box-shadow: 0 -2em 35px rgba(249, 115, 22, 0.4), 0 0 50px rgba(234, 88, 12, 0.3), 0 0 70px rgba(55, 65, 81, 0.2);
    }
}

[data-bs-theme="dark"] @keyframes escaleY {
    0%, 80%, 100% {
        height: 4em;
        transform: scaleY(1);
    }

    40% {
        height: 5em;
        transform: scaleY(1.25);
        box-shadow: 0 -2em 45px rgba(249, 115, 22, 0.6), 0 0 70px rgba(234, 88, 12, 0.5), 0 0 90px rgba(55, 65, 81, 0.3);
    }
}

.spinner-orbit,
.orbit-dot,
.spinner-dot {
    display: none;
}

.loader-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.5), rgba(234, 88, 12, 0.3));
    box-shadow: 0 0 15px rgba(249, 115, 22, 0.4);
    animation: float-particle 18s ease-in-out infinite;
}

[data-bs-theme="dark"] .particle {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.7), rgba(234, 88, 12, 0.5));
    box-shadow: 0 0 20px rgba(249, 115, 22, 0.6);
}

.particle:nth-child(1) {
    left: 10%;
    width: 10px;
    height: 10px;
    animation-delay: 0s;
    animation-duration: 15s;
}

.particle:nth-child(2) {
    left: 25%;
    width: 8px;
    height: 8px;
    animation-delay: 2s;
    animation-duration: 17s;
}

.particle:nth-child(3) {
    left: 40%;
    width: 12px;
    height: 12px;
    animation-delay: 4s;
    animation-duration: 16s;
}

.particle:nth-child(4) {
    left: 55%;
    width: 9px;
    height: 9px;
    animation-delay: 1s;
    animation-duration: 18s;
}

.particle:nth-child(5) {
    left: 70%;
    width: 11px;
    height: 11px;
    animation-delay: 3s;
    animation-duration: 14s;
}

.particle:nth-child(6) {
    left: 85%;
    width: 10px;
    height: 10px;
    animation-delay: 5s;
    animation-duration: 19s;
}

.particle:nth-child(7) {
    left: 15%;
    width: 8px;
    height: 8px;
    animation-delay: 1.5s;
    animation-duration: 15s;
}

.particle:nth-child(8) {
    left: 30%;
    width: 13px;
    height: 13px;
    animation-delay: 3.5s;
    animation-duration: 17s;
}

.particle:nth-child(9) {
    left: 60%;
    width: 9px;
    height: 9px;
    animation-delay: 2.5s;
    animation-duration: 16s;
}

.particle:nth-child(10) {
    left: 75%;
    width: 10px;
    height: 10px;
    animation-delay: 4.5s;
    animation-duration: 18s;
}

.particle:nth-child(11) {
    left: 45%;
    width: 11px;
    height: 11px;
    animation-delay: 6s;
    animation-duration: 17s;
}

.particle:nth-child(12) {
    left: 90%;
    width: 9px;
    height: 9px;
    animation-delay: 5.5s;
    animation-duration: 15s;
}

@keyframes float-particle {
    0% {
        transform: translateY(100vh) translateX(0) scale(0) rotate(0deg);
        opacity: 0;
    }

    5% {
        opacity: 1;
    }

    95% {
        opacity: 1;
    }

    100% {
        transform: translateY(-10vh) translateX(var(--drift, 0)) scale(1.5) rotate(360deg);
        opacity: 0;
    }
}

.particle:nth-child(odd) {
    --drift: 60px;
}

.particle:nth-child(even) {
    --drift: -60px;
}

.loader-messages {
    color: #374151;
    font-size: 1.125rem;
    font-weight: 600;
    text-align: center;
    min-height: 32px;
    letter-spacing: 0.025em;
    padding: 0 2rem;
    max-width: 500px;
    animation: message-fade 0.6s ease-out;
    background: linear-gradient(135deg, #ea580c, #f97316, #374151);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-bs-theme="dark"] .loader-messages {
    color: #d1d5db;
    background: linear-gradient(135deg, #f97316, #fb923c, #9ca3af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes message-fade {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

body:not(.page-loaded) {
    overflow: hidden !important;
}

    body:not(.page-loaded) > *:not(#page-loader):not(script):not(style):not(link) {
        opacity: 0 !important;
        visibility: hidden !important;
    }

#loader-percentage {
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    margin-top: 1rem;
    animation: fade-in 0.3s ease-out;
}

[data-bs-theme="dark"] #loader-percentage {
    color: #9ca3af;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .advanced-spinner {
        font-size: 10px;
        gap: 1.2em;
    }

    .loader-messages {
        font-size: 1rem;
        padding: 0 1.5rem;
    }

    .loader-container {
        gap: 3rem;
    }
}

@media (max-width: 480px) {
    .advanced-spinner {
        font-size: 9px;
        gap: 1em;
    }

    .loader-messages {
        font-size: 0.95rem;
        padding: 0 1rem;
    }

    .loader-container {
        gap: 2.5rem;
    }

    .particle {
        width: 6px !important;
        height: 6px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    #page-loader::before,
    #page-loader::after,
    .spinner-ring,
    .particle,
    .loader-container {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

@media print {
    #page-loader {
        display: none !important;
    }
}
