

<?php $__env->startSection('meta_title', 'Sınav Sonucu - ' . $category->name); ?>

<?php $__env->startSection('content'); ?>
<?php
    $pct    = $result['total_questions'] > 0 ? round($result['correct_answers'] / $result['total_questions'] * 100) : 0;
    $passed = $pct >= 70;
    $timeMin = floor($result['time_spent'] / 60);
    $timeSec = $result['time_spent'] % 60;
?>
<style>
    .result-hero {
        text-align: center;
        padding: 40px 32px;
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 16px;
        margin-bottom: 28px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }
    .result-emoji { font-size: 64px; margin-bottom: 16px; display: block; }
    .result-title { font-size: 28px; font-weight: 800; color: #111827; margin-bottom: 8px; }
    .result-subtitle { font-size: 16px; color: #6b7280; margin-bottom: 24px; }

    .score-circle {
        width: 140px; height: 140px;
        border-radius: 50%;
        display: flex; align-items: center; justify-content: center; flex-direction: column;
        margin: 0 auto 24px;
        border: 8px solid;
        border-color: <?php echo e($passed ? '#16a34a' : '#dc2626'); ?>;
        background: <?php echo e($passed ? '#f0fdf4' : '#fef2f2'); ?>;
    }
    .score-pct { font-size: 36px; font-weight: 900; color: <?php echo e($passed ? '#16a34a' : '#dc2626'); ?>; line-height: 1; }
    .score-label { font-size: 13px; color: #6b7280; }

    .result-stats {
        display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 28px;
    }
    @media (max-width: 600px) { .result-stats { grid-template-columns: repeat(2, 1fr); } }
    .stat-box {
        background: white; border: 1px solid #e5e7eb;
        border-radius: 12px; padding: 20px; text-align: center;
    }
    .stat-val { font-size: 28px; font-weight: 800; color: #111827; display: block; }
    .stat-lbl { font-size: 13px; color: #6b7280; }

    /* ─── Register CTA ─── */
    .register-cta {
        background: linear-gradient(135deg, #1e40af 0%, #7c3aed 100%);
        color: white;
        border-radius: 16px;
        padding: 36px 32px;
        text-align: center;
        margin-bottom: 28px;
    }
    .register-cta h2 { font-size: 24px; font-weight: 800; margin-bottom: 10px; }
    .register-cta p  { font-size: 15px; opacity: 0.9; margin-bottom: 24px; }
    .register-cta-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
    .btn-register-cta {
        background: white; color: #1e40af; font-weight: 700; padding: 13px 28px;
        border-radius: 10px; text-decoration: none; font-size: 15px; transition: all 0.2s;
    }
    .btn-register-cta:hover { background: #eff6ff; }
    .btn-login-cta {
        background: transparent; border: 2px solid rgba(255,255,255,0.6); color: white;
        font-weight: 600; padding: 12px 26px; border-radius: 10px; text-decoration: none;
        font-size: 15px; transition: all 0.2s;
    }
    .btn-login-cta:hover { border-color: white; background: rgba(255,255,255,0.1); }

    .answers-section { margin-bottom: 32px; }
    .answers-title { font-size: 18px; font-weight: 700; color: #111827; margin-bottom: 16px; }
    .answer-card {
        background: white; border: 1px solid #e5e7eb;
        border-radius: 12px; padding: 20px; margin-bottom: 14px;
    }
    .answer-card.correct { border-color: #bbf7d0; background: #f0fdf4; }
    .answer-card.wrong   { border-color: #fecaca; background: #fef2f2; }
    .answer-status { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
    .answer-status.ok  { color: #16a34a; }
    .answer-status.err { color: #dc2626; }
    .answer-question { font-size: 15px; font-weight: 600; color: #111827; margin-bottom: 12px; line-height: 1.5; }
    .answer-options { font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
    .opt { padding: 8px 12px; border-radius: 8px; }
    .opt.correct-opt { background: #dcfce7; color: #16a34a; font-weight: 600; }
    .opt.wrong-opt   { background: #fee2e2; color: #dc2626; font-weight: 600; }
    .opt.neutral     { background: #f3f4f6; color: #6b7280; }
    .explanation {
        margin-top: 12px; padding: 10px 14px;
        background: #fffbeb; border-left: 3px solid #f59e0b;
        font-size: 14px; color: #92400e; border-radius: 0 6px 6px 0;
    }
</style>


<div class="result-hero">
    <span class="result-emoji"><?php echo e($passed ? '🎉' : '💪'); ?></span>
    <div class="result-title"><?php echo e($passed ? 'Tebrikler! Sınavı Geçtiniz!' : 'Tekrar Deneyin!'); ?></div>
    <div class="result-subtitle"><?php echo e($category->name); ?></div>
    <div class="score-circle">
        <span class="score-pct">%<?php echo e($pct); ?></span>
        <span class="score-label"><?php echo e($passed ? 'Geçti' : 'Kaldı'); ?></span>
    </div>
    <p style="color:#6b7280;font-size:14px;margin-bottom:0;">
        <?php echo e($result['correct_answers']); ?> / <?php echo e($result['total_questions']); ?> doğru
        &nbsp;·&nbsp;
        <?php echo e($timeMin); ?>:<?php echo e(str_pad($timeSec, 2, '0', STR_PAD_LEFT)); ?> süre
    </p>
</div>


<div class="result-stats">
    <div class="stat-box">
        <span class="stat-val" style="color:#16a34a"><?php echo e($result['correct_answers']); ?></span>
        <span class="stat-lbl">Doğru</span>
    </div>
    <div class="stat-box">
        <span class="stat-val" style="color:#dc2626"><?php echo e($result['total_questions'] - $result['correct_answers']); ?></span>
        <span class="stat-lbl">Yanlış</span>
    </div>
    <div class="stat-box">
        <span class="stat-val"><?php echo e($timeMin); ?>:<?php echo e(str_pad($timeSec, 2, '0', STR_PAD_LEFT)); ?></span>
        <span class="stat-lbl">Süre</span>
    </div>
</div>


<div class="register-cta">
    <h2>🎖️ Daha fazla sınav çözmek ister misiniz?</h2>
    <p>Ücretsiz üye olun ve tüm kategorilerde sınırsız sınav çözün, ilerlemenizi takip edin, sıralamalarda yerinizi alın!</p>
    <div class="register-cta-btns">
        <a href="<?php echo e(route('register')); ?>" class="btn-register-cta">
            🚀 Ücretsiz Üye Ol
        </a>
        <a href="<?php echo e(route('login')); ?>" class="btn-login-cta">
            Giriş Yap
        </a>
    </div>
</div>


<?php if(count($detailedAnswers) > 0): ?>
<div class="answers-section">
    <h3 class="answers-title">📋 Cevap Detayları</h3>
    <?php $__currentLoopData = $detailedAnswers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $i => $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <div class="answer-card <?php echo e($item['is_correct'] ? 'correct' : 'wrong'); ?>">
            <div class="answer-status <?php echo e($item['is_correct'] ? 'ok' : 'err'); ?>">
                <?php echo e($item['is_correct'] ? '✓ Doğru' : '✗ Yanlış'); ?>

                · Soru <?php echo e($i + 1); ?>

            </div>
            <div class="answer-question"><?php echo e($item['question']->question); ?></div>
            <?php
                $options = is_array($item['question']->options)
                    ? $item['question']->options
                    : json_decode($item['question']->options ?? '[]', true);
            ?>
            <?php if($options): ?>
                <div class="answer-options">
                    <?php $__currentLoopData = $options; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $opt): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <?php
                            $isCorrect  = ($key === $item['correct']);
                            $isSelected = ($key === $item['selected']);
                        ?>
                        <div class="opt <?php echo e($isCorrect ? 'correct-opt' : ($isSelected && !$isCorrect ? 'wrong-opt' : 'neutral')); ?>">
                            <?php echo e(strtoupper($key)); ?>. <?php echo e($opt); ?>

                            <?php if($isCorrect): ?> ✓ <?php endif; ?>
                            <?php if($isSelected && !$isCorrect): ?> ✗ <?php endif; ?>
                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
            <?php endif; ?>
            <?php if($item['question']->explanation ?? null): ?>
                <div class="explanation">
                    💡 <strong>Açıklama:</strong> <?php echo e($item['question']->explanation); ?>

                </div>
            <?php endif; ?>
        </div>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>
<?php endif; ?>


<div style="text-align:center;padding:24px;background:white;border:1px solid #e5e7eb;border-radius:12px;">
    <p style="font-size:15px;color:#374151;margin-bottom:16px;">
        Bu sınav deneme hakkınızdı. Daha fazlası için üye olun!
    </p>
    <div style="display:flex;gap:12px;justify-content:center;flex-wrap:wrap;">
        <a href="<?php echo e(route('register')); ?>" style="background:#1e40af;color:white;padding:11px 24px;border-radius:8px;text-decoration:none;font-weight:600;font-size:14px;">
            Ücretsiz Üye Ol
        </a>
        <a href="<?php echo e(route('interview.index')); ?>" style="background:#f3f4f6;color:#374151;padding:11px 24px;border-radius:8px;text-decoration:none;font-weight:600;font-size:14px;">
            Mülakata Dön
        </a>
    </div>
</div>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.public', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\askeribilgiler\resources\views\interview\guest-result.blade.php ENDPATH**/ ?>