<?php
/** @var array $animal */
/** @var array $medical_notes */
/** @var array $treatments */
/** @var array $vaccinations */
/** @var array $weights */
/** @var array adoption */

require_once __DIR__ . '/../Services/IcadService.php';
$isCat = SpeciesService::isCat((string)($animal['species'] ?? ''));
include __DIR__ . '/animal_adoption.php';
$canViewMedical = PermissionService::can('medical');
$isArchived = !empty($animal['archived_at']);

$icadSvc = new IcadService(DB::pdo());

$cached = $icadSvc->getCachedByAnimal((int)$animal['id']);
$stale = $icadSvc->isStale($cached, 86400);

// variable attendue par ta vue
$icad = [
    'cached' => $cached,
'stale' => $stale,
];

$statusClass = [
'refuge' => 'bg-blue-lt text-blue',
'fa' => 'bg-cyan-lt text-cyan',
'fa_permanente' => 'bg-indigo-lt text-indigo',
'chat_libre' => 'bg-green-lt text-green',
'reserve' => 'bg-purple-lt text-purple',
'adopte' => 'bg-green-lt text-green',
'fugue' => 'bg-orange-lt text-orange',
'decede' => 'bg-dark-lt text-dark',
'quarantaine' => 'bg-yellow-lt text-yellow',
'soin' => 'bg-red-lt text-red',
][$animal['status']] ?? 'bg-secondary-lt text-secondary';

$statusLabel = status_badge((string)($animal['status'] ?? ''))[1];

$historyStyles = [
'create' => ['bg' => 'bg-green',   'icon' => 'plus'],
'update' => ['bg' => 'bg-blue',    'icon' => 'edit'],
'status' => ['bg' => 'bg-purple',  'icon' => 'refresh'],
'medical' => ['bg' => 'bg-red',     'icon' => 'heart'],
'vaccine' => ['bg' => 'bg-yellow',  'icon' => 'shield-check'],
'deworming' => ['bg' => 'bg-lime',    'icon' => 'pill'],
'treatment' => ['bg' => 'bg-orange',  'icon' => 'pill'],
'care_round' => ['bg' => 'bg-red',     'icon' => 'alert-triangle'],
'death' => ['bg' => 'bg-dark',    'icon' => 'rainbow'],
'photo' => ['bg' => 'bg-teal',    'icon' => 'camera'],
];

switch ($animal['sex']) {
    case 'M': $animal['sex'] = t('sex.male');
        $sex_color = '367EB3';
        break;
    case 'F': $animal['sex'] = t('sex.female');
        $sex_color = 'A736B3';
        break;
    default: $animal['sex'] = t('common.unknown');
        $sex_color = '36B362';
}

?>

