<script setup>
/**
 * Coach Edit Workout Template
 * Full exercise library support with GIFs, search, and muscle group filtering
 */
import CoachLayout from '@/Layouts/CoachLayout.vue';
import { Head, Link, useForm } from '@inertiajs/vue3';
import { ref, computed } from 'vue';

const props = defineProps({
    template: Object,
    exercises: Array,
    muscleGroups: Object,
    categories: Object,
    isOfficial: Boolean,
});

// Initialize days - convert existing exercises to include proper data
const initDays = () => {
    const days = props.template.days || [{ name: 'Día 1', exercises: [] }];
    return days.map(day => ({
        name: day.name,
        exercises: (day.exercises || []).map((ex, idx) => ({
            exercise_id: ex.exercise_id || null,
            name: ex.name || '',
            muscle_group: ex.muscle_group || '',
            gif_url: ex.gif_url || '',
            sets: ex.sets || 3,
            reps: ex.reps || '10-12',
            rest: ex.rest || String(ex.rest_seconds || '60'),
            rest_seconds: ex.rest_seconds || parseInt(ex.rest) || 60,
            notes: ex.notes || '',
            block_name: ex.block_name || '',
            order: ex.order ?? idx,
        })),
    }));
};

const form = useForm({
    name: props.template.name || '',
    description: props.template.description || '',
    type: props.template.type || '',
    duration_weeks: props.template.duration_weeks || null,
    days: initDays(),
});

const activeDayIndex = ref(0);

// Exercise Library
const showExerciseLibrary = ref(false);
const exerciseSearch = ref('');
const selectedMuscleGroup = ref('');

// Muscle group icons
const muscleIcons = {
    pecho: '💪', espalda: '🔙', hombros: '🎯', biceps: '💪', triceps: '💪',
    antebrazos: '🤜', abdominales: '🔥', oblicuos: '🔥', cuadriceps: '🦵',
    isquiotibiales: '🦵', gluteos: '🍑', pantorrillas: '🦶', aductores: '🦵',
    trapecio: '🔙', cuerpo_completo: '🏃',
};

// Filter exercises from library
const filteredExercises = computed(() => {
    if (!props.exercises) return [];
    return props.exercises.filter(ex => {
        const matchesSearch = !exerciseSearch.value ||
            ex.name.toLowerCase().includes(exerciseSearch.value.toLowerCase());
        const matchesMuscle = !selectedMuscleGroup.value ||
            ex.muscle_group === selectedMuscleGroup.value;
        return matchesSearch && matchesMuscle;
    });
});

// Day management
const addDay = () => {
    form.days.push({ name: `Día ${form.days.length + 1}`, exercises: [] });
    activeDayIndex.value = form.days.length - 1;
};

const removeDay = (index) => {
    if (form.days.length > 1) {
        form.days.splice(index, 1);
        if (activeDayIndex.value >= form.days.length) {
            activeDayIndex.value = form.days.length - 1;
        }
    }
};

// Open exercise library modal
const openExerciseLibrary = () => {
    showExerciseLibrary.value = true;
    exerciseSearch.value = '';
    selectedMuscleGroup.value = '';
};

// Add exercise from library
const addFromLibrary = (exercise) => {
    form.days[activeDayIndex.value].exercises.push({
        exercise_id: exercise.id,
        name: exercise.name,
        muscle_group: exercise.muscle_group,
        gif_url: exercise.gif_url,
        sets: 3,
        reps: '10-12',
        rest: '60',
        rest_seconds: 60,
        notes: '',
        block_name: '',
        order: form.days[activeDayIndex.value].exercises.length,
    });
    showExerciseLibrary.value = false;
};

// Add custom exercise (manual)
const addCustomExercise = () => {
    form.days[activeDayIndex.value].exercises.push({
        exercise_id: null,
        name: '',
        muscle_group: '',
        gif_url: '',
        sets: 3,
        reps: '10-12',
        rest: '60',
        rest_seconds: 60,
        notes: '',
        block_name: '',
        order: form.days[activeDayIndex.value].exercises.length,
    });
};

