<div class="gallery-success-overlay">
    <div class="gallery-success-card">
        <div class="gallery-success-icon">
            <svg class="checkmark" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52">
                <circle class="checkmark-circle" cx="26" cy="26" r="25" fill="none"/>
                <path class="checkmark-check" fill="none" d="M14.1 27.2l7.1 7.2 16.7-16.8"/>
            </svg>
        </div>
        <h2>Upload Successful!</h2>
        <p>Your image has been uploaded successfully.</p>
        <div class="gallery-success-preview">
            <img src="<?php echo Config::get('URL'); ?>gallery/image/<?php echo $this->image->id; ?>/thumb"
                 alt="<?php echo htmlspecialchars($this->image->title); ?>">
        </div>
        <p class="gallery-success-title"><?php echo htmlspecialchars($this->image->title); ?></p>
        <p class="gallery-success-redirect">Redirecting to your image<span class="dots"></span></p>
    </div>
</div>

<style>
.gallery-success-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.98);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.gallery-success-card {
    text-align: center;
    padding: 40px;
    max-width: 400px;
    animation: slideUp 0.4s ease 0.1s both;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gallery-success-icon {
    margin-bottom: 24px;
}

.checkmark {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: block;
    stroke-width: 2;
    stroke: #4CAF50;
    stroke-miterlimit: 10;
    margin: 0 auto;
    box-shadow: inset 0px 0px 0px #4CAF50;
    animation: fill 0.4s ease-in-out 0.4s forwards, scale 0.3s ease-in-out 0.9s both;
}

.checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: #4CAF50;
    fill: none;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes stroke {
    100% { stroke-dashoffset: 0; }
}

@keyframes scale {
    0%, 100% { transform: none; }
    50% { transform: scale3d(1.1, 1.1, 1); }
}

@keyframes fill {
    100% { box-shadow: inset 0px 0px 0px 40px rgba(76, 175, 80, 0.1); }
}

.gallery-success-card h2 {
    margin: 0 0 8px;
    font-size: 28px;
    font-weight: 600;
    color: #333;
}

.gallery-success-card p {
    margin: 0;
    color: #666;
    font-size: 16px;
}

.gallery-success-preview {
    margin: 24px 0 16px;
    animation: previewFade 0.5s ease 0.6s both;
}

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

.gallery-success-preview img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    object-fit: cover;
}

.gallery-success-title {
    font-weight: 500;
    color: #333;
    margin-bottom: 24px !important;
}

.gallery-success-redirect {
    font-size: 14px !important;
    color: #999 !important;
    animation: pulse 1.5s ease infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
    100% { content: ''; }
}
</style>

<script>
setTimeout(function() {
    window.location.href = '<?php echo Config::get('URL'); ?>gallery/view/<?php echo $this->image->id; ?>';
}, 2500);
</script>