<style>
    .animal-actions-menu form {
        margin: 0;
    }

    .animal-actions-menu .dropdown-item {
        width: 100%;
        min-height: 34px;
        display: flex;
        align-items: center;
        padding: .45rem 1rem;
        border: 0;
        border-radius: 0;
        color: var(--tblr-body-color, #1d273b) !important;
        background: transparent;
        font-family: inherit;
        font-size: .875rem;
        font-weight: 400;
        line-height: 1.4;
        text-align: left;
        white-space: nowrap;
    }

    .animal-actions-menu .dropdown-item:hover,
    .animal-actions-menu .dropdown-item:focus {
        color: var(--tblr-body-color, #1d273b) !important;
        background: var(--tblr-dropdown-link-hover-bg, #f1f3f5);
        text-decoration: none;
    }

</style>



<div class="row row-cards">
    <div class="col-12">
        <div class="card">
            <?php if ($isArchived): ?><div
                class="alert alert-important alert-secondary rounded-0 mb-0 d-flex flex-wrap align-items-center gap-2"
                role="status"><span>📦</span>
                <div><strong><?= h(t('animal.archived_record')) ?></strong>
                    <div class="small">
                        <?= h(t('animal.archived_help', ['date' => !empty($animal['archived_at']) ? t('animal.archived_on', ['date' => date('d/m/Y H:i', strtotime((string)$animal['archived_at']))]) : ''])) ?>
                    </div>
                </div>
            </div><?php endif; ?>
            <?php
$fivStatus = (string)(($animal['fiv_status'] ?? '') ?: ((int)($animal['fiv'] ?? 0) === 1 ? 'pos' : 'neg'));
$felvStatus = (string)(($animal['felv_status'] ?? '') ?: ((int)($animal['felv'] ?? 0) === 1 ? 'pos' : 'neg'));
$fivPos = $fivStatus === 'pos';
$felvPos = $felvStatus === 'pos';
$testStatusMeta = [
  'unknown' => [t('animals.test_unknown'), 'bg-secondary-lt'],
  'neg' => [t('animals.test_negative'), 'bg-green-lt'],
  'pos' => [t('animals.test_positive'), 'bg-red-lt'],
  'doubtful' => [t('animals.test_doubtful'), 'bg-yellow-lt'],
];

$alertText = [];
if ($fivPos) {
    $alertText[] = 'FIV+';
}
if ($felvPos) {
    $alertText[] = 'FeLV+';
}
?>

            <?php if ($fivPos || $felvPos): ?>
            <div class="alert alert-important alert-danger d-flex align-items-center mb-3" role="alert">
                <div class="me-3">
                    <svg xmlns="http://www.w3.org/2000/svg" class="icon alert-icon" width="24" height="24"
                        viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
                        stroke-linejoin="round">
                        <path stroke="none" d="M0 0h24v24H0z" fill="none" />
                        <path d="M12 9v4" />
                        <path d="M12 17h.01" />
                        <path
                            d="M10.29 3.86l-7.1 12.14a2 2 0 0 0 1.71 3h14.2a2 2 0 0 0 1.71 -3l-7.1 -12.14a2 2 0 0 0 -3.42 0z" />
                    </svg>
                </div>

                <div>
                    <div class="fw-bold"><?= h(t('animal.health_alert', ['status' => implode(' / ', $alertText)])) ?>
                    </div>
                </div>


            </div>
            <?php endif; ?>
            <div class="card-body d-flex align-items-center justify-content-between">
                <div class="d-flex align-items-center gap-3">
                    <div class="text-center flex-shrink-0">
                        <?php if (!empty($primary_photo)): ?>
                        <img src="/media/animals/<?= (int)$animal['id'] ?>/<?= h($primary_photo) ?>"
                            style="width:100px;height:100px;object-fit:cover;border-radius:12px" alt="">
                        <?php else: ?>
                        <div class="bg-muted-lt"
                            style="width:100px;height:100px;border-radius:12px;display:flex;align-items:center;justify-content:center;">
                            <span style="font-size:50px">🐾</span>
                        </div>
                        <?php endif; ?>
                        <div class="text-muted mt-1" style="font-size:.7rem"><?= h($animal['internal_code']) ?></div>
                    </div>

                    <div>
                        <h3 class="mb-0">
                            <?= h($animal['name']) ?>
                            <?php if ($lastWeight !== null): ?>
                            <?php
    $arrow = '→';
                                if ($prevWeight !== null) {
                                    if ((float)$lastWeight > (float)$prevWeight) {
                                        $arrow = '↑';
                                    } elseif ((float)$lastWeight < (float)$prevWeight) {
                                        $arrow = '↓';
                                    }
                                }
?>
                            <span class="badge bg-indigo-lt ms-2"><?= number_format((float)$lastWeight, 2) ?> kg
                                <?= $arrow ?></span>
                            <?php endif; ?>
                        </h3>

                        <div class="text-muted">
                            <?= h(t('animal.species')) ?> :
                            <strong><?= h(species_label($animal['species'] ?? '')) ?></strong>
                            • <?= h(t('animal.sex')) ?> : <strong
                                style="color:#<?php echo $sex_color; ?>;"><?= h($animal['sex']) ?></strong><br />
                            <?= h(t('animal.breed')) ?> : <strong><?= h($animal['breed'] ?: '—') ?></strong>
                            • <?= h(t('animal.coat')) ?> :
                            <?php if (!empty($animal['color'])): ?>
                            <span class="coat-swatch" style="<?= h(coat_swatch_style($animal['color'])) ?>"></span>
                            <strong><?= h($animal['color']) ?></strong>
                            <?php else: ?><strong>—</strong><?php endif; ?>
                            • <?= h(t('animal.hair')) ?> : <strong><?= h(match ((string)($animal['hair_type'] ?? '')) {
                                'court' => t('animal.hair_short'),
                                'mi-long' => t('animal.hair_medium'),
                                'long' => t('animal.hair_long'),
                                'frise' => t('animal.hair_curly'),
                                'sans-poil' => t('animal.hairless'),
                                default => '—',
                            }) ?></strong><br />
                            <strong><?= h(match((string)($animal['identification_type'] ?? 'unknown')) {
                                'microchip' => t('animal.microchip'),'tattoo' => t('animal.tattoo'),default => t('animal.identification_unknown')
                            }) ?></strong><?= $animal['chip_id'] ? ' · ' . h($animal['chip_id']) : '' ?><?php if (!empty($animal['identification_date'])): ?>
                            ·
                            <?= h(t('animal.placed_on', ['date' => date('d/m/Y', strtotime((string)$animal['identification_date']))])) ?><?php endif; ?>
                        </div>

                        <div class="text-muted">
                            <?= h(t('animal.status')) ?> : <span class="badge <?= $statusClass ?>">
                                <?= $statusLabel ?>
                            </span>
                            <?php if (in_array(($animal['status'] ?? ''), ['refuge','soin','quarantaine'], true)):$roomConfig = ShelterRoomService::byCode(true)[(string)($animal['refuge_room'] ?? '')] ?? null; ?>
                            • <?= h(t('animal.room')) ?> : <span
                                class="badge <?= $roomConfig ? '' : 'bg-secondary-lt' ?>"
                                <?= $roomConfig ? 'style="color:' . h($roomConfig['color']) . ';background:color-mix(in srgb,' . h($roomConfig['color']) . ' 14%,transparent)"' : '' ?>><?= h($roomConfig['name'] ?? t('animal.assign')) ?></span>
                            <?php endif; ?>
                            <?php if (($animal['status'] ?? '') === 'chat_libre'): ?>
                            • <?= h(t('animal.site')) ?> :
                            <strong><?= h($animal['free_cat_site_name'] ?: ($animal['free_cat_city'] ?: t('animal.to_provide'))) ?></strong>
                            <?php endif; ?>
                            <?php if ($canViewMedical && $isCat): ?>
                            • FIV:
                            <?php [$fivLabel, $fivClass] = $testStatusMeta[$fivStatus] ?? $testStatusMeta['unknown']; ?>
                            <span class="badge <?= $fivClass ?>"><?= h(strtoupper($fivLabel)) ?></span>

                            • FeLV:
                            <?php [$felvLabel, $felvClass] = $testStatusMeta[$felvStatus] ?? $testStatusMeta['unknown']; ?>
                            <span class="badge <?= $felvClass ?>"><?= h(strtoupper($felvLabel)) ?></span>
                            <?php endif; ?>
                        </div>
                        <?php if (($animal['status'] ?? '') === 'chat_libre'): $trackingLabels = ['present' => t('animal.present_on_site'),'missing' => t('animal.missing'),'moved' => t('animal.moved'),'deceased' => t('status.decede')]; ?>
                        <div class="card card-sm bg-green-lt border-green-lt mt-3">
                            <div class="card-body py-3">
                                <div class="d-flex flex-wrap align-items-center gap-2 mb-2"><strong>🌿
                                        <?= h(t('animal.free_cat_followup')) ?></strong><span
                                        class="badge bg-green text-white"><?= h($trackingLabels[$animal['free_cat_tracking_status'] ?? 'present'] ?? t('animal.present_on_site')) ?></span>
                                </div>
                                <div class="row g-2 small">
                                    <div class="col-md-4"><span
                                            class="text-muted"><?= h(t('animal.site_or_colony')) ?></span><br><strong><?= h($animal['free_cat_site_name'] ?: '—') ?></strong><?= !empty($animal['free_cat_city']) ? ' · ' . h($animal['free_cat_city']) : '' ?>
                                    </div>
                                    <div class="col-md-4"><span
                                            class="text-muted"><?= h(t('animal.caretaker')) ?></span><br><strong><?= h($freeCatCaretaker['name'] ?? '—') ?></strong>
                                    </div>
                                    <div class="col-md-4"><span
                                            class="text-muted"><?= h(t('animal.capture_release')) ?></span><br><?= !empty($animal['free_cat_captured_at']) ? h(date('d/m/Y', strtotime($animal['free_cat_captured_at']))) : '—' ?>
                                        →
                                        <?= !empty($animal['free_cat_released_at']) ? h(date('d/m/Y', strtotime($animal['free_cat_released_at']))) : '—' ?>
                                    </div><?php if (!empty($animal['free_cat_address'])): ?><div class="col-12"><span
                                            class="text-muted"><?= h(t('animal.internal_location')) ?></span><br><?= h($animal['free_cat_address']) ?>
                                    </div><?php endif; ?>
                                </div>
                            </div>
                        </div>
                        <?php endif; ?>
                        <?php if ($canViewMedical): ?>
                        <div class="mt-2 d-flex flex-wrap align-items-center gap-2">
                            <?php $sterilizationState = $animal['sterilization_status'] ?? (!empty($animal['sterilized']) ? 'yes' : 'unknown');
                            $sterilizationMeta = ['yes' => [t('animal.sterilized'),'bg-green-lt'],'no' => [t('animals.not_sterilized'),'bg-yellow-lt'],'unknown' => [t('animals.sterilization_unknown'),'bg-secondary-lt']];
                            [$sterilizationLabel,$sterilizationClass] = $sterilizationMeta[$sterilizationState] ?? $sterilizationMeta['unknown']; ?>
                            <span class="badge <?= h($sterilizationClass) ?>">
                                <?= h($sterilizationLabel) ?>
                            </span>
                            <?php if ($isCat): ?><span class="text-muted small"><?= h(t('animal.adoption_fee_hint')) ?>
                                <strong
                                    class="text-body"><?= $sterilizationState === 'yes' ? AppSettings::int('adoption_fee_sterilized') . ' €' : AppSettings::int('adoption_fee_unsterilized') . ' €' ?></strong></span><?php endif; ?>
                            <?php if ($sterilizationState === 'yes' && (!empty($animal['sterilization_date']) || !empty($sterilizationContacts))): ?><span
                                class="text-muted small"><?= !empty($animal['sterilization_date']) ? h(date('d/m/Y', strtotime((string)$animal['sterilization_date']))) : '' ?><?= !empty($sterilizationContacts['vet']['name']) ? ' · ' . h($sterilizationContacts['vet']['name']) : '' ?><?= !empty($sterilizationContacts['clinic']['name']) ? ' · ' . h($sterilizationContacts['clinic']['name']) : '' ?></span><?php endif; ?>
                        </div>
                        <?php endif; ?>
                        <?php $availability = $animal['adoption_availability'] ?? 'unknown';
$availabilityMeta = ['unknown' => [t('animal.availability_define'),'bg-secondary-lt'],'not_available' => [t('animals.unavailable_title'),'bg-orange-lt'],'available' => [t('animals.available_title'),'bg-green-lt']];
[$availabilityLabel,$availabilityClass] = $availabilityMeta[$availability] ?? $availabilityMeta['unknown'];
$registrationLabels = ['unknown' => t('animal.registration_unknown'),'pending' => t('animal.registration_pending'),'registered' => t('animal.registration_done')];
$registration = $animal['identification_registration_status'] ?? 'unknown';
$registrationClass = $registration === 'registered' ? 'bg-green-lt' : ($registration === 'pending' ? 'bg-yellow-lt' : 'bg-secondary-lt'); ?>
                        <div class="mt-2 d-flex flex-wrap align-items-center gap-1"><span
                                class="badge <?= h($registrationClass) ?>"><?= h($registrationLabels[$registration] ?? $registrationLabels['unknown']) ?></span><span
                                class="badge <?= h($availabilityClass) ?>"><?= h($availabilityLabel) ?></span><?php if (!empty($animal['website_published'])): ?><span
                                class="badge <?= $availability === 'available' ? 'bg-cyan-lt' : 'bg-yellow-lt' ?>">🌐
                                <?= h(t($availability === 'available' ? 'public_site.published' : 'public_site.waiting_publication')) ?></span><?php endif; ?><?php if ($availability === 'available' && !empty($animal['adoption_available_from'])): ?><span
                                class="text-muted small ms-1"><?= h(t('animal.available_from', ['date' => date('d/m/Y', strtotime((string)$animal['adoption_available_from']))])) ?></span><?php elseif ($availability === 'not_available' && !empty($animal['adoption_unavailability_reason'])): ?><span
                                class="text-muted small ms-1"><?= h($animal['adoption_unavailability_reason']) ?></span><?php endif; ?>
                        </div>
                    </div>
                </div>
                <div class="text-end d-flex justify-content-end gap-2">

                    <!-- Modifier -->
                    <?php if (!$isArchived): ?>
                    <a class="btn btn-primary d-flex align-items-center gap-1"
                        href="/animal/edit?id=<?= (int)$animal['id'] ?>">
                        <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="18" height="18" viewBox="0 0 24 24"
                            stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
                            stroke-linejoin="round">
                            <path stroke="none" d="M0 0h24v24H0z" fill="none" />
                            <path d="M12 20h9" />
                            <path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z" />
                        </svg>
                        <?= h(t('common.edit')) ?>
                    </a>

                    <!-- Ajouter -->
                    <div class="dropdown">
                        <button class="btn btn-success d-flex align-items-center gap-1 dropdown-toggle" type="button"
                            data-bs-toggle="dropdown" aria-expanded="false">
                            <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="18" height="18"
                                viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
                                stroke-linecap="round" stroke-linejoin="round">
                                <path stroke="none" d="M0 0h24v24H0z" fill="none" />
                                <path d="M12 5v14" />
                                <path d="M5 12h14" />
                            </svg>
                            <?= h(t('common.add')) ?>
                        </button>

                        <div class="dropdown-menu dropdown-menu-end shadow">
                            <?php if ($canViewMedical): ?>
                            <a class="dropdown-item" href="#" data-bs-toggle="modal"
                                data-bs-target="#modalMedicalStatus">
                                🧬 <?= h(t('animal.medical_status')) ?>
                            </a>
                            <div class="dropdown-divider"></div>
                            <a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#modalMedical">
                                🩺 <?= h(t('animal.medical_note')) ?>
                            </a>
                            <a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#modalTreatment">
                                💊 <?= h(t('animal.treatment')) ?>
                            </a>
                            <a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#modalVaccine">
                                💉 <?= h(t('animal.vaccine')) ?>
                            </a>
                            <a class="dropdown-item" href="#" data-bs-toggle="modal"
                                data-bs-target="#modalDewormingCatalog">
                                🪱 <?= h(t('animals.dewormer')) ?>
                            </a>
                            <a class="dropdown-item" href="#" data-bs-toggle="modal"
                                data-bs-target="#modalPrescription">📄
                                <?= h(t('medical_document.menu_prescription')) ?></a>
                            <a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#modalLabReport">🧪
                                <?= h(t('medical_document.menu_analysis')) ?></a>
                            <a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#modalExpense">💶
                                <?= h(t('animal.veterinary_expense')) ?></a>
                            <a class="dropdown-item" href="/animal/surgery/new?animal_id=<?= (int)$animal['id'] ?>">🏥
                                Chirurgie</a>
                            <?php endif; ?>
                            <?php if (empty($bondedGroup)): ?>
                            <div class="dropdown-divider"></div>
                            <a class="dropdown-item" href="/bonded/new?animal_id=<?= (int)$animal['id'] ?>">🔗
                                <?= h(t('animal.bonded_group')) ?></a>
                            <?php endif; ?>
                            <div class="dropdown-divider"></div>
                            <a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#modalPlacement">🏡
                                <?= h(t('animal.placement_return')) ?></a>
                        </div>
                    </div>

                    <!-- Actions secondaires -->
                    <div class="dropdown">
                        <button class="btn btn-outline-secondary dropdown-toggle" type="button"
                            data-bs-toggle="dropdown" aria-expanded="false">
                            <?= h(t('common.actions')) ?>
                        </button>

                        <div class="dropdown-menu dropdown-menu-end shadow animal-actions-menu">
                            <a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#modalAdoption">
                                🏠 <?= h(t('animal.validate_adoption')) ?>
                            </a>
                            <a class="dropdown-item" href="/animal/pdf?id=<?= (int)$animal['id'] ?>" target="_blank">
                                🖨 <?= h(t('common.print_record')) ?>
                            </a>

                            <div class="dropdown-divider"></div>
                            <?php if (!in_array((string)($animal['status'] ?? ''), ['decede','décédé'], true)): ?>
                            <a class="dropdown-item text-dark" href="/animal/death?id=<?= (int)$animal['id'] ?>">🌈
                                <?= h(t('animal.record_death')) ?>
                            </a>
                            <div class="dropdown-divider"></div>
                            <?php endif; ?>

                            <form method="post" action="/animal/archive"
                                onsubmit="return confirm(<?= h(json_encode(t('animal.archive_confirm'), JSON_HEX_APOS | JSON_HEX_QUOT)) ?>);">
                                <input type="hidden" name="id" value="<?= (int)$animal['id'] ?>">
                                <button class="dropdown-item" type="submit">
                                    📦 <?= h(t('animal.archive')) ?>
                                </button>
                            </form>
                            <form method="post" action="/animal/delete"
                                onsubmit="const reason = prompt(<?= h(json_encode(t('animal.trash_reason'), JSON_HEX_APOS | JSON_HEX_QUOT)) ?>, <?= h(json_encode(t('animal.trash_default_reason'), JSON_HEX_APOS | JSON_HEX_QUOT)) ?>); if (reason === null) return false; this.elements.reason.value = reason; return confirm(<?= h(json_encode(t('animal.trash_confirm'), JSON_HEX_APOS | JSON_HEX_QUOT)) ?>);">
                                <input type="hidden" name="id" value="<?= (int)$animal['id'] ?>">
                                <input type="hidden" name="reason" value="">
                                <button class="dropdown-item text-dark" type="submit">🗑
                                    <?= h(t('animal.move_to_trash')) ?></button>
                            </form>
                        </div>
                    </div>

                    <!-- Retour -->
                    <?php else: ?>
                    <a class="btn btn-primary d-flex align-items-center gap-1"
                        href="/animal/edit?id=<?= (int)$animal['id'] ?>">✏️ <?= h(t('common.edit')) ?></a>
                    <a class="btn btn-outline-secondary" href="/animal/pdf?id=<?= (int)$animal['id'] ?>"
                        target="_blank">🖨 <?= h(t('common.print_record')) ?></a>
                    <form method="post" action="/animal/restore"
                        onsubmit="return confirm(<?= h(json_encode(t('inactive.restore_confirm'), JSON_HEX_APOS | JSON_HEX_QUOT)) ?>);">
                        <input type="hidden" name="csrf" value="<?= h(Auth::csrf()) ?>"><input type="hidden" name="id"
                            value="<?= (int)$animal['id'] ?>"><button class="btn btn-success"
                            type="submit"><?= h(t('common.restore')) ?></button></form>
                    <?php endif; ?>
                    <a class="btn btn-ghost-secondary" href="<?= $isArchived ? '/animals/archived' : '/animals' ?>">
                        ← <?= h(t('common.back')) ?>
                    </a>

                </div>
            </div>
        </div>



        <div class="col-12">

            <div class="mt-">

                <ul id="submenus" class="nav nav-tabs nav-tabs-alt mt-3 mb-0">
                    <li class="nav-item"><a href="#tab-ident" class="nav-link active" data-bs-toggle="tab">🧬
                            <?= h(t('animal.tab.identity')) ?></a></li>
                    <li class="nav-item"><a href="#tab-activity" class="nav-link" data-bs-toggle="tab">📊
                            <?= h(t('animal.tab.activity')) ?></a></li>
                    <?php if ($canViewMedical): ?>
                    <li class="nav-item"><a href="#tab-med" class="nav-link" data-bs-toggle="tab">❤️
                            <?= h(t('animal.tab.medical')) ?></a></li>
                    <li class="nav-item"><a href="#tab-trt" class="nav-link" data-bs-toggle="tab">💊
                            <?= h(t('animal.tab.treatments')) ?></a></li>
                    <li class="nav-item"><a href="#tab-vac" class="nav-link" data-bs-toggle="tab">💉
                            <?= h(t('animal.tab.vaccines')) ?></a></li>
                    <?php endif; ?>
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" id="animalMoreTabs" href="#" data-bs-toggle="dropdown"
                            role="button" aria-expanded="false"><?= h(t('animal.tab.more')) ?></a>
                        <div class="dropdown-menu shadow">
                            <a href="#tab-locations" class="dropdown-item" data-bs-toggle="tab">📍
                                <?= h(t('animal.tab.locations')) ?></a>
                            <a href="#tab-placements" class="dropdown-item" data-bs-toggle="tab">🏡
                                <?= h(t('animal.tab.placements')) ?></a>
                            <?php if ($isCat): ?><a href="#tab-litters" class="dropdown-item" data-bs-toggle="tab">🐾
                                <?= h(t('animal.tab.litters')) ?></a><?php endif; ?>
                            <?php if ($canViewMedical): ?><a href="#tab-documents" class="dropdown-item"
                                data-bs-toggle="tab">📄 <?= h(t('animal.tab.documents')) ?></a><?php endif; ?>
                            <div class="dropdown-divider"></div>
                            <a href="#tab-hist" class="dropdown-item" data-bs-toggle="tab">🕒
                                <?= h(t('animal.tab.history')) ?></a>
                            <a href="#tab-photos" class="dropdown-item" data-bs-toggle="tab">📷
                                <?= h(t('animal.tab.photos')) ?></a>
                        </div>
                    </li>
                </ul>

            </div>

            <div class="card border-top-0 rounded-top-0">
                <div class="card-body">
                    <div class="tab-content">

                        <?php require __DIR__ . '/_animal_show_identity.php'; ?>

                        <?php require __DIR__ . '/_animal_show_locations.php'; ?>

                        <?php require __DIR__ . '/_animal_show_activity.php'; ?>

                        <?php require __DIR__ . '/_animal_show_medical.php'; ?>

                        <?php require __DIR__ . '/_animal_show_litters.php'; ?>

                        <?php require __DIR__ . '/_animal_show_documents.php'; ?>

                        <?php require __DIR__ . '/_animal_show_history.php'; ?>

                        <?php require __DIR__ . '/_animal_show_photos.php'; ?>

                        <?php require __DIR__ . '/_animal_show_modals.php'; ?>
