.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    z-index: 9999;
}

.overlay.active {
    visibility: visible;
    opacity: 1;
}

.dialog-box {
    background: white;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    width: clamp(300px, 80%, 400px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.5s ease-in-out;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(0, 0, 0, 0.1);
    border-top: 6px solid #958297;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 15px auto;
}

.dialog-text {
    width: 100%;
    color: #333;
    font-size: 18px;
    font-weight: 500;
    margin-top: 10px;
}

.message-box {
    background: white;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    width: 350px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.5s ease-in-out;
}

.message-box p {
    color: #333;
    font-size: 18px;
    font-weight: 500;
    margin: 10px 0;
}

.message-box button {
    background: #958297;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 10px;
    transition: background 0.3s;
}

.message-box button:hover {
    background: #B2A9B0;
}

#image-preview {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