const removeExercise = (dayIndex, exerciseIndex) => {
    form.days[dayIndex].exercises.splice(exerciseIndex, 1);
};

// Move exercise up/down
const moveExercise = (exIndex, direction) => {
    const exercises = form.days[activeDayIndex.value].exercises;
    const newIndex = exIndex + direction;
    if (newIndex >= 0 && newIndex < exercises.length) {
        [exercises[exIndex], exercises[newIndex]] = [exercises[newIndex], exercises[exIndex]];
    }
};

const submit = () => {
    // Normalize rest_seconds from rest string
    const transformedDays = form.days.map(day => ({
        name: day.name,
        exercises: day.exercises.map((ex, idx) => ({
            ...ex,
            rest_seconds: parseInt(ex.rest) || parseInt(ex.rest_seconds) || 60,
            order: idx,
        })),
    }));

    form.transform(data => ({
        ...data,
        days: transformedDays,
    })).put(route('coach.workouts.update', props.template.id));
};
</script>

<template>
    <Head :title="`Editar ${template.name}`" />

    <CoachLayout>
        <template #header>
            <div class="flex items-center gap-4">
                <Link
                    :href="route('coach.workouts.index')"
                    class="p-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors"
                >
                    <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18" />
                    </svg>
                </Link>
                <div>
                    <h2 class="text-xl font-bold text-gray-900 dark:text-white">
                        ✏️ Editar Plantilla
                    </h2>
                    <p class="text-sm text-gray-500 dark:text-gray-400">
                        {{ template.name }}
                        <span v-if="isOfficial" class="ml-2 px-2 py-0.5 bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-400 text-xs rounded-full">
                            ⭐ Oficial — Se guardará como tu copia personal
                        </span>
                    </p>
                </div>
            </div>
        </template>

        <form @submit.prevent="submit" class="space-y-6">
            <!-- Basic Info -->
            <div class="bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-100 dark:border-gray-700 p-6">
                <h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center gap-2">
                    📝 Información General
                </h3>
                <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                    <div class="md:col-span-2">
                        <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Nombre de la plantilla *</label>
                        <input
                            v-model="form.name"
                            type="text"
                            class="w-full rounded-lg border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white focus:ring-orange-500 focus:border-orange-500"
                            required
                        />
                    </div>
                    <div>
                        <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Tipo</label>
                        <select
                            v-model="form.type"
                            class="w-full rounded-lg border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white focus:ring-orange-500 focus:border-orange-500"
                        >
                            <option value="">Seleccionar tipo</option>
                            <option value="fuerza">💪 Fuerza</option>
                            <option value="hipertrofia">🏋️ Hipertrofia</option>
                            <option value="cardio">🏃 Cardio</option>
                            <option value="hiit">🔥 HIIT</option>
                            <option value="flexibility">🧘 Flexibilidad</option>
                            <option value="fullbody">🏋️ Full Body</option>
                            <option value="funcional">⚡ Funcional</option>
                            <option value="calistenia">🤸 Calistenia</option>
                        </select>
                    </div>
                    <div>
                        <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Duración (semanas)</label>
                        <input
                            v-model.number="form.duration_weeks"
                            type="number"
                            min="1"
                            max="52"
                            class="w-full rounded-lg border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white focus:ring-orange-500 focus:border-orange-500"
                            placeholder="8"
                        />
                    </div>
                    <div class="md:col-span-2">
                        <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Descripción</label>
                        <textarea
                            v-model="form.description"
                            rows="2"
                            class="w-full rounded-lg border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white focus:ring-orange-500 focus:border-orange-500"
                            placeholder="Descripción breve de la rutina..."
                        ></textarea>
                    </div>
                </div>
            </div>

            <!-- Days Tabs -->
            <div class="bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-100 dark:border-gray-700">
                <div class="border-b border-gray-200 dark:border-gray-700 p-4">
                    <div class="flex items-center gap-2 flex-wrap">
                        <button
                            v-for="(day, index) in form.days"
                            :key="index"
                            type="button"
                            @click="activeDayIndex = index"
                            class="px-4 py-2 rounded-lg font-medium transition-colors relative group"
                            :class="{
                                'bg-orange-500 text-white shadow-lg shadow-orange-500/25': activeDayIndex === index,
                                'bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600': activeDayIndex !== index,
                            }"
                        >
                            📅 {{ day.name }}
                            <span class="ml-1 text-xs opacity-75">({{ day.exercises?.length || 0 }})</span>
                            <button
                                v-if="form.days.length > 1"
                                type="button"
                                @click.stop="removeDay(index)"
                                class="absolute -top-1 -right-1 w-5 h-5 bg-red-500 text-white rounded-full text-xs hidden group-hover:flex items-center justify-center"
                            >
                                ×
                            </button>
                        </button>
                        <button
                            type="button"
                            @click="addDay"
                            class="px-3 py-2 text-orange-600 dark:text-orange-400 hover:bg-orange-50 dark:hover:bg-orange-900/20 rounded-lg transition-colors"
                        >
                            <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
                            </svg>
                        </button>
                    </div>
                </div>

                <!-- Day Content -->
                <div class="p-6">
                    <div class="mb-4">
                        <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Nombre del día</label>
                        <input
                            v-model="form.days[activeDayIndex].name"
                            type="text"
                            class="w-full max-w-xs rounded-lg border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white focus:ring-orange-500 focus:border-orange-500"
                        />
                    </div>

                    <!-- Exercises List -->
                    <div class="space-y-3">
                        <div
                            v-for="(exercise, exIndex) in form.days[activeDayIndex].exercises"
                            :key="exIndex"
                            class="bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4 border border-gray-200 dark:border-gray-600"
                        >
                            <div class="flex items-start justify-between mb-3">
                                <div class="flex items-center gap-3">
                                    <!-- GIF Preview -->
                                    <div v-if="exercise.gif_url" class="w-14 h-14 rounded-lg overflow-hidden bg-gray-200 dark:bg-gray-600 flex-shrink-0">
                                        <img :src="exercise.gif_url" :alt="exercise.name" class="w-full h-full object-cover" loading="lazy" />
                                    </div>
                                    <div v-else class="w-14 h-14 rounded-lg bg-gray-200 dark:bg-gray-600 flex items-center justify-center flex-shrink-0">
                                        <span class="text-xl">🏋️</span>
                                    </div>
                                    <div>
                                        <span class="text-sm font-semibold text-gray-900 dark:text-white">
                                            {{ exercise.name || 'Sin nombre' }}
                                        </span>
                                        <div class="flex items-center gap-2 mt-0.5">
                                            <span v-if="exercise.muscle_group" class="px-2 py-0.5 bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400 text-xs rounded-full">
                                                {{ muscleIcons[exercise.muscle_group] || '🏋️' }} {{ muscleGroups?.[exercise.muscle_group] || exercise.muscle_group }}
                                            </span>
                                            <span v-if="exercise.block_name" class="px-2 py-0.5 bg-purple-100 dark:bg-purple-900/50 text-purple-700 dark:text-purple-400 text-xs rounded-full">
                                                {{ exercise.block_name }}
                                            </span>
                                        </div>
                                    </div>
                                </div>
                                <div class="flex items-center gap-1">
                                    <button type="button" @click="moveExercise(exIndex, -1)" :disabled="exIndex === 0" class="p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-30 transition-colors">
                                        <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 15l7-7 7 7" /></svg>
                                    </button>
                                    <button type="button" @click="moveExercise(exIndex, 1)" :disabled="exIndex === form.days[activeDayIndex].exercises.length - 1" class="p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-30 transition-colors">
                                        <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" /></svg>
                                    </button>
                                    <button
                                        type="button"
                                        @click="removeExercise(activeDayIndex, exIndex)"
                                        class="p-1 text-red-500 hover:text-red-700 transition-colors"
                                    >
                                        <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
                                        </svg>
                                    </button>
                                </div>
                            </div>

                            <!-- Exercise fields -->
                            <div class="grid grid-cols-2 md:grid-cols-5 gap-3">
                                <div v-if="!exercise.exercise_id" class="col-span-2">
                                    <label class="block text-xs text-gray-500 dark:text-gray-400 mb-1">Nombre</label>
                                    <input
                                        v-model="exercise.name"
                                        type="text"
                                        class="w-full rounded-lg text-sm border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white focus:ring-orange-500 focus:border-orange-500"
                                        placeholder="Nombre del ejercicio"
                                    />
                                </div>
                                <div>
                                    <label class="block text-xs text-gray-500 dark:text-gray-400 mb-1">Series</label>
                                    <input
                                        v-model.number="exercise.sets"
                                        type="number"
                                        min="1"
                                        class="w-full rounded-lg text-sm border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white focus:ring-orange-500 focus:border-orange-500"
                                    />
                                </div>
                                <div>
                                    <label class="block text-xs text-gray-500 dark:text-gray-400 mb-1">Reps</label>
                                    <input
                                        v-model="exercise.reps"
                                        type="text"
                                        class="w-full rounded-lg text-sm border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white focus:ring-orange-500 focus:border-orange-500"
                                        placeholder="10-12"
                                    />
                                </div>
                                <div>
                                    <label class="block text-xs text-gray-500 dark:text-gray-400 mb-1">Descanso (seg)</label>
                                    <input
                                        v-model="exercise.rest"
                                        type="text"
                                        class="w-full rounded-lg text-sm border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white focus:ring-orange-500 focus:border-orange-500"
                                        placeholder="60"
                                    />
                                </div>
                            </div>
                            <div class="mt-3">
                                <label class="block text-xs text-gray-500 dark:text-gray-400 mb-1">Notas</label>
                                <input
                                    v-model="exercise.notes"
                                    type="text"
                                    class="w-full rounded-lg text-sm border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white focus:ring-orange-500 focus:border-orange-500"
                                    placeholder="Instrucciones adicionales..."
                                />
                            </div>
                        </div>

                        <!-- Add exercise buttons -->
                        <div class="flex gap-3">
                            <button
                                type="button"
                                @click="openExerciseLibrary"
                                class="flex-1 py-3 border-2 border-dashed border-orange-300 dark:border-orange-600 rounded-lg text-orange-600 dark:text-orange-400 hover:bg-orange-50 dark:hover:bg-orange-900/10 transition-colors flex items-center justify-center gap-2"
                            >
                                <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10" />
                                </svg>
                                📚 Agregar de Biblioteca
                            </button>
                            <button
                                type="button"
                                @click="addCustomExercise"
                                class="py-3 px-4 border-2 border-dashed border-gray-300 dark:border-gray-600 rounded-lg text-gray-500 dark:text-gray-400 hover:border-gray-400 hover:text-gray-600 dark:hover:border-gray-500 dark:hover:text-gray-300 transition-colors flex items-center justify-center gap-2"
                            >
                                <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
                                </svg>
                                ✍️ Personalizado
                            </button>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Actions -->
            <div class="flex justify-end gap-3">
                <Link
                    :href="route('coach.workouts.index')"
                    class="px-6 py-2.5 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors"
                >
                    Cancelar
                </Link>
                <button
                    type="submit"
                    :disabled="form.processing"
                    class="px-6 py-2.5 bg-gradient-to-r from-orange-500 to-red-500 hover:from-orange-600 hover:to-red-600 text-white font-medium rounded-lg transition-all disabled:opacity-50 flex items-center gap-2"
                >
                    <svg v-if="form.processing" class="w-4 h-4 animate-spin" fill="none" viewBox="0 0 24 24">
                        <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
                        <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path>
                    </svg>
                    {{ isOfficial ? '💾 Guardar como Mi Plantilla' : '💾 Guardar Cambios' }}
                </button>
            </div>
        </form>

        <!-- Exercise Library Modal -->
        <Teleport to="body">
            <div v-if="showExerciseLibrary" class="fixed inset-0 z-50 flex items-center justify-center p-4">
                <div class="absolute inset-0 bg-black/50 backdrop-blur-sm" @click="showExerciseLibrary = false"></div>
                <div class="relative bg-white dark:bg-gray-800 rounded-2xl shadow-2xl w-full max-w-2xl max-h-[80vh] flex flex-col">
                    <!-- Header -->
                    <div class="p-6 border-b border-gray-200 dark:border-gray-700">
                        <div class="flex items-center justify-between mb-4">
                            <h3 class="text-lg font-bold text-gray-900 dark:text-white">📚 Biblioteca de Ejercicios</h3>
                            <button
                                type="button"
                                @click="showExerciseLibrary = false"
                                class="p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors"
                            >
                                <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
                                </svg>
                            </button>
                        </div>
                        <!-- Search -->
                        <div class="relative mb-3">
                            <svg class="w-5 h-5 absolute left-3 top-1/2 -translate-y-1/2 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
                            </svg>
                            <input
                                v-model="exerciseSearch"
                                type="text"
                                placeholder="Buscar ejercicio..."
                                class="w-full pl-10 pr-4 py-2.5 rounded-lg border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white focus:ring-orange-500 focus:border-orange-500"
                            />
                        </div>
                        <!-- Muscle group filters -->
                        <div class="flex flex-wrap gap-1.5">
                            <button
                                type="button"
                                @click="selectedMuscleGroup = ''"
                                class="px-3 py-1 rounded-full text-xs font-medium transition-colors"
                                :class="selectedMuscleGroup === '' ? 'bg-orange-500 text-white' : 'bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-600'"
                            >
                                Todos
                            </button>
                            <button
                                v-for="(label, key) in muscleGroups"
                                :key="key"
                                type="button"
                                @click="selectedMuscleGroup = key"
                                class="px-3 py-1 rounded-full text-xs font-medium transition-colors"
                                :class="selectedMuscleGroup === key ? 'bg-orange-500 text-white' : 'bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-600'"
                            >
                                {{ muscleIcons[key] || '' }} {{ label }}
                            </button>
                        </div>
                    </div>

                    <!-- Exercise List -->
                    <div class="flex-1 overflow-y-auto p-4">
                        <div v-if="filteredExercises.length === 0" class="text-center py-8 text-gray-500 dark:text-gray-400">
                            No se encontraron ejercicios
                        </div>
                        <div class="grid gap-2">
                            <button
                                v-for="exercise in filteredExercises"
                                :key="exercise.id"
                                type="button"
                                @click="addFromLibrary(exercise)"
                                class="flex items-center gap-3 p-3 rounded-lg hover:bg-orange-50 dark:hover:bg-orange-900/10 border border-transparent hover:border-orange-200 dark:hover:border-orange-800 transition-all text-left group"
                            >
                                <!-- GIF -->
                                <div v-if="exercise.gif_url" class="w-12 h-12 rounded-lg overflow-hidden bg-gray-100 dark:bg-gray-700 flex-shrink-0">
                                    <img :src="exercise.gif_url" :alt="exercise.name" class="w-full h-full object-cover" loading="lazy" />
                                </div>
                                <div v-else class="w-12 h-12 rounded-lg bg-gray-100 dark:bg-gray-700 flex items-center justify-center flex-shrink-0">
                                    <span class="text-lg">🏋️</span>
                                </div>
                                <!-- Info -->
                                <div class="flex-1 min-w-0">
                                    <p class="font-medium text-gray-900 dark:text-white truncate">{{ exercise.name }}</p>
                                    <p class="text-xs text-gray-500 dark:text-gray-400">
                                        {{ muscleIcons[exercise.muscle_group] || '' }} {{ muscleGroups?.[exercise.muscle_group] || exercise.muscle_group }}
                                    </p>
                                </div>
                                <!-- Add icon -->
                                <div class="opacity-0 group-hover:opacity-100 transition-opacity">
                                    <svg class="w-5 h-5 text-orange-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
                                    </svg>
                                </div>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </Teleport>
    </CoachLayout>
</template>
