﻿/* Estilos personalizados para DataTables */

.dataTables_wrapper .pagination .page-link {
    border-radius: 12px !important;
    border: 2px solid #B54885 !important;
}

.dataTables_wrapper .pagination .page-item .page-link {
    color: #B54885 !important;
    border-color: #B54885 !important;
}

.dataTables_wrapper .pagination .page-item.active .page-link {
    background-color: #B54885 !important;
    border-color: #B54885 !important;
    color: #FFFFFF !important;
}

.dataTables_wrapper .pagination .page-item .page-link:hover {
    background-color: #A04077 !important;
    color: #FFFFFF !important;
    border-color: #A04077 !important;
}

.dataTables_wrapper .pagination .page-item.active .page-link:focus {
    box-shadow: none !important;
}

.dataTables_wrapper .dataTables_paginate {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex-wrap: nowrap; /* No permite que los botones salten de línea */
    justify-content: center;
    align-items: center;
    gap: 0; /* Elimina el espacio entre botones */
    width: 100%;
    box-sizing: border-box;
    padding: 8px 0;
    overflow-x: auto;
}

    .dataTables_wrapper .dataTables_paginate .paginate_button {
        min-width: 80px;
        max-width: 110px;
        padding: 6px 10px;
        margin: 0 8px 0 0; /* Espaciado entre botones */
        font-size: 0.95em;
        border-radius: 12px;
        word-break: keep-all;
        text-align: center;
        box-sizing: border-box;
        transition: background 0.2s;
        color: #B54885 !important;
        font-family: "Sono", sans-serif;
        font-weight: 500;
    }

        /* SOLO para los botones de texto largo, permite salto de línea */
        .dataTables_wrapper .dataTables_paginate .paginate_button.btn-paginacion-larga {
            border: 2px solid #B54885 !important;
            background-color: #FFFFFF !important;
            white-space: normal !important;
            word-break: normal !important; /* Evita cortar palabras */
            line-height: 1.1;
            min-width: 120px;
            max-width: 140px;
            font-size: 0.95em;
            padding: 6px 10px;
        }

         /* Activo */
            .dataTables_wrapper .dataTables_paginate .paginate_button.btn-paginacion-larga.current,
            .dataTables_wrapper .dataTables_paginate .paginate_button.btn-paginacion-larga.active {
                background-color: #B54885 !important;
                border-color: #B54885 !important;
                color: #FFFFFF !important;
            }

        /* Hover */
            .dataTables_wrapper .dataTables_paginate .paginate_button.btn-paginacion-larga:hover {
                background-color: #A04077 !important;
                color: #FFFFFF !important;
                border-color: #A04077 !important;
            }

            /* Botones de paginación deshabilitados (texto largo y números) */
            .dataTables_wrapper .dataTables_paginate .paginate_button.btn-paginacion-larga.disabled {
                border: 2px solid #B54885 !important;
                background-color: #E9ECEF !important; /* Gris claro */
                cursor: not-allowed !important;
                pointer-events: none !important;
                opacity: 1 !important;
            }

@media (max-width: 600px) {
    .dataTables_wrapper .dataTables_paginate {
        font-size: 0.95em;
        gap: 2px;
        padding: 4px 0;
    }

        .dataTables_wrapper .dataTables_paginate .paginate_button {
            font-size: 0.90em;
            padding: 4px 6px;
        }

            .dataTables_wrapper .dataTables_paginate .paginate_button.btn-paginacion-larga {
                min-width: 110px; /* Más ancho en móviles */
                max-width: 130px;
                font-size: 0.90em;
                padding: 4px 6px;
            }
}

/* Estilos personalizados para el dropdown de menú de longitud (LengthMenu) del DataTable */

.dataTables_wrapper .dataTables_length select {
    display: none !important;
}

.custom-dropdown-button {
    border: 2px solid #E9ECEF;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    min-width: 50px;
    background-color: #F8F9FA;
    font-size: 14px;
    font-weight: 500;
    color: #2C2C2C;
    cursor: pointer;
    position: relative;
    text-align: left;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

    .custom-dropdown-button:after {
        content: '▼';
        position: absolute;
        right: 8px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 10px;
        color: #2C2C2C;
    }

    .custom-dropdown-button:hover,
    .custom-dropdown-button:focus,
    .custom-dropdown-button.open {
        border-color: #B54885 !important;
        border-width: 2px !important;
        box-shadow: 0 0 0 0.2rem rgba(226, 122, 176, 0.25) !important;
    }

.custom-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #FFFFFF;
    border: 2px solid #B54885;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    display: none;
    max-height: 200px;
    overflow-y: auto;
}

    .custom-dropdown-menu.show {
        display: block;
    }

.custom-dropdown-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #2C2C2C;
    border-bottom: 1px solid #F8F9FA;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

    .custom-dropdown-item:last-child {
        border-bottom: none;
    }

    .custom-dropdown-item:hover {
        background-color: #CC8FAE;
        color: #FFFFFF;
    }

    .custom-dropdown-item.active {
        background-color: #B54885;
        color: #FFFFFF;
    }

/* Fijar los componentes de DataTable al hacer scroll horizontal */

.dataTables_wrapper {
    overflow-x: auto;
    width: 100%;
    position: relative;
}

/* Agrupa los controles en una sola fila horizontal superior */
.dt-toolbar {
    position: sticky;
    left: 0;
    top: 0;
    z-index: 30;
    gap: 1rem;
    padding-bottom: 0.5rem;
}

.dt-info-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    position: sticky;
    left: 0;
    bottom: 3.5rem;
    z-index: 40;
    width: 100%;
    padding: 0.5rem 0 0.25rem 0;
    box-sizing: border-box;
}

    .dt-info-bar .dataTables_info {
        position: sticky;
        left: 0;
        z-index: 41;
        display: block;
        margin-left: 0;
        margin-right: 0;
        text-align: center;
        width: auto;
    }

.dt-paginate-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    position: sticky;
    left: 0;
    bottom: 0;
    z-index: 41;
    width: 100%;
    padding: 0.25rem 0 0.5rem 0;
    box-sizing: border-box;
}

    .dt-paginate-bar .dataTables_paginate {
        position: sticky;
        left: 0;
        z-index: 42;
        display: block;
        margin-left: 0;
        margin-right: 0;
        text-align: center;
        width: auto;
    }

/* Todos los controles superiores con sticky horizontal */
.dataTables_wrapper .dt-buttons,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .custom-length-dropdown,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_paginate {
    position: sticky;
    left: 0;
    z-index: 20;
    top: 0; /* Si quieres que también sean sticky verticalmente */
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .custom-length-dropdown {
    display: block;
}

.table-responsive {
    overflow-x: unset !important;
}

/* Flechas de ordenamiento para DataTables */
th.sorting::after,
th.sorting_asc::after,
th.sorting_desc::after {
    font-family: "Font Awesome 6 Free", "Arial", sans-serif;
    font-weight: 900;
    margin-left: 8px;
    font-size: 0.8em;
    color: lightgray;
    vertical-align: middle;
    display: inline-block;
}

th.sorting::after {
    content: "\f0dc"; /* fa-sort (FontAwesome) o usa "⇅" si no tienes FontAwesome */
}

th.sorting_asc::after {
    content: "\f0de"; /* fa-sort-up (FontAwesome) o usa "↑" */
}

th.sorting_desc::after {
    content: "\f0dd"; /* fa-sort-down (FontAwesome) o usa "↓" */
}