<?php $__env->startSection('title', $article->title); ?>
<?php $__env->startSection('content'); ?>
<div class="max-w-3xl">

    
    <div class="flex items-center gap-2 text-xs text-gray-400 mb-5">
        <a href="<?php echo e(route('kb.index')); ?>" class="hover:text-blue-600">Base de Conocimiento</a>
        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($article->category): ?>
        <span>›</span>
        <a href="<?php echo e(route('kb.category', $article->category->slug)); ?>" class="hover:text-blue-600">
            <?php echo e($article->category->name); ?>

        </a>
        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        <span>›</span>
        <span class="text-gray-600 truncate max-w-xs"><?php echo e($article->title); ?></span>
    </div>

    
    <div class="bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden">

        
        <div class="px-8 py-6 border-b border-gray-100">
            <div class="flex items-center gap-2 mb-3">
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($article->category): ?>
                <span class="text-xs px-2 py-0.5 rounded-full font-medium"
                      style="background-color: <?php echo e($article->category->color); ?>20; color: <?php echo e($article->category->color); ?>">
                    <?php echo e($article->category->name); ?>

                </span>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($article->featured): ?>
                <span class="text-xs text-yellow-500">⭐ Destacado</span>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $article->tags_array; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tag): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <span class="text-xs bg-gray-100 text-gray-600 px-2 py-0.5 rounded-full"><?php echo e($tag); ?></span>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </div>
            <h1 class="text-2xl font-bold text-gray-900 mb-3"><?php echo e($article->title); ?></h1>
            <div class="flex items-center gap-4 text-xs text-gray-400">
                <span>Por <?php echo e($article->author->name); ?></span>
                <span>·</span>
                <span><?php echo e($article->published_at?->format('d/m/Y')); ?></span>
                <span>·</span>
                <span><?php echo e($article->views); ?> vistas</span>
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($article->helpful_rate !== null): ?>
                <span>·</span>
                <span class="text-green-600"><?php echo e($article->helpful_rate); ?>% lo encontró útil</span>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('assets.edit')): ?>
                <span>·</span>
                <a href="<?php echo e(route('kb.admin.edit', $article)); ?>" class="text-blue-600 hover:underline">Editar</a>
                <?php endif; ?>
            </div>
        </div>

        
        <div class="px-8 py-6 prose prose-sm max-w-none
             prose-headings:font-semibold prose-headings:text-gray-900
             prose-a:text-blue-600 prose-a:no-underline hover:prose-a:underline
             prose-code:bg-gray-100 prose-code:px-1 prose-code:rounded
             prose-pre:bg-gray-900 prose-pre:text-gray-100
             prose-blockquote:border-blue-500 prose-blockquote:bg-blue-50 prose-blockquote:py-1">
            <?php echo $article->content; ?>

        </div>

        
        <div class="px-8 py-5 border-t border-gray-100 bg-gray-50">
            <p class="text-sm font-medium text-gray-700 mb-3">¿Este artículo fue útil?</p>
            <div class="flex items-center gap-3">
                <form method="POST" action="<?php echo e(route('kb.vote', $article)); ?>" class="inline">
                    <?php echo csrf_field(); ?>
                    <input type="hidden" name="helpful" value="1">
                    <button type="submit"
                            class="inline-flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition
                            <?php echo e($article->user_vote === true ? 'bg-green-100 text-green-700 border-2 border-green-400' : 'bg-white border border-gray-300 text-gray-700 hover:bg-green-50'); ?>">
                        👍 Sí (<?php echo e($article->helpful_yes); ?>)
                    </button>
                </form>
                <form method="POST" action="<?php echo e(route('kb.vote', $article)); ?>" class="inline">
                    <?php echo csrf_field(); ?>
                    <input type="hidden" name="helpful" value="0">
                    <button type="submit"
                            class="inline-flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition
                            <?php echo e($article->user_vote === false ? 'bg-red-100 text-red-700 border-2 border-red-400' : 'bg-white border border-gray-300 text-gray-700 hover:bg-red-50'); ?>">
                        👎 No (<?php echo e($article->helpful_no); ?>)
                    </button>
                </form>
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(session('success')): ?>
                <span class="text-xs text-green-600"><?php echo e(session('success')); ?></span>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </div>
            <p class="text-xs text-gray-400 mt-3">
                ¿No encontraste lo que buscabas?
                <a href="<?php echo e(route('tickets.create')); ?>" class="text-blue-600 hover:underline">Crea un ticket de soporte</a>
            </p>
        </div>
    </div>

    
    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($related->count() > 0): ?>
    <div class="mt-6">
        <h3 class="text-sm font-semibold text-gray-700 mb-3">Artículos relacionados</h3>
        <div class="grid grid-cols-1 md:grid-cols-2 gap-3">
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $related; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $rel): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <a href="<?php echo e(route('kb.show', $rel->slug)); ?>"
               class="block bg-white rounded-xl border border-gray-200 p-4 hover:shadow-md transition">
                <p class="text-sm font-medium text-gray-900 mb-1"><?php echo e($rel->title); ?></p>
                <p class="text-xs text-gray-400 line-clamp-2"><?php echo e($rel->excerpt); ?></p>
            </a>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        </div>
    </div>
    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

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

<?php echo $__env->make(auth()->check() && auth()->user()->hasRole('usuario') ? 'layouts.portal' : 'layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/evolucionamos/public_html/fedef/resources/views/kb/show.blade.php ENDPATH**/ ?>