/* ============================================================
   Tandem Desing - Custom overrides sobre Materio
   ============================================================ */

/* ---- Popups AJAX (DesignTools _Create / _Edit / _Delete) ---- */

/* Backdrop oscuro detras del popup */
#Loading {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background-color: rgba(75, 70, 92, 0.55) !important;
    opacity: 1 !important;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    cursor: pointer;
    z-index: 1190 !important;
}

/* Carcasa del popup: card blanca centrada con sombra fuerte */
.tandem-popup-shell {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: min(750px, 92vw) !important;
    max-height: 90vh;
    overflow-y: auto;
    background-color: #fff !important;
    border-radius: 0.75rem !important;
    box-shadow: 0 1.25rem 3rem rgba(75, 70, 92, 0.45),
                0 0.5rem 1.5rem rgba(75, 70, 92, 0.25) !important;
    border: 1px solid rgba(75, 70, 92, 0.1) !important;
    z-index: 1200 !important;
}

.tandem-popup-content {
    width: 100%;
    height: auto;
}

/* El contenido AJAX (_Create/_Edit/_Delete) ya viene con clase .tandem-popup */
.tandem-popup-shell .tandem-popup {
    background-color: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
}


/* ---- Auth pages: skyline + tarjeta centrada ---- */
.tandem-login-skyline {
    width: 100%;
    max-width: 2200px;
    height: auto;
    max-height: 430px;
    object-fit: contain;
    object-position: center bottom;
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 46px;
    z-index: 0;
    pointer-events: none;
    opacity: 0.96;
    mix-blend-mode: multiply;
    filter: contrast(1.08);
}

.tandem-auth-inner {
    position: relative;
    min-height: calc(100vh - 3rem);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 2.25rem;
}

.tandem-auth-inner .card {
    position: relative;
    z-index: 2;
}

/* ---- DataTables (Bootstrap 5) integracion con Materio ---- */
.dataTables_wrapper {
    padding: 0.5rem 0;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    margin: 0.5rem 0;
}

.dataTables_wrapper .dataTables_filter input.form-control-sm,
.dataTables_wrapper .dataTables_length select.form-select-sm {
    border-radius: 0.5rem;
    border: 1px solid var(--bs-border-color);
}

.dataTables_wrapper .dataTables_filter input {
    margin-left: 0.5rem;
}

.dataTables_wrapper table.dataTable thead th,
.dataTables_wrapper table.dataTable thead td {
    background-color: transparent;
    border-bottom: 1px solid var(--bs-border-color);
    color: var(--bs-heading-color);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.8125rem;
    letter-spacing: 0.5px;
    padding: 0.875rem 1rem;
}

.dataTables_wrapper table.dataTable tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

.dataTables_wrapper table.dataTable tbody tr:hover {
    background-color: var(--bs-gray-50);
}

.dataTables_wrapper .dt-buttons .btn {
    margin-right: 0.25rem;
}

.dataTables_wrapper .pagination .page-link {
    border-radius: 0.5rem;
    margin: 0 2px;
    border: none;
}

.dataTables_wrapper .pagination .page-item.active .page-link {
    background-color: var(--bs-primary);
    color: #fff;
}

/* ---- Botones de accion en tablas (editar, eliminar, etc.) ---- */
table.dataTable .btn-icon,
table.dataTable .btn-action {
    padding: 0.25rem 0.5rem;
    margin: 0 1px;
    border-radius: 0.375rem;
}

/* La ultima columna (Acciones) en DataTables siempre debe acomodar los iconos */
table.dataTable td:last-child,
table.dataTable th:last-child {
    white-space: nowrap;
    min-width: 8rem;
}

/* Forzar que los iconos/botones embebidos en celdas no se rompan */
table.dataTable td a,
table.dataTable td button,
table.dataTable td .btn {
    white-space: nowrap;
}

/* Pequeno reset: imagenes y elementos dentro de celdas se alinean */
table.dataTable td img {
    vertical-align: middle;
}

/* ---- Cards: pequenos ajustes ---- */
.card .card-body {
    padding: 1.25rem 1.5rem;
}

/* ---- Forzar que los enlaces dentro de breadcrumb h4 sean discretos ---- */
h4 .text-muted a {
    color: inherit;
    text-decoration: none;
}
h4 .text-muted a:hover {
    color: var(--bs-primary);
    text-decoration: underline;
}

/* ---- Botones legacy (.btn-success, .btn-warning con success class) ---- */
a.success {
    color: var(--bs-success) !important;
    text-decoration: none;
}

/* Filled buttons must keep white foreground text */
.btn-primary,
.btn-success,
.btn-info,
.btn-danger,
.btn-warning {
    color: #fff !important;
}

/* ---- Compatibilidad: estilos de la app vieja que aun se usan ---- */
.well {
    background: var(--bs-card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.TopMenu {
    background: var(--bs-card-bg);
    border-radius: var(--bs-border-radius);
    box-shadow: var(--bs-box-shadow-sm);
}

/* ---- DataTables Buttons (export, columns, etc.) collection dropdown ---- */
div.dt-button-collection {
    background: #E8E5F3;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    box-shadow: var(--bs-box-shadow);
    padding: 0.5rem;
    width: 14rem !important;
    min-width: 14rem !important;
    max-width: 14rem !important;
    z-index: 1080;
    inset: auto !important;
    position: absolute !important;
}

div.dt-button-collection h5 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--bs-secondary-color);
    margin: 0.5rem 0.75rem 0.25rem;
    padding: 0;
    border: none;
}

div.dt-button-collection h5.not-top-heading {
    margin-top: 0.5rem;
    border-top: 1px solid var(--bs-border-color);
    padding-top: 0.75rem;
}

div.dt-button-collection .dt-button,
div.dt-button-collection button.dt-button,
div.dt-button-collection a.dt-button {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--bs-body-color);
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.9375rem;
    margin: 0;
    box-shadow: none;
}

div.dt-button-collection .dt-button:hover,
div.dt-button-collection button.dt-button:hover,
div.dt-button-collection a.dt-button:hover {
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
}

div.dt-button-collection .dt-button.active,
div.dt-button-collection button.dt-button.active {
    background: var(--bs-primary);
    color: #fff;
}

/* Boton trigger (el de "<i class=fas fa-bars>") */
.dt-buttons .btn.custom-html-collection,
.dt-buttons .buttons-collection {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff;
    border-radius: 0.5rem;
    padding: 0.375rem 0.75rem;
}

.dt-buttons .btn.custom-html-collection:hover,
.dt-buttons .buttons-collection:hover {
    background: color-mix(in sRGB, var(--bs-primary) 85%, #000);
    color: #fff;
}

/* Backdrop oscuro detras del dropdown - quitar */
div.dt-button-background {
    display: none !important;
}

/* Sub-dropdowns como pageLength y colvis dentro del collection */
div.dt-button-collection .dt-button-collection-inner select,
div.dt-button-collection select {
    border-radius: 0.5rem;
    border: 1px solid var(--bs-border-color);
    padding: 0.25rem 0.5rem;
    margin: 0.25rem 0.75rem;
}
