<?php $__env->startSection('content'); ?>

<div class="row mb-4 align-items-center">
    <div class="col-md-6">
        <h2 class="fw-bold text-dark mb-1">Professional Experience</h2>
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb mb-0">
                <li class="breadcrumb-item"><a href="#" class="text-decoration-none text-muted">Dashboard</a></li>
                <li class="breadcrumb-item active fw-medium text-primary" aria-current="page">Experience</li>
            </ol>
        </nav>
    </div>
    <div class="col-md-6 text-md-end">
        <a href="<?php echo e(route('experiences.create')); ?>" class="btn btn-primary btn-lg shadow-sm rounded-3 px-4 py-2">
            <i class="bi bi-plus-circle-fill me-2"></i> Add New Experience
        </a>
    </div>
</div>

<?php if(session('success')): ?>
    <div class="alert alert-success alert-dismissible fade show rounded-4 shadow-sm mb-4 border-0 p-3" role="alert">
        <div class="d-flex align-items-center">
            <div class="bg-success text-white rounded-circle p-2 me-3 d-flex align-items-center justify-content-center" style="width: 32px; height: 32px;">
                <i class="bi bi-check-lg"></i>
            </div>
            <div>
                <strong class="d-block">Success!</strong>
                <span class="small"><?php echo e(session('success')); ?></span>
            </div>
        </div>
        <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
    </div>
<?php endif; ?>

<div class="card border-0 shadow-sm rounded-4 overflow-hidden">
    <div class="card-header bg-white border-bottom py-3 px-4 d-flex align-items-center justify-content-between">
        <h6 class="m-0 fw-bold text-dark">Experience Timeline</h6>
        <div class="dropdown">
            <button class="btn btn-light btn-sm rounded-3 border" type="button" data-bs-toggle="dropdown">
                <i class="bi bi-three-dots-vertical"></i>
            </button>
            <ul class="dropdown-menu dropdown-menu-end shadow border-0 rounded-3">
                <li><a class="dropdown-item py-2" href="#"><i class="bi bi-images me-2"></i> Preview Grid</a></li>
                <li><a class="dropdown-item py-2" href="#"><i class="bi bi-cloud-download me-2"></i> Export List</a></li>
            </ul>
        </div>
    </div>
    <div class="card-body p-0">
        <div class="table-responsive">
            <table class="table table-hover align-middle mb-0">
                <thead class="text-secondary small text-uppercase fw-bold" style="background-color: #f8fafc;">
                    <tr>
                        <th class="px-4 py-3" style="width: 80px;">SL.NO</th>
                        <th class="py-3">Company Details</th>
                        <th class="py-3">Job Details</th>
                        <th class="py-3">Timeline</th>
                        <th class="px-4 py-3 text-end">Management</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $__empty_1 = true; $__currentLoopData = $experiences; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $experience): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <tr class="transition-all">
                            <td class="px-4 py-4 text-secondary fw-medium"><?php echo e($loop->iteration); ?></td>
                            <td class="py-4">
                                <div class="d-flex align-items-center">
                                    <?php if(!empty($experience->company_logo) && Storage::disk('public')->exists($experience->company_logo)): ?>
                                        <div class="company-logo-wrap bg-white border rounded-3 p-2 shadow-sm me-3 d-flex align-items-center justify-content-center">
                                            <img src="<?php echo e(asset('storage/' . $experience->company_logo)); ?>" alt="<?php echo e($experience->company_name); ?>" class="object-fit-contain" style="width: 48px; height: 48px;">
                                        </div>
                                    <?php else: ?>
                                        <div class="bg-primary-subtle text-primary rounded-3 p-2 me-3 d-flex align-items-center justify-content-center company-icon-box">
                                            <i class="bi bi-building"></i>
                                        </div>
                                    <?php endif; ?>
                                    <div>
                                        <h6 class="fw-bold text-dark mb-1">
                                            <?php echo e($experience->company_name); ?>

                                        </h6>
                                    </div>
                                </div>
                            </td>
                            <td class="py-4">
                                <h6 class="fw-bold text-dark mb-1"><?php echo e($experience->job_title); ?></h6>
                                <div class="d-flex flex-column gap-1">
                                    <div class="d-flex align-items-center">
                                        <i class="bi bi-person-badge text-primary me-2"></i>
                                        <span class="small fw-semibold text-primary">
                                            <?php echo e($experience->designation ?? 'N/A'); ?>

                                        </span>
                                    </div>
                                    <div class="d-flex align-items-center">
                                        <i class="bi bi-calendar-event text-secondary me-2"></i>
                                        <small class="text-secondary">
                                            <?php echo e($experience->start_year); ?> - <?php echo e($experience->end_year); ?>

                                        </small>
                                    </div>
                                </div>
                            </td>
                            <td class="py-4 text-secondary">
                                <span class="d-block small fw-bold text-dark mb-1">
                                    <?php echo e($experience->updated_at ? $experience->updated_at->format('d M, Y') : 'Not updated yet'); ?>

                                </span>
                                <span class="text-secondary small">
                                    <?php echo e($experience->updated_at ? $experience->updated_at->diffForHumans() : 'Fresh draft'); ?>

                                </span>
                            </td>
                            <td class="px-4 py-4 text-end">
                                <div class="d-flex justify-content-end gap-2">
                                    <a href="<?php echo e(route('experiences.show', $experience->id)); ?>" class="btn btn-light btn-sm rounded-3 border text-info" title="Preview Experience">
                                        <i class="bi bi-eye"></i>
                                    </a>
                                    <a href="<?php echo e(route('experiences.edit', $experience->id)); ?>" class="btn btn-light btn-sm rounded-3 border text-primary" title="Edit Experience">
                                        <i class="bi bi-pencil-square"></i>
                                    </a>
                                    <button
                                        type="button"
                                        class="btn btn-light btn-sm rounded-3 border text-danger"
                                        title="Delete Experience"
                                        data-bs-toggle="modal"
                                        data-bs-target="#deleteExperienceModal"
                                        data-experience-title="<?php echo e($experience->job_title); ?> at <?php echo e($experience->company_name); ?>"
                                        data-delete-url="<?php echo e(route('experiences.destroy', $experience->id)); ?>"
                                    >
                                        <i class="bi bi-trash3"></i>
                                    </button>
                                </div>
                            </td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr>
                            <td colspan="5" class="text-center py-5">
                                <img src="https://illustrations.popsy.co/gray/success.svg" alt="Empty" style="width: 150px;" class="mb-4 opacity-50">
                                <h5 class="text-dark fw-bold">No Experiences Added</h5>
                                <p class="text-secondary mb-4">Add your professional experiences to showcase your journey.</p>
                                <a href="#" class="btn btn-primary rounded-3 px-4">Add First Experience</a>
                            </td>
                        </tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div>
    </div>
