/* Preloader styles */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap');

.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #111111;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    overflow: hidden;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.preloader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.preloader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80%;
    max-width: 500px;
    position: relative;
    z-index: 2;
}

.preloader-logo {
    margin-bottom: 30px;
    animation: pulse 2s infinite alternate;
    position: relative;
}

.preloader-logo img {
    width: 180px;
    height: auto;
    filter: drop-shadow(0 0 15px rgba(212, 175, 55, 0.5));
}

/* Icon styling */
.icon-container {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(212, 175, 55, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 15px 0;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
    position: relative;
    overflow: hidden;
}

.icon-container::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: linear-gradient(45deg, transparent, rgba(212, 175, 55, 0.3), transparent);
    animation: rotateGradient 3s linear infinite;
    z-index: 0;
    border-radius: 50%;
}

.top-icon {
    animation: floatUpDown 3s ease-in-out infinite, glowEffect 2s ease-in-out infinite alternate;
}

.bottom-icon {
    animation: floatSideways 4s ease-in-out infinite, glowEffect 2s ease-in-out infinite alternate-reverse;
}

.icon-container i {
    font-size: 28px;
    color: #d4af37;
    position: relative;
    z-index: 1;
    animation: spin 10s linear infinite;
}

/* Loading message */
.loading-message {
    margin: 15px 0;
    text-align: center;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 1.1em;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.7);
    padding: 16px 25px;
    border-radius: 5px;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.2);
    animation: messageGlow 3s infinite alternate;
    position: relative;
    overflow: hidden;
    max-width: 320px;
    letter-spacing: 0.5px;
}

.loading-message::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(212, 175, 55, 0.05),
        transparent
    );
    transform: rotate(45deg);
    animation: shimmerEffect 3s linear infinite;
}

/* Progress bar */
.loading-progress {
    width: 100%;
    margin-top: 30px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
    position: relative;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #d4af37, #ffd700);
    border-radius: 4px;
    position: relative;
    transition: width 0.3s ease-out;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: progressShimmer 1.5s infinite;
}

.progress-text {
    margin-top: 15px;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    color: #d4af37;
    font-size: 1.2em;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
    animation: numberPulse 1s infinite alternate;
}

/* Gold dust particles */
.dust-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.dust-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle, rgba(212, 175, 55, 0.2) 1px, transparent 1px),
        radial-gradient(circle, rgba(212, 175, 55, 0.15) 1px, transparent 1px),
        radial-gradient(circle, rgba(212, 175, 55, 0.1) 2px, transparent 2px);
    background-size: 25px 25px, 15px 15px, 40px 40px;
    animation: dustMove 20s linear infinite;
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes rotateGradient {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes shimmerEffect {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

@keyframes progressShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes numberPulse {
    0% { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(1.1); opacity: 1; }
}

@keyframes dustMove {
    0% { 
        background-position: 0% 0%, 0% 0%, 0% 0%;
        opacity: 0.5;
    }
    25% {
        opacity: 0.7;
    }
    50% {
        background-position: 100% 100%, 50% 50%, 70% 30%;
        opacity: 0.8;
    }
    75% {
        opacity: 0.6;
    }
    100% { 
        background-position: 0% 0%, 0% 0%, 0% 0%;
        opacity: 0.5;
    }
}

@keyframes floatUpDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

@keyframes floatSideways {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(15px); }
}

@keyframes glowEffect {
    0% { box-shadow: 0 0 5px rgba(212, 175, 55, 0.3); }
    100% { box-shadow: 0 0 20px rgba(212, 175, 55, 0.7); }
}

@keyframes messageGlow {
    0% { box-shadow: 0 0 10px rgba(212, 175, 55, 0.2); }
    100% { box-shadow: 0 0 25px rgba(212, 175, 55, 0.4); }
}

/* Additional particle effects */
.preloader::before,
.preloader::after {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(20px);
    animation: particleFloat 15s infinite ease-in-out;
    z-index: 1;
}

.preloader::before {
    top: 20%;
    left: 20%;
    animation-delay: 1s;
}

.preloader::after {
    bottom: 20%;
    right: 20%;
    width: 300px;
    height: 300px;
    animation-delay: 2s;
}

@keyframes particleFloat {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(50px, -30px); }
    50% { transform: translate(100px, 50px); }
    75% { transform: translate(50px, 100px); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .preloader-logo img {
        width: 150px;
    }
    
    .icon-container {
        width: 60px;
        height: 60px;
    }
    
    .icon-container i {
        font-size: 24px;
    }
    
    .loading-message {
        font-size: 1em;
        padding: 12px 20px;
    }
}

@media (max-width: 480px) {
    .preloader-content {
        width: 90%;
    }
    
    .preloader-logo img {
        width: 120px;
    }
    
    .icon-container {
        width: 50px;
        height: 50px;
        margin: 10px 0;
    }
    
    .icon-container i {
        font-size: 20px;
    }
    
    .loading-message {
        font-size: 0.9em;
        padding: 10px 15px;
        max-width: 280px;
    }
    
    .progress-text {
        font-size: 1em;
    }
}