<!-- KYC Bonus Modal -->
<div id="kycBonusModal" class="kyc-modal-overlay" style="display: none;">
    <div class="kyc-modal-container">
        <div class="kyc-modal-content">
            <!-- Close Button -->
            <button type="button" class="kyc-modal-close" onclick="closeKycBonusModal()">
                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                    <line x1="18" y1="6" x2="6" y2="18"></line>
                    <line x1="6" y1="6" x2="18" y2="18"></line>
                </svg>
            </button>

            <!-- Modal Header with Gift Animation -->
            <div class="kyc-modal-header">
                <div class="gift-icon-container">
                    <div class="dollar-icon">$50</div>
                </div>
                <h2 class="kyc-modal-title">Get Funded With $50 ICTP!</h2>
                <p class="kyc-modal-subtitle">Start with an initial $50 ICTP capital and scale your store to new heights</p>
            </div>

            <!-- Benefits List -->
            <div class="kyc-benefits-container">
                <div class="kyc-benefit-item">
                    <div class="benefit-icon money">
                        <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                            <line x1="12" y1="1" x2="12" y2="23"></line>
                            <path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"></path>
                        </svg>
                    </div>
                    <div class="benefit-text">
                        <h4>$50 ICTP Credit</h4>
                        <p>Instant trading capital added to your store upon KYC verification</p>
                    </div>
                </div>

                <div class="kyc-benefit-item">
                    <div class="benefit-icon growth">
                        <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                            <polyline points="23 6 13.5 15.5 8.5 10.5 1 18"></polyline>
                            <polyline points="17 6 23 6 23 12"></polyline>
                        </svg>
                    </div>
                    <div class="benefit-text">
                        <h4>Scale Your Store</h4>
                        <p>Grow your inventory and increase profits</p>
                    </div>
                </div>

                <div class="kyc-benefit-item">
                    <div class="benefit-icon unlock">
                        <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                            <rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect>
                            <path d="M7 11V7a5 5 0 0 1 9.9-1"></path>
                        </svg>
                    </div>
                    <div class="benefit-text">
                        <h4>Premium Access</h4>
                        <p>Unlock exclusive markets and AI features</p>
                    </div>
                </div>

                <div class="kyc-benefit-item">
                    <div class="benefit-icon shield">
                        <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                            <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"></path>
                        </svg>
                    </div>
                    <div class="benefit-text">
                        <h4>Secured Trading</h4>
                        <p>Enhanced security and trusted status</p>
                    </div>
                </div>
            </div>

            <!-- Steps Info -->
            <div class="kyc-steps-info">
                <h3 class="steps-title">Complete KYC to Get Funded</h3>
                <div class="steps-grid">
                    <div class="step-item">
                        <span class="step-number">1</span>
                        <p>Sign Up</p>
                    </div>
                    <div class="step-arrow">→</div>
                    <div class="step-item">
                        <span class="step-number">2</span>
                        <p>Verify KYC</p>
                    </div>
                    <div class="step-arrow">→</div>
                    <div class="step-item">
                        <span class="step-number">3</span>
                        <p>Get $50 ICTP</p>
                    </div>
                </div>
                <p class="steps-note">⚡ Verification takes less than 15 minutes</p>
            </div>

            <!-- CTA Buttons -->
            <div class="kyc-modal-footer">
                <a href="{{ route('register') }}" class="kyc-cta-button primary">
                    <svg class="button-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                        <path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>
                        <circle cx="8.5" cy="7" r="4"></circle>
                        <line x1="20" y1="8" x2="20" y2="14"></line>
                        <line x1="23" y1="11" x2="17" y2="11"></line>
                    </svg>
                    Claim My $50 ICTP Now
                </a>
                <button type="button" class="kyc-cta-button secondary" onclick="closeKycBonusModal()">
                    Maybe Later
                </button>
                <label class="kyc-dont-show">
                    <input type="checkbox" id="kycDontShowAgain" onchange="handleKycDontShowAgain()">
                    <span>Don't show this again</span>
                </label>
            </div>
        </div>
    </div>
</div>

<style>
/* KYC Modal Overlay */
.kyc-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: kycFadeIn 0.3s ease-in-out;
    backdrop-filter: blur(4px);
}

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

