<?php $__env->startSection('title', 'Edit Post'); ?>
<?php $__env->startSection('page-title', 'Edit Post'); ?>

<?php $__env->startSection('content'); ?>
<form method="POST" action="<?php echo e(route('admin.posts.update', $post)); ?>" enctype="multipart/form-data">
  <?php echo csrf_field(); ?> <?php echo method_field('PUT'); ?>

  <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">

    
    <div class="lg:col-span-2 space-y-5">

      
      <div class="bg-gray-900 rounded-2xl border border-white/10 p-5">
        <label class="block text-xs text-gray-500 uppercase tracking-wider mb-2">Title</label>
        <input type="text" name="title" value="<?php echo e(old('title', $post->title)); ?>" required
          class="w-full bg-gray-800 border border-white/10 rounded-xl px-4 py-2.5 text-white text-sm focus:outline-none focus:border-blue-500 transition-colors">
      </div>

      
      <div class="bg-gray-900 rounded-2xl border border-white/10 p-5">
        <label class="block text-xs text-gray-500 uppercase tracking-wider mb-2">Excerpt</label>
        <textarea name="excerpt" rows="3"
          class="w-full bg-gray-800 border border-white/10 rounded-xl px-4 py-2.5 text-white text-sm focus:outline-none focus:border-blue-500 transition-colors resize-none"><?php echo e(old('excerpt', $post->excerpt)); ?></textarea>
      </div>

      
      <div class="bg-gray-900 rounded-2xl border border-white/10 p-5">
        <label class="block text-xs text-gray-500 uppercase tracking-wider mb-2">Content</label>
        <textarea name="content" rows="14"
          class="w-full bg-gray-800 border border-white/10 rounded-xl px-4 py-2.5 text-white text-sm focus:outline-none focus:border-blue-500 transition-colors resize-y font-mono leading-relaxed"><?php echo e(old('content', $post->content)); ?></textarea>
      </div>
    </div>

    
    <div class="space-y-5">

      
      <div class="bg-gray-900 rounded-2xl border border-white/10 p-5 space-y-4">
        <h3 class="text-sm font-semibold text-white">Publish</h3>

        <div>
          <label class="block text-xs text-gray-500 mb-1.5">Status</label>
          <select name="status" class="w-full bg-gray-800 border border-white/10 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-blue-500">
            <?php $__currentLoopData = ['published','draft','archived']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $s): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
              <option value="<?php echo e($s); ?>" <?php echo e($post->status === $s ? 'selected' : ''); ?>><?php echo e(ucfirst($s)); ?></option>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
          </select>
        </div>

        <div class="flex items-center gap-4">
          <label class="flex items-center gap-2 cursor-pointer">
            <input type="checkbox" name="is_featured" value="1" <?php echo e($post->is_featured ? 'checked' : ''); ?>

              class="w-4 h-4 rounded text-blue-500">
            <span class="text-sm text-gray-300">Featured</span>
          </label>
          <label class="flex items-center gap-2 cursor-pointer">
            <input type="checkbox" name="is_breaking" value="1" <?php echo e($post->is_breaking ? 'checked' : ''); ?>

              class="w-4 h-4 rounded text-red-500">
            <span class="text-sm text-gray-300">Breaking</span>
          </label>
        </div>

        <div class="flex gap-3">
          <button type="submit"
            class="flex-1 bg-blue-600 hover:bg-blue-700 text-white text-sm font-semibold py-2.5 rounded-xl transition-colors">
            Save Changes
          </button>
          <a href="<?php echo e(route('admin.posts.index')); ?>"
            class="px-4 py-2.5 text-sm text-gray-400 hover:text-white border border-white/10 hover:border-white/30 rounded-xl transition-colors">
            Cancel
          </a>
        </div>
      </div>

      
      <div class="bg-gray-900 rounded-2xl border border-white/10 p-5 space-y-4">
        <h3 class="text-sm font-semibold text-white">Metadata</h3>
        <div>
          <label class="block text-xs text-gray-500 mb-1.5">Category</label>
          <select name="category_id" class="w-full bg-gray-800 border border-white/10 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-blue-500">
            <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
              <option value="<?php echo e($cat->id); ?>" <?php echo e($post->category_id == $cat->id ? 'selected' : ''); ?>><?php echo e($cat->name); ?></option>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
          </select>
        </div>
        <div>
          <label class="block text-xs text-gray-500 mb-1.5">Author</label>
          <select name="author_id" class="w-full bg-gray-800 border border-white/10 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-blue-500">
            <option value="">— None —</option>
            <?php $__currentLoopData = $authors; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $author): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
              <option value="<?php echo e($author->id); ?>" <?php echo e($post->author_id == $author->id ? 'selected' : ''); ?>><?php echo e($author->name); ?></option>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
          </select>
        </div>
      </div>

      
      <div class="bg-gray-900 rounded-2xl border border-white/10 p-5 space-y-3">
        <h3 class="text-sm font-semibold text-white">Featured Image</h3>
        <?php if($post->featured_image): ?>
          <img src="<?php echo e($post->featured_image); ?>" class="w-full h-36 object-cover rounded-xl bg-gray-800">
        <?php endif; ?>
        <div>
          <label class="block text-xs text-gray-500 mb-1.5">Upload new image</label>
          <input type="file" name="image_file" accept="image/*"
            class="w-full text-sm text-gray-400 file:mr-3 file:py-1.5 file:px-3 file:rounded-lg file:border-0 file:bg-blue-600 file:text-white file:text-xs file:cursor-pointer hover:file:bg-blue-700">
        </div>
        <div>
          <label class="block text-xs text-gray-500 mb-1.5">Or paste URL</label>
          <input type="text" name="featured_image" value="<?php echo e(old('featured_image', $post->featured_image)); ?>"
            placeholder="https://..."
            class="w-full bg-gray-800 border border-white/10 rounded-xl px-3 py-2 text-sm text-white focus:outline-none focus:border-blue-500 transition-colors">
        </div>
      </div>

      
      <div class="bg-gray-900 rounded-2xl border border-white/10 p-5">
        <h3 class="text-sm font-semibold text-white mb-3">Stats</h3>
        <div class="space-y-2 text-sm">
          <div class="flex justify-between"><span class="text-gray-500">Views</span><span class="text-white"><?php echo e(number_format($post->views_count)); ?></span></div>
          <div class="flex justify-between"><span class="text-gray-500">Comments</span><span class="text-white"><?php echo e(number_format($post->comments_count)); ?></span></div>
          <div class="flex justify-between"><span class="text-gray-500">Published</span><span class="text-white"><?php echo e($post->published_at?->format('M d, Y')); ?></span></div>
          <?php if($post->source_url): ?>
          <div class="pt-2 border-t border-white/5">
            <a href="<?php echo e($post->source_url); ?>" target="_blank" class="text-blue-400 hover:underline text-xs">↗ Original source</a>
          </div>
          <?php endif; ?>
        </div>
      </div>

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

<?php echo $__env->make('admin.layout', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /Applications/MAMP/htdocs/megablog/backend/resources/views/admin/posts/edit.blade.php ENDPATH**/ ?>