/**
 * Loader Styles
 * ==============
 * Preloader avec cube 3D animé
 */

.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-loader);
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

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

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xl);
}

/* === 3D CUBE === */
.loader-cube {
    width: 60px;
    height: 60px;
    position: relative;
    transform-style: preserve-3d;
    animation: cube-rotate 2s infinite linear;
}

.cube-face {
    position: absolute;
    width: 60px;
    height: 60px;
    border: 2px solid var(--accent-primary);
    background: var(--accent-alpha-10);
    backdrop-filter: blur(5px);
}

.cube-face.front {
    transform: translateZ(30px);
}

.cube-face.back {
    transform: translateZ(-30px) rotateY(180deg);
}

.cube-face.right {
    transform: rotateY(90deg) translateZ(30px);
}

.cube-face.left {
    transform: rotateY(-90deg) translateZ(30px);
}

.cube-face.top {
    transform: rotateX(90deg) translateZ(30px);
}

.cube-face.bottom {
    transform: rotateX(-90deg) translateZ(30px);
}

@keyframes cube-rotate {
    0% {
        transform: rotateX(0deg) rotateY(0deg);
    }

    100% {
        transform: rotateX(360deg) rotateY(360deg);
    }
}

/* === LOADER TEXT === */
.loader-text {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.loader-name {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: var(--accent-primary);
}

.loader-dots span {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: var(--accent-primary);
    animation: dot-bounce 1.4s infinite ease-in-out both;
}

.loader-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loader-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.loader-dots span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes dot-bounce {

    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: 0.5;
    }

    40% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* === PROGRESS BAR === */
.loader-bar {
    width: 200px;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.loader-progress {
    height: 100%;
    width: 0%;
    background: var(--accent-primary);
    border-radius: var(--radius-full);
    animation: loader-progress 1.5s ease-in-out forwards;
}

@keyframes loader-progress {
    0% {
        width: 0%;
    }

    50% {
        width: 70%;
    }

    100% {
        width: 100%;
    }
}