<?php $attributes ??= new \Illuminate\View\ComponentAttributeBag;

$__newAttributes = [];
$__propNames = \Illuminate\View\ComponentAttributeBag::extractPropNames((['task', 'depth' => 0]));

foreach ($attributes->all() as $__key => $__value) {
    if (in_array($__key, $__propNames)) {
        $$__key = $$__key ?? $__value;
    } else {
        $__newAttributes[$__key] = $__value;
    }
}

$attributes = new \Illuminate\View\ComponentAttributeBag($__newAttributes);

unset($__propNames);
unset($__newAttributes);

foreach (array_filter((['task', 'depth' => 0]), 'is_string', ARRAY_FILTER_USE_KEY) as $__key => $__value) {
    $$__key = $$__key ?? $__value;
}

$__defined_vars = get_defined_vars();

foreach ($attributes->all() as $__key => $__value) {
    if (array_key_exists($__key, $__defined_vars)) unset($$__key);
}

unset($__defined_vars, $__key, $__value); ?>

<div class="task-row-group" x-data="{ expanded: false }">
    <div class="group flex flex-col md:flex-row md:items-center px-4 md:px-8 py-3 transition-all duration-300 hover:bg-slate-50 dark:hover:bg-white/5 border-b border-slate-100 dark:border-slate-800/50 relative overflow-hidden pl-4 md:pl-[var(--row-depth)]"
         style="--row-depth: <?php echo e($depth * 1.5 + 2); ?>rem">
        
        <!-- Drag Handle (Desktop) -->
        <div class="hidden md:flex flex-col gap-0.5 opacity-0 group-hover:opacity-40 transition-all duration-300 cursor-grab active:cursor-grabbing text-slate-400 absolute left-4">
            <?php for($i=0; $i<3; $i++): ?>
                <div class="flex gap-0.5">
                    <div class="w-1 h-1 rounded-full bg-current"></div>
                    <div class="w-1 h-1 rounded-full bg-current"></div>
                </div>
            <?php endfor; ?>
        </div>

        <!-- Title & Checkbox Area -->
        <div class="flex items-start gap-3 flex-1 min-w-0 py-1">
            <!-- Expand Button -->
            <div class="w-6 flex items-center justify-center mt-0.5">
                <?php if($task->children->count() > 0): ?>
                    <button @click="expanded = !expanded" 
                            class="p-1 rounded-lg hover:bg-slate-200 dark:hover:bg-slate-700 text-slate-400 dark:text-slate-500 transition-all duration-300" 
                            :class="{ 'rotate-90 text-primary-600': expanded }">
                        <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="3"><path stroke-linecap="round" stroke-linejoin="round" d="M9 5l7 7-7 7"></path></svg>
                    </button>
                <?php endif; ?>
            </div>

            <!-- Custom Checkbox -->
            <div class="relative flex items-center">
                <input type="checkbox" 
                       @change="toggleComplete(<?php echo e($task->id); ?>, $event.target.checked)"
                       <?php echo e($task->is_completed ? 'checked' : ''); ?>

                       class="peer w-5 h-5 rounded-md border-2 border-slate-300 dark:border-slate-600 bg-transparent text-primary-600 focus:ring-0 focus:ring-offset-0 transition-all cursor-pointer checked:border-primary-600">
                <svg class="absolute w-3.5 h-3.5 text-white left-0.5 pointer-events-none opacity-0 peer-checked:opacity-100 transition-opacity" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="4">
                    <path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path>
                </svg>
            </div>

            <!-- Title -->
            <div class="flex items-start gap-3 min-w-0 flex-1">
                <span @click="openEditModal(<?php echo e(json_encode($task)); ?>)" 
                      class="text-sm font-semibold tracking-tight cursor-pointer hover:text-primary-600 whitespace-normal break-words transition-all duration-200 <?php echo e($task->is_completed ? 'text-slate-400 line-through' : 'text-slate-700 dark:text-slate-200'); ?>">
                    <?php echo e($task->title); ?>

                </span>
                
                <?php if($task->children->count() > 0): ?>
                    <span class="text-[9px] font-bold text-slate-400 dark:text-slate-500 bg-slate-100 dark:bg-slate-800 px-1.5 py-0.5 rounded-md"><?php echo e($task->children->where('is_completed', true)->count()); ?>/<?php echo e($task->children->count()); ?></span>
                <?php endif; ?>
            </div>
        </div>

        <!-- Meta Information -->
        <div class="flex items-center gap-6 mt-2 md:mt-0">
            <!-- Due Date -->
            <div class="w-28 flex justify-center">
                <div class="flex items-center gap-1.5 <?php echo e($task->due_date && $task->due_date->isPast() && !$task->is_completed ? 'text-red-500' : 'text-slate-400 dark:text-slate-500'); ?>">
                    <span class="text-[10px] font-bold tracking-tight"><?php echo e($task->due_date ? $task->due_date->format('M d, Y') : '---'); ?></span>
                </div>
            </div>

            <!-- Priority -->
            <div class="w-24 flex justify-center">
                <span class="px-2 py-0.5 rounded-md text-[9px] font-black uppercase tracking-wider
                    <?php echo e($task->priority === 'urgent' ? 'bg-red-100 text-red-600 dark:bg-red-500/20 dark:text-red-400' : ''); ?>

                    <?php echo e($task->priority === 'high' ? 'bg-amber-100 text-amber-600 dark:bg-amber-500/20 dark:text-amber-400' : ''); ?>

                    <?php echo e($task->priority === 'medium' ? 'bg-indigo-100 text-indigo-600 dark:bg-indigo-500/20 dark:text-indigo-400' : ''); ?>

                    <?php echo e($task->priority === 'low' ? 'bg-emerald-100 text-emerald-600 dark:bg-emerald-500/20 dark:text-emerald-400' : ''); ?>">
                    <?php echo e($task->priority); ?>

                </span>
            </div>

            <!-- Owner -->
            <div class="w-20 flex justify-center">
                <?php if($task->assignee): ?>
                    <img src="https://ui-avatars.com/api/?name=<?php echo e(urlencode($task->assignee->name)); ?>&background=E2E8F0&color=64748B&size=32" class="w-6 h-6 rounded-full grayscale hover:grayscale-0 transition-all border border-slate-200 dark:border-slate-700" title="<?php echo e($task->assignee->name); ?>" alt="">
                <?php else: ?>
                    <div class="w-5 h-5 rounded-full border border-dashed border-slate-300 dark:border-slate-700"></div>
                <?php endif; ?>
            </div>

            <!-- Actions -->
            <div class="w-24 flex justify-end gap-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200">
                <button @click="$dispatch('open-new-task-modal', { parent_id: <?php echo e($task->id); ?> })" class="p-1.5 text-slate-400 hover:text-primary-600 hover:bg-primary-50 dark:hover:bg-primary-500/10 rounded-md transition-all" title="Add subtask">
                    <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M12 4v16m8-8H4"></path></svg>
                </button>
                <button @click="openEditModal(<?php echo e(json_encode($task)); ?>)" class="p-1.5 text-slate-400 hover:text-slate-600 dark:hover:text-slate-200 hover:bg-slate-100 dark:hover:bg-slate-800 rounded-md transition-all" title="Edit task">
                    <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z"></path></svg>
                </button>
                <button @click="deleteTask(<?php echo e($task->id); ?>)" class="p-1.5 text-slate-400 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-500/10 rounded-md transition-all" title="Delete task">
                    <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" 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"></path></svg>
                </button>
            </div>
        </div>

    </div>

    <!-- Recursive Subtasks -->
    <div x-show="expanded" 
         x-collapse
         class="relative">
        <!-- Connecting Line -->
        <div class="absolute left-[2.2rem] top-0 bottom-4 w-px bg-slate-200 dark:bg-slate-800"></div>
        
        <?php $__currentLoopData = $task->children; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $child): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <?php if (isset($component)) { $__componentOriginal1fd61deb10ce5edf91d06caec3cac106 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal1fd61deb10ce5edf91d06caec3cac106 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.task-row','data' => ['task' => $child,'depth' => $depth + 1]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('task-row'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['task' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($child),'depth' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($depth + 1)]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal1fd61deb10ce5edf91d06caec3cac106)): ?>
<?php $attributes = $__attributesOriginal1fd61deb10ce5edf91d06caec3cac106; ?>
<?php unset($__attributesOriginal1fd61deb10ce5edf91d06caec3cac106); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal1fd61deb10ce5edf91d06caec3cac106)): ?>
<?php $component = $__componentOriginal1fd61deb10ce5edf91d06caec3cac106; ?>
<?php unset($__componentOriginal1fd61deb10ce5edf91d06caec3cac106); ?>
<?php endif; ?>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    </div>
</div>
<?php /**PATH C:\laragon\www\Taskweb\resources\views/components/task-row.blade.php ENDPATH**/ ?>