﻿#main-preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #FBF8E7; /* cream background */
    background-image: url('../images/loading-bg.jpg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

#main-preloader.loaded {
    opacity: 0;
    visibility: hidden;
}

.preloader-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-container {
    width: 70px;
    height: 70px;
    background-color: #009B7C;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0, 155, 124, 0.3);
    margin-bottom: 32px;
    padding: 4px;
    position: relative;
}

@media screen and (max-width: 1380px) {
    .logo-container {
        width: 70px;
        height: 70px;
        padding: 4px;
    }
}

/* Outer ring */
.logo-container::after {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border: 6px solid rgba(0, 155, 124, 0.15);
    border-radius: 50%;
}

.logo-container::before {
    content: '';
    position: absolute;
    top: -24px;
    left: -24px;
    right: -24px;
    bottom: -24px;
    border: 1px solid rgba(0, 155, 124, 0.05);
    border-radius: 50%;
}

/* Style for DNN Logo inside */
.logo-container img {
    max-width: 100%;
    height: auto;
}

/* Fallbacks */
.logo-container span, .logo-container a {
    color: #fff;
    text-align: center;
    text-decoration: none;
}

/* Progress bar wrapper */
.progress-wrapper {
    position: relative;
    width: 400px;
    max-width: 90vw; /* Đảm bảo responsive trên mobile (chiếm tối đa 90% chiều rộng màn hình) */
    margin-bottom: 20px;
}

/* Progress bar container */
.progress-container {
    width: 100%;
    height: 16px;
    border-radius: 20px;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(0, 155, 124, 0.6);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1), 0 0 12px rgba(255, 230, 150, 0.6);
    position: relative;
    padding: 2px;
}

/* Progress logic */
.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #009B7C 0%, #00d2a7 100%);
    border-radius: 10px;
    transition: width 0.2s ease-out;
    position: relative;
    overflow: hidden;
}

/* Shimmer overlay class on bar */
.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        rgba(255,255,255, 0) 0%,
        rgba(255,255,255, 0.4) 50%,
        rgba(255,255,255, 0) 100%
    );
    background-size: 50px 100%;
    animation: shimmer 1.5s infinite linear;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(300%); }
}

.loading-text {
    font-family: inherit;
    color: #007960;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Coins Animation */
#coins-container {
    position: absolute;
    top: -40px;
    left: 0;
    width: 100%;
    height: 80px;
    pointer-events: none;
    z-index: 10;
    overflow: visible;
}

.coin {
    position: absolute;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle at 30% 30%, #FFFDE7 0%, #FFDF00 30%, #B8860B 100%);
    border-radius: 50%;
    border: 1px solid #DAA520;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.8), inset 0 2px 4px rgba(255,255,255,0.8);
    opacity: 0;
}
.coin::before {
    content: '₫';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #8B6508;
    font-weight: 900;
    font-size: 12px;
    text-shadow: 0 0 2px rgba(255,255,255,1);
}
.coin::after {
    content: '';
    position: absolute;
    top: 15%;
    left: 15%;
    width: 30%;
    height: 30%;
    background: white;
    border-radius: 50%;
    filter: blur(1px);
    animation: sparkle 0.6s infinite alternate;
}
            
@keyframes floatCoinBar {
    0% { transform: translateY(20px) scale(0.5) rotate(0deg); opacity: 0; }
    20% { opacity: 1; transform: translateY(10px) scale(1) rotate(45deg); box-shadow: 0 0 15px rgba(255, 215, 0, 1); }
    100% { transform: translateY(-50px) scale(0.5) rotate(180deg); opacity: 0; }
}