/* === HMK LOADER STYLES === */
#hmk-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0f1a 0%, #1a1f2e 50%, #0a0f1a 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

#hmk-loader.fade-out {
    opacity: 0;
    visibility: hidden;
}

/* Container principal du loader */
.loader-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Logo HMK au centre */
.loader-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120px;
    height: 120px;
    transform: translate(-50%, -50%);
    z-index: 3;
}

.loader-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(1.2) drop-shadow(0 0 20px rgba(0, 224, 255, 0.5));
    animation: logoFloat 3s ease-in-out infinite;
}

/* Animation de flottement du logo */
@keyframes logoFloat {

    0%,
    100% {
        transform: translateY(0px) scale(1);
        filter: brightness(1.2) drop-shadow(0 0 20px rgba(0, 224, 255, 0.5));
    }

    50% {
        transform: translateY(-10px) scale(1.05);
        filter: brightness(1.4) drop-shadow(0 0 30px rgba(0, 224, 255, 0.8));
    }
}

/* Cercle animé autour du logo */
.loader-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 180px;
    height: 180px;
    border: 3px solid transparent;
    border-top: 3px solid #00E0FF;
    border-right: 3px solid rgba(0, 224, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: circleRotate 2s linear infinite;
    z-index: 2;
}

.loader-circle::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border: 2px solid transparent;
    border-bottom: 2px solid #0099CC;
    border-left: 2px solid rgba(0, 153, 204, 0.3);
    border-radius: 50%;
    animation: circleRotateReverse 3s linear infinite;
}

@keyframes circleRotate {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

@keyframes circleRotateReverse {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(-360deg);
    }
}

/* Halo lumineux */
.loader-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(0, 224, 255, 0.2) 0%, rgba(0, 224, 255, 0.1) 30%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: glowPulse 2.5s ease-in-out infinite;
    z-index: 1;
}

@keyframes glowPulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
}

/* Particules animées */
.loader-particles {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300px;
    height: 300px;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #00E0FF;
    border-radius: 50%;
    opacity: 0;
    animation: particleFloat 4s ease-in-out infinite;
}

.particle:nth-child(1) {
    top: 20%;
    left: 30%;
    animation-delay: 0s;
}

.particle:nth-child(2) {
    top: 70%;
    left: 80%;
    animation-delay: 0.5s;
}

.particle:nth-child(3) {
    top: 40%;
    left: 10%;
    animation-delay: 1s;
}

.particle:nth-child(4) {
    top: 80%;
    left: 40%;
    animation-delay: 1.5s;
}

.particle:nth-child(5) {
    top: 10%;
    left: 70%;
    animation-delay: 2s;
}

.particle:nth-child(6) {
    top: 60%;
    left: 20%;
    animation-delay: 2.5s;
}

@keyframes particleFloat {
    0% {
        opacity: 0;
        transform: translateY(0px) scale(0.5);
    }

    20% {
        opacity: 1;
        transform: translateY(-20px) scale(1);
    }

    80% {
        opacity: 1;
        transform: translateY(-40px) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0.5);
    }
}

/* Texte de chargement */
.loader-text {
    color: #ffffff;
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
    margin-top: 150px;
    opacity: 0.8;
    animation: textPulse 2s ease-in-out infinite;
}

@keyframes textPulse {

    0%,
    100% {
        opacity: 0.6;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.02);
    }
}

/* Points animés après le texte */
.loading-dots {
    display: inline-block;
    margin-left: 5px;
}

.loading-dots span {
    display: inline-block;
    width: 4px;
    height: 4px;
    background: #00E0FF;
    border-radius: 50%;
    margin: 0 2px;
    animation: dotBounce 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes dotBounce {

    0%,
    80%,
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Barre de progression stylisée */
.loader-progress {
    width: 200px;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 15px;
    overflow: hidden;
    position: relative;
}

.loader-progress::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, #00E0FF, transparent);
    animation: progressSlide 2s ease-in-out infinite;
}

@keyframes progressSlide {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

/* Effet de morphing sur le container */
.loader-container {
    animation: containerMorph 6s ease-in-out infinite;
}

@keyframes containerMorph {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    25% {
        transform: scale(1.02) rotate(0.5deg);
    }

    50% {
        transform: scale(0.98) rotate(0deg);
    }

    75% {
        transform: scale(1.01) rotate(-0.5deg);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .loader-logo {
        width: 100px;
        height: 100px;
    }

    .loader-circle {
        width: 150px;
        height: 150px;
    }

    .loader-glow {
        width: 200px;
        height: 200px;
    }

    .loader-particles {
        width: 250px;
        height: 250px;
    }

    .loader-text {
        font-size: 1rem;
        margin-top: 120px;
    }

    .loader-progress {
        width: 150px;
    }
}

@media (max-width: 480px) {
    .loader-logo {
        width: 80px;
        height: 80px;
    }

    .loader-circle {
        width: 120px;
        height: 120px;
    }

    .loader-glow {
        width: 160px;
        height: 160px;
    }

    .loader-particles {
        width: 200px;
        height: 200px;
    }

    .loader-text {
        font-size: 0.9rem;
        margin-top: 100px;
    }

    .loader-progress {
        width: 120px;
    }
}

/* Accessibilité */
@media (prefers-reduced-motion: reduce) {
    #hmk-loader * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Masquer pour les lecteurs d'écran */
#hmk-loader {
    aria-hidden: true;
}