</div>

<!-- Delete Modal -->
<div class="modal fade" id="deleteExperienceModal" tabindex="-1" aria-labelledby="deleteExperienceModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered">
        <div class="modal-content border-0 shadow-lg rounded-4 overflow-hidden">
            <div class="modal-body p-4 p-md-5">
                <div class="delete-modal-icon mx-auto mb-4">
                    <i class="bi bi-trash3"></i>
                </div>
                <div class="text-center">
                    <h5 class="fw-bold text-dark mb-2" id="deleteExperienceModalLabel">Delete this Experience?</h5>
                    <p class="text-secondary mb-2">This action will permanently remove the selected experience record.</p>
                    <p class="text-dark fw-semibold mb-0" id="deleteExperienceTitle"></p>
                </div>
            </div>
            <div class="modal-footer border-0 pt-0 px-4 px-md-5 pb-4 pb-md-5 d-flex justify-content-center gap-2">
                <button type="button" class="btn btn-light border rounded-3 px-4" data-bs-dismiss="modal">Cancel</button>
                <form id="deleteExperienceForm" method="POST" class="m-0">
                    <?php echo csrf_field(); ?>
                    <?php echo method_field('DELETE'); ?>
                    <button type="submit" class="btn btn-danger rounded-3 px-4 shadow-sm">
                        Delete Experience
                    </button>
                </form>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('styles'); ?>
<style>
    .transition-all { transition: all 0.2s ease-in-out; }
    .table tbody tr:hover { background-color: #f8fafc !important; transform: scale(1.002); }
    .bg-primary-subtle { background-color: #eff6ff !important; }
    .company-icon-box { width: 56px; height: 56px; font-size: 1.5rem; }
    .company-logo-wrap {
        width: 68px;
        height: 68px;
        background: #fff;
    }
    .delete-modal-icon {
        width: 72px;
        height: 72px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 24px;
        background: linear-gradient(145deg, #fee2e2 0%, #fecaca 100%);
        color: #dc2626;
        font-size: 1.75rem;
    }
    .breadcrumb-item + .breadcrumb-item::before { content: "\2022"; color: #cbd5e1; }
</style>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>
<script>
    document.addEventListener('DOMContentLoaded', function () {
        const deleteExperienceModal = document.getElementById('deleteExperienceModal');
        const deleteExperienceForm = document.getElementById('deleteExperienceForm');
        const deleteExperienceTitle = document.getElementById('deleteExperienceTitle');

        if (!deleteExperienceModal || !deleteExperienceForm || !deleteExperienceTitle) {
            return;
        }

        deleteExperienceModal.addEventListener('show.bs.modal', function (event) {
            const triggerButton = event.relatedTarget;

            if (!triggerButton) {
                return;
            }

            const deleteUrl = triggerButton.getAttribute('data-delete-url');
            const expTitle = triggerButton.getAttribute('data-experience-title');

            deleteExperienceForm.setAttribute('action', deleteUrl);
            deleteExperienceTitle.textContent = expTitle ? '"' + expTitle + '"' : '';
        });
    });
</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\laragon\www\portfolio\resources\views/Experience/index.blade.php ENDPATH**/ ?>