/* Loading Overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.25);
    /* พื้นหลังใสๆ */
    backdrop-filter: blur(8px);
    /* ทำให้พื้นหลังเบลอ */
    -webkit-backdrop-filter: blur(8px);
    /* รองรับ Safari */
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}


#loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Loading Container */
.loading-container {
    text-align: center;
    color: rgb(44, 44, 44);
}

/* Spinner Animation */
.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(43, 43, 43, 0.3);
    border-left: 4px solid #000000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Loading Text */
.loading-text {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 10px;
    animation: pulse 2s ease-in-out infinite;
}

.loading-subtext {
    font-size: 14px;
    opacity: 0.8;
    animation: fadeInOut 3s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

@keyframes fadeInOut {

    0%,
    100% {
        opacity: 0.8;
    }

    50% {
        opacity: 0.4;
    }
}

/* Alternative Dot Loading Animation */
.dots-loading {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 20px 0;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #007bff;
    /* เปลี่ยนเป็นสีน้ำเงิน */
    animation: dotBounce 1.4s ease-in-out infinite both;
}

.dot:nth-child(1) {
    animation-delay: -0.32s;
}

.dot:nth-child(2) {
    animation-delay: -0.16s;
}

.dot:nth-child(3) {
    animation-delay: 0s;
}

@keyframes dotBounce {

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

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .loading-text {
        font-size: 16px;
    }

    .loading-subtext {
        font-size: 12px;
    }

    .spinner {
        width: 50px;
        height: 50px;
    }
}