@keyframes kycSlideUp {
    from {
        transform: translateY(50px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* KYC Modal Container */
.kyc-modal-container {
    max-width: 550px;
    width: 100%;
    animation: kycSlideUp 0.4s ease-out;
}

/* KYC Modal Content */
.kyc-modal-content {
    background: white;
    border-radius: 1.25rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    overflow: hidden;
}

.dark .kyc-modal-content {
    background: #1e293b;
}

/* Close Button */
.kyc-modal-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.kyc-modal-close:hover {
    background: rgba(255, 255, 255, 1);
    transform: rotate(90deg) scale(1.1);
}

.kyc-modal-close svg {
    color: #660066;
}

/* Modal Header */
.kyc-modal-header {
    padding: 3rem 2rem 2rem;
    text-align: center;
    background: linear-gradient(135deg, #660066 0%, #8b008b 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.kyc-modal-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulseGlow 3s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* Dollar Icon */
.gift-icon-container {
    display: inline-block;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.dollar-icon {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 900;
    color: white;
    box-shadow: 0 8px 24px rgba(251, 191, 36, 0.4);
    animation: dollarPulse 2s ease-in-out infinite;
    position: relative;
}

.dollar-icon::before {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    opacity: 0.3;
    animation: dollarRing 2s ease-in-out infinite;
}

@keyframes dollarPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes dollarRing {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.2); opacity: 0; }
}

.kyc-modal-title {
    font-size: 2rem;
    font-weight: 800;
    margin: 0 0 0.75rem;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
}

.kyc-modal-subtitle {
    font-size: 1rem;
    opacity: 0.95;
    margin: 0;
    line-height: 1.6;
    max-width: 90%;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Benefits Container */
.kyc-benefits-container {
    padding: 2rem 1.5rem 1.5rem;
    background: #f8fafc;
}

.dark .kyc-benefits-container {
    background: #0f172a;
}

.kyc-benefit-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    margin-bottom: 1rem;
    background: white;
    border-radius: 0.75rem;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.kyc-benefit-item:last-child {
    margin-bottom: 0;
}

.kyc-benefit-item:hover {
    border-color: #660066;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(102, 0, 102, 0.15);
}

.dark .kyc-benefit-item {
    background: #334155;
}

/* Benefit Icon */
.benefit-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 1rem;
}

.benefit-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.benefit-icon.money {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.benefit-icon.growth {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.benefit-icon.unlock {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.benefit-icon.shield {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

/* Benefit Text */
.benefit-text h4 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    color: #1e293b;
}

.dark .benefit-text h4 {
    color: #f1f5f9;
}

.benefit-text p {
    font-size: 0.875rem;
    margin: 0;
    color: #64748b;
}

.dark .benefit-text p {
    color: #94a3b8;
}

/* Steps Info */
.kyc-steps-info {
    padding: 2rem 1.5rem;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.dark .kyc-steps-info {
    background: #1e293b;
    border-top-color: #475569;
}

.steps-title {
    text-align: center;
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 1.5rem;
    color: #1e293b;
}

.dark .steps-title {
    color: #f1f5f9;
}

.steps-grid {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.step-item {
    text-align: center;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #660066 0%, #8b008b 100%);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.step-item p {
    font-size: 0.875rem;
    color: #64748b;
    margin: 0;
    font-weight: 600;
}

.dark .step-item p {
    color: #94a3b8;
}

.step-arrow {
    color: #660066;
    font-size: 1.5rem;
    font-weight: 700;
}

.steps-note {
    text-align: center;
    font-size: 0.875rem;
    color: #059669;
    font-weight: 600;
    margin: 0;
    padding: 0.75rem;
    background: #d1fae5;
    border-radius: 0.5rem;
}

.dark .steps-note {
    background: #064e3b;
    color: #6ee7b7;
}

/* Modal Footer */
.kyc-modal-footer {
    padding: 1.5rem 2rem 2rem;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.dark .kyc-modal-footer {
    background: #1e293b;
    border-top-color: #475569;
}

/* CTA Buttons */
.kyc-cta-button {
    width: 100%;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 0.75rem;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    margin-bottom: 0.75rem;
}

.kyc-cta-button.primary {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(249, 115, 22, 0.4);
    animation: ctaPulse 2s ease-in-out infinite;
}

@keyframes ctaPulse {
    0%, 100% { box-shadow: 0 4px 14px rgba(249, 115, 22, 0.4); }
    50% { box-shadow: 0 6px 20px rgba(249, 115, 22, 0.6); }
}

.kyc-cta-button.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.5);
    animation: none;
}

.kyc-cta-button.secondary {
    background: #f1f5f9;
    color: #475569;
}

.kyc-cta-button.secondary:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.dark .kyc-cta-button.secondary {
    background: #334155;
    color: #cbd5e1;
}

.dark .kyc-cta-button.secondary:hover {
    background: #475569;
    color: #f1f5f9;
}

.button-icon {
    width: 20px;
    height: 20px;
}

/* Don't Show Again */
.kyc-dont-show {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    margin-top: 0.5rem;
}

.kyc-dont-show input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 0.5rem;
    cursor: pointer;
    accent-color: #660066;
}

.kyc-dont-show span {
    font-size: 0.875rem;
    color: #64748b;
}

.dark .kyc-dont-show span {
    color: #94a3b8;
}

/* Responsive */
@media (max-width: 640px) {
    .kyc-modal-overlay {
        padding: 10px;
        align-items: flex-start;
        overflow-y: auto;
    }

    .kyc-modal-container {
        margin: 20px 0;
    }

    .kyc-modal-header {
        padding: 2.5rem 1.5rem 1.5rem;
    }

    .dollar-icon {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }

    .kyc-modal-title {
        font-size: 1.75rem;
    }

    .kyc-modal-subtitle {
        font-size: 0.9rem;
    }

    .kyc-benefits-container {
        padding: 1.5rem 1rem;
    }

    .kyc-benefit-item {
        padding: 0.875rem;
        margin-bottom: 0.75rem;
    }

    .benefit-icon {
        width: 45px;
        height: 45px;
    }

    .benefit-text h4 {
        font-size: 1rem;
    }

    .kyc-steps-info {
        padding: 1.5rem 1rem;
    }

    .steps-grid {
        gap: 0.4rem;
    }

    .step-number {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .step-arrow {
        font-size: 1.2rem;
    }

    .steps-note {
        font-size: 0.8rem;
    }

    .kyc-modal-footer {
        padding: 1rem 1.5rem 1.5rem;
    }

    .kyc-cta-button {
        padding: 0.875rem 1.25rem;
        font-size: 1rem;
    }
}
</style>

<script>
// KYC Bonus Modal functionality
function openKycBonusModal() {
    const modal = document.getElementById('kycBonusModal');
    if (modal) {
        modal.style.display = 'flex';
        document.body.style.overflow = 'hidden';
    }
}

function closeKycBonusModal() {
    const modal = document.getElementById('kycBonusModal');
    if (modal) {
        modal.style.display = 'none';
        document.body.style.overflow = '';
    }
}

function handleKycDontShowAgain() {
    const checkbox = document.getElementById('kycDontShowAgain');
    if (checkbox && checkbox.checked) {
        localStorage.setItem('kycBonusModalDismissed', 'true');
    } else {
        localStorage.removeItem('kycBonusModalDismissed');
    }
}

// Close modal when clicking outside
document.addEventListener('click', function(event) {
    const modal = document.getElementById('kycBonusModal');
    if (modal && event.target === modal) {
        closeKycBonusModal();
    }
});

// Close modal with Escape key
document.addEventListener('keydown', function(event) {
    if (event.key === 'Escape') {
        const kycModal = document.getElementById('kycBonusModal');
        if (kycModal && kycModal.style.display === 'flex') {
            closeKycBonusModal();
        }
    }
});

// Auto-show modal for non-authenticated users
document.addEventListener('DOMContentLoaded', function() {
    const isDismissed = localStorage.getItem('kycBonusModalDismissed');
    
    // Check if user is not authenticated
    const isAuthenticated = {{ auth()->check() ? 'true' : 'false' }};
    
    if (!isDismissed && !isAuthenticated) {
        // Show modal after 5 seconds
        setTimeout(function() {
            openKycBonusModal();
        }, 5000);
    }
});
</script>