﻿
:root {
    --bg-body: #f9fafb;
    --brand-primary: #2d5a4c;
    --brand-eyebrow: #5a8c6f;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    overflow-x: hidden;
}

img {
    max-width: 100%;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 8px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: #94a3b8;
    }

/* Textos */

.text-eyebrow {
    color: var(--brand-eyebrow);
    font-size: .72rem;
    letter-spacing: 1px;
    font-weight: 700;
}

.text-xs {
    font-size: .75rem;
}

.text-sm {
    font-size: .875rem;
}

/* Botones */

.btn-primary-custom {
    background-color: var(--brand-primary);
    color: #fff;
    font-weight: 600;
    border: 1px solid var(--brand-primary);
    transition: background-color .2s ease;
}

    .btn-primary-custom:hover,
    .btn-primary-custom:focus {
        background-color: #1e3f34;
        border-color: #1e3f34;
        color: #fff;
    }

    .btn-primary-custom:active {
        background-color: #173329 !important;
        border-color: #173329 !important;
        color: #fff !important;
    }

/* Contenedor principal */

.animal-page {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 1.5rem;
}

/* Estadísticas */

.stat-card {
    padding: 1rem !important;
    min-width: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
    transition: transform .2s ease;
}

    .stat-card:hover {
        transform: translateY(-2px);
    }

.icon-circle {
    width: 30px;
    height: 30px;
    min-width: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
}

.icon-gray {
    background-color: #f3f4f6;
    color: #6b7280;
}

.icon-green {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.icon-yellow {
    background-color: #fff3e0;
    color: #e65100;
}

.icon-blue {
    background-color: #e3f2fd;
    color: #1565c0;
}

/* Estados */

.status-badge {
    display: inline-block;
    font-size: .72rem;
    font-weight: 600;
    padding: .4rem .65rem;
    white-space: nowrap;
}

.badge-disponible {
    background-color: #d1e7dd;
    color: #0f5132;
}

.badge-tratamiento {
    background-color: #fff3cd;
    color: #856404;
}

.badge-adoptado {
    background-color: #cff4fc;
    color: #055160;
}

/* Tabla */

.table-container {
    min-width: 0;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.table-responsive {
    width: 100%;
    max-height: 400px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    min-width: 720px;
    margin-bottom: 0;
}

    .table thead th {
        position: sticky;
        top: 0;
        z-index: 2;
        background-color: #fff;
        color: var(--text-muted);
        font-size: .7rem;
        letter-spacing: .4px;
        padding: .85rem .75rem;
        white-space: nowrap;
        box-shadow: 0 1px 0 var(--border-color);
    }

    .table td {
        padding: .8rem .75rem;
        color: var(--text-main);
        vertical-align: middle;
    }

    .table tbody tr {
        border-bottom: 1px solid var(--border-color);
    }

        .table tbody tr:last-child {
            border-bottom: none;
        }

.avatar-img {
    width: 38px;
    height: 38px;
    min-width: 38px;
    object-fit: cover;
}

/* Acciones */

.animal-actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .65rem;
}

.animal-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color .2s, color .2s;
}

    .animal-action:hover {
        background-color: #f3f4f6;
        color: var(--brand-primary);
    }

/* Paginación */

.page-item.active .page-link {
    background-color: #e8f5e9;
    color: var(--brand-primary);
    border-color: transparent;
    border-radius: 50%;
    font-weight: 600;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 50%;
}

    .page-link:hover {
        background-color: #f3f4f6;
        color: var(--text-main);
    }

.page-item.disabled .page-link {
    background: transparent;
    color: #cbd5e1;
}

/* Controles y filtros */

.table-controls {
    min-width: 0;
}

.animal-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    width: 100%;
    max-width: 100%;
}

    .animal-filters .form-select {
        flex: 1 1 180px;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        height: 42px;
        padding: .5rem 2.25rem .5rem .75rem;
        font-size: .85rem;
        line-height: 1.4;
        color: var(--text-main);
        background-color: #fff;
        border: 1px solid var(--border-color);
        border-radius: 10px;
        box-shadow: none;
        text-overflow: ellipsis;
        cursor: pointer;
    }

        .animal-filters .form-select:hover {
            border-color: #cbd5e1;
        }

        .animal-filters .form-select:focus {
            border-color: var(--brand-eyebrow);
            box-shadow: 0 0 0 .2rem rgba(45, 90, 76, .12);
            outline: none;
        }

