

<?php $__env->startSection('header-title', 'Yorum Detayı'); ?>

<?php $__env->startSection('header-actions'); ?>
<a href="<?php echo e(route('admin.library-comments.index')); ?>" class="header-action-btn">
    <svg fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M10 19l-7-7m0 0l7-7m-7 7h18"/></svg>
    Geri
</a>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<style>
    .comment-detail-card {
        background: white;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 24px;
        margin-bottom: 20px;
    }
    .comment-header {
        display: flex;
        align-items: flex-start;
        gap: 16px;
        margin-bottom: 20px;
        padding-bottom: 20px;
        border-bottom: 1px solid #e2e8f0;
    }
    .comment-avatar {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        background: linear-gradient(135deg, #3b82f6, #8b5cf6);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        font-size: 18px;
        flex-shrink: 0;
    }
    .comment-meta {
        flex: 1;
    }
    .comment-author {
        font-size: 16px;
        font-weight: 700;
        color: #0f172a;
        margin-bottom: 4px;
    }
    .comment-email {
        font-size: 13px;
        color: #64748b;
    }
    .comment-date {
        font-size: 12px;
        color: #94a3b8;
        margin-top: 4px;
    }
    .comment-status {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 6px 14px;
        border-radius: 20px;
        font-size: 12px;
        font-weight: 600;
    }
    .status-approved { background: #dcfce7; color: #166534; }
    .status-pending { background: #fef9c3; color: #854d0e; }
    .comment-content {
        font-size: 15px;
        line-height: 1.7;
        color: #374151;
        padding: 20px;
        background: #f8fafc;
        border-radius: 10px;
        margin-bottom: 20px;
    }
    .comment-info {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 16px;
        margin-bottom: 20px;
    }
    .info-item {
        padding: 16px;
        background: #f8fafc;
        border-radius: 10px;
        border: 1px solid #e2e8f0;
    }
    .info-label {
        font-size: 12px;
        color: #64748b;
        margin-bottom: 4px;
    }
    .info-value {
        font-size: 14px;
        font-weight: 600;
        color: #0f172a;
    }
    .reply-item {
        margin-left: 20px;
        padding-left: 20px;
        border-left: 2px solid #e2e8f0;
        margin-top: 16px;
    }
    .reply-header {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 12px;
    }
    .reply-avatar {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: linear-gradient(135deg, #10b981, #059669);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        font-size: 14px;
    }
</style>

<div class="comment-detail-card">
    <div class="comment-header">
        <div class="comment-avatar">
            <?php echo e(mb_strtoupper(mb_substr($comment->author_name ?? 'A', 0, 1))); ?>

        </div>
        <div class="comment-meta">
            <div class="comment-author"><?php echo e($comment->author_name ?? 'Anonim'); ?></div>
            <?php if($comment->author_email): ?>
                <div class="comment-email"><?php echo e($comment->author_email); ?></div>
            <?php endif; ?>
            <div class="comment-date">
                📅 <?php echo e($comment->created_at->format('d.m.Y H:i')); ?>

                <?php if($comment->created_at->diffForHumans() != $comment->created_at->format('d.m.Y H:i')): ?>
                    (<?php echo e($comment->created_at->diffForHumans()); ?>)
                <?php endif; ?>
            </div>
        </div>
        <div>
            <?php if($comment->is_approved): ?>
                <span class="comment-status status-approved">✅ Onaylı</span>
            <?php else: ?>
                <span class="comment-status status-pending">⏳ Bekliyor</span>
            <?php endif; ?>
        </div>
    </div>

    <div class="comment-content">
        <?php echo e($comment->content); ?>

    </div>

    <div class="comment-info">
        <div class="info-item">
            <div class="info-label">IP Adresi</div>
            <div class="info-value"><?php echo e($comment->author_ip ?? '—'); ?></div>
        </div>
        <div class="info-item">
            <div class="info-label">Kullanıcı ID</div>
            <div class="info-value"><?php echo e($comment->user_id ?? '—'); ?></div>
        </div>
        <div class="info-item">
            <div class="info-label">İçerik</div>
            <div class="info-value">
                <?php if($comment->content_id && $comment->libraryContent): ?>
                    <a href="<?php echo e(route('admin.library-contents.edit', $comment->libraryContent)); ?>"
                       style="color:#3b82f6;text-decoration:none;" target="_blank">
                        <?php echo e(Str::limit($comment->libraryContent->title, 40)); ?>

                    </a>
                <?php else: ?>
                    —
                <?php endif; ?>
            </div>
        </div>
        <div class="info-item">
            <div class="info-label">Son Güncelleme</div>
            <div class="info-value"><?php echo e($comment->updated_at->format('d.m.Y H:i')); ?></div>
        </div>
    </div>

    <div style="display:flex;gap:10px;flex-wrap:wrap;">
        <?php if(!$comment->is_approved): ?>
            <form method="POST" action="<?php echo e(route('admin.library-comments.approve', $comment)); ?>">
                <?php echo csrf_field(); ?>
                <button type="submit" class="btn btn-primary">
                    <svg fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5" style="width:14px;height:14px;"><path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"/></svg>
                    Yorumu Onayla
                </button>
            </form>
        <?php else: ?>
            <form method="POST" action="<?php echo e(route('admin.library-comments.reject', $comment)); ?>">
                <?php echo csrf_field(); ?>
                <button type="submit" class="btn btn-secondary">
                    <svg fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5" style="width:14px;height:14px;"><path stroke-linecap="round" stroke-linejoin="round" d="M3 10h10a8 8 0 018 8v2M3 10l6 6m-6-6l6-6"/></svg>
                    Onayı Geri Al
                </button>
            </form>
        <?php endif; ?>
        <form method="POST" action="<?php echo e(route('admin.library-comments.destroy', $comment)); ?>"
              onsubmit="return confirm('Bu yorumu silmek istediğinizden emin misiniz?')">
            <?php echo csrf_field(); ?>
            <?php echo method_field('DELETE'); ?>
            <button type="submit" class="btn btn-danger">
                <svg fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5" style="width:14px;height:14px;"><path stroke-linecap="round" stroke-linejoin="round" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg>
                Yorumu Sil
            </button>
        </form>
        <a href="<?php echo e(route('admin.library-comments.index')); ?>" class="btn btn-secondary">İptal</a>
    </div>
</div>

<?php if($comment->replies->count() > 0): ?>
<div class="comment-detail-card">
    <h3 style="font-size:16px;font-weight:700;color:#0f172a;margin-bottom:16px;">💬 Yanıtlar (<?php echo e($comment->replies->count()); ?>)</h3>
    <?php $__currentLoopData = $comment->replies; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $reply): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <div class="reply-item">
            <div class="reply-header">
                <div class="reply-avatar">
                    <?php echo e(mb_strtoupper(mb_substr($reply->author_name ?? 'A', 0, 1))); ?>

                </div>
                <div>
                    <div style="font-weight:600;color:#0f172a;font-size:14px;"><?php echo e($reply->author_name ?? 'Anonim'); ?></div>
                    <div style="font-size:12px;color:#64748b;"><?php echo e($reply->created_at->format('d.m.Y H:i')); ?></div>
                </div>
            </div>
            <div style="font-size:14px;color:#374151;line-height:1.6;padding:12px;background:#f8fafc;border-radius:8px;">
                <?php echo e($reply->content); ?>

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

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

<?php echo $__env->make('admin.layout', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\askeribilgiler\resources\views\admin\library-comments\show.blade.php ENDPATH**/ ?>