/* Formularios */

.form-control,
.form-select {
    max-width: 100%;
}

    .form-control:focus,
    .form-select:focus {
        border-color: var(--brand-eyebrow);
        box-shadow: 0 0 0 .2rem rgba(45, 90, 76, .12);
    }

.form-label {
    margin-bottom: .35rem;
    color: #374151;
    font-size: .85rem;
}

/* Modal y pestañas */

.custom-tabs-container {
    display: flex;
    width: 100%;
    background-color: #f3f4f6;
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
}

.custom-tab {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 600;
    overflow-wrap: anywhere;
    transition: all .2s ease;
}

    .custom-tab.active {
        background-color: #fff;
        color: var(--brand-primary);
        box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
    }

.animal-modal-dialog {
    width: calc(100% - 2rem);
    max-width: 800px;
    margin: 1rem auto;
}

.animal-modal-content {
    max-height: calc(100dvh - 2rem);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

    .animal-modal-content .modal-header {
        position: sticky;
        top: 0;
        z-index: 5;
        background-color: #fff;
    }

    .animal-modal-content .modal-footer {
        position: sticky;
        bottom: 0;
        z-index: 5;
        background-color: #fff;
    }

.animal-photo {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 120px;
    object-fit: contain;
    object-position: left center;
}

/* Móviles y tablets */

@media (max-width: 767.98px) {

    .animal-page {
        padding: 1rem .75rem;
    }

        /* Encabezado */

        .animal-page .page-heading {
            align-items: stretch !important;
            gap: .75rem !important;
            margin-bottom: 1.25rem !important;
        }

            .animal-page .page-heading h2 {
                font-size: 1.5rem !important;
            }

            /* Botón Nuevo registro */

            .animal-page .page-heading #btnNuevoRegistro {
                display: flex !important;
                align-items: center;
                justify-content: center;
                gap: .5rem;
                width: 100%;
                min-height: 42px;
                padding: .65rem 1rem !important;
                background-color: #2d5a4c !important;
                color: #fff !important;
                border: 1px solid #2d5a4c !important;
                border-radius: 10px !important;
                opacity: 1 !important;
                visibility: visible !important;
                font-size: .9rem;
                font-weight: 600;
                box-shadow: none;
            }

                .animal-page .page-heading #btnNuevoRegistro i,
                .animal-page .page-heading #btnNuevoRegistro span {
                    color: #fff !important;
                }

                .animal-page .page-heading #btnNuevoRegistro:hover,
                .animal-page .page-heading #btnNuevoRegistro:focus {
                    background-color: #1e3f34 !important;
                    border-color: #1e3f34 !important;
                    color: #fff !important;
                }

        /* Tarjetas compactas */

        .animal-page .stats-row {
            margin-top: 0 !important;
            --bs-gutter-x: .5rem;
            --bs-gutter-y: .5rem;
        }

        .animal-page .stat-card {
            padding: .55rem !important;
            border-radius: 10px !important;
        }

            .animal-page .stat-card .d-flex {
                gap: .3rem;
            }

            .animal-page .stat-card .text-xs {
                font-size: .65rem;
                line-height: 1.25;
            }

            .animal-page .stat-card .fs-4 {
                font-size: 1.15rem !important;
                line-height: 1.2;
                overflow-wrap: anywhere;
            }

            .animal-page .stat-card p {
                font-size: .65rem;
                margin-top: .2rem !important;
            }

            .animal-page .stat-card .icon-circle {
                width: 24px;
                height: 24px;
                min-width: 24px;
                font-size: .7rem;
            }

        /* Filtros */

        .animal-page .table-controls {
            align-items: stretch !important;
            gap: .75rem !important;
            margin-top: 1.25rem !important;
        }

            .animal-page .table-controls > div:first-child {
                display: flex;
                align-items: baseline;
                justify-content: space-between;
                flex-wrap: wrap;
                gap: .5rem;
            }

        .animal-page .animal-filters {
            display: grid;
            grid-template-columns: minmax(0, 1fr);
            gap: .65rem;
            width: 100%;
        }

            .animal-page .animal-filters .form-select {
                display: block;
                width: 100%;
                min-width: 0;
                max-width: 100%;
                height: 44px;
                flex: none;
                padding: .6rem 2.25rem .6rem .75rem;
                font-size: 16px;
                white-space: nowrap;
                text-overflow: ellipsis;
            }

        /* Tabla */

        .animal-page .table-container {
            margin-bottom: 1.5rem !important;
            border-radius: 12px !important;
        }

        .animal-page .table-responsive {
            max-height: 55dvh;
            overflow-x: auto;
            overflow-y: auto;
        }

        .animal-page .table {
            min-width: 720px;
        }

            .animal-page .table thead th {
                padding: .75rem .6rem;
                font-size: .66rem;
            }

            .animal-page .table td {
                padding: .7rem .6rem;
                font-size: .8rem;
            }

            .animal-page .table .ps-4 {
                padding-left: .75rem !important;
            }

            .animal-page .table .pe-4 {
                padding-right: .75rem !important;
            }

        /* Pie de tabla */

        .animal-page .table-footer {
            display: flex;
            flex-direction: column;
            align-items: stretch !important;
            gap: .75rem;
            padding: .85rem .75rem !important;
        }

            .animal-page .table-footer > span {
                margin: 0 !important;
                text-align: center;
            }

            .animal-page .table-footer nav {
                display: flex;
                justify-content: center;
                width: 100%;
            }

        .animal-page .pagination {
            flex-wrap: wrap;
            justify-content: center;
        }

    /* Modal */

    .animal-modal-dialog {
        width: calc(100% - 1rem);
        max-width: none;
        margin: .5rem auto;
    }

    .animal-modal-content {
        max-height: calc(100dvh - 1rem);
        border-radius: 16px !important;
        padding: .25rem !important;
    }

        .animal-modal-content .modal-header {
            padding: 1rem .75rem .5rem;
        }

        .animal-modal-content .modal-title {
            font-size: 1.25rem !important;
        }

        .animal-modal-content .modal-header p {
            max-width: 260px;
            line-height: 1.4;
        }

        .animal-modal-content .modal-body {
            padding: .75rem;
        }

        .animal-modal-content .modal-footer {
            display: flex;
            flex-wrap: nowrap;
            gap: .5rem !important;
            padding: .75rem;
        }

            .animal-modal-content .modal-footer .btn {
                min-height: 42px;
                margin: 0;
            }

            .animal-modal-content .modal-footer #btnGuardarAnimal {
                flex: 1;
                min-width: 0;
                padding-right: .75rem !important;
                padding-left: .75rem !important;
                white-space: normal;
            }

            .animal-modal-content .modal-footer [data-bs-dismiss="modal"] {
                flex-shrink: 0;
                padding-right: .5rem;
                padding-left: .5rem;
            }

        .animal-modal-content .row.g-3 {
            --bs-gutter-x: .75rem;
            --bs-gutter-y: .85rem;
        }

        .animal-modal-content .col-md-6 {
            width: 100%;
        }

        .animal-modal-content .form-control,
        .animal-modal-content .form-select {
            width: 100%;
            min-height: 43px;
            font-size: 16px;
        }

        .animal-modal-content textarea.form-control {
            min-height: 95px;
        }

        .animal-modal-content .custom-tabs-container {
            margin-bottom: 1rem !important;
        }

        .animal-modal-content .custom-tab {
            padding: .7rem .4rem;
            font-size: .78rem;
        }
}

/* Teléfonos pequeños */

@media (max-width: 360px) {

    .animal-page {
        padding-right: .5rem;
        padding-left: .5rem;
    }

        .animal-page .stat-card {
            padding: .45rem !important;
        }

            .animal-page .stat-card .text-xs,
            .animal-page .stat-card p {
                font-size: .6rem;
            }

            .animal-page .stat-card .fs-4 {
                font-size: 1rem !important;
            }

            .animal-page .stat-card .icon-circle {
                width: 22px;
                height: 22px;
                min-width: 22px;
            }

    .animal-modal-content .modal-title {
        font-size: 1.1rem !important;
    }

    .animal-modal-content .modal-footer .btn {
        font-size: .8rem;
    }
}

/* Escritorio */

@media (min-width: 768px) {

    .animal-modal-content .col-md-6 {
        width: 50%;
    }

    .animal-page .animal-filters {
        width: auto;
        max-width: 100%;
    }

        .animal-page .animal-filters .form-select {
            flex: 0 1 auto;
            width: 200px;
        }
}

