/* ===========================
   INICIO: REPORTES
   Descripción: Archivo comentado para identificar claramente el propósito general y los bloques internos de lógica/estilos.
=========================== */

.reportes-table tbody td:nth-child(2),
.reportes-table tbody td:nth-child(3),
.reportes-table tbody td:nth-child(4),
.reportes-table thead th:nth-child(3),
.reportes-table thead th:nth-child(4) {
    text-align: center;
}

.orange-ambient-section {
    background: radial-gradient(circle at top, rgba(249, 115, 22, 0.07), transparent 58%), #000000;
}

.orange-ambient-panel {
    background: linear-gradient(170deg, rgba(16, 18, 24, 0.95), rgba(7, 9, 14, 0.95));
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 22px 40px rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
}

.deck-step-card {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

.collapsible-panel {
    max-height: 0;
    opacity: 0;
    transform: translateY(-6px);
    overflow: hidden;
    pointer-events: none;
    transition: max-height 0.45s ease, opacity 0.35s ease, transform 0.35s ease;
}

.collapsible-panel.is-open {
    max-height: 2500px;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.deck-selector-modal {
    background: linear-gradient(170deg, rgba(16, 18, 24, 0.98), rgba(7, 9, 14, 0.98));
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.65);
}


.report-date-input {
    position: relative;
}

.ui-datepicker {
    z-index: 1200 !important;
    width: 17rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 0.75rem;
    padding: 0.5rem;
    background: linear-gradient(170deg, rgba(18, 20, 27, 0.98), rgba(8, 10, 16, 0.98));
    color: #e5e7eb;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.55);
}

.ui-datepicker .ui-datepicker-header {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.7rem;
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.72), rgba(15, 23, 42, 0.9));
    color: #fff;
    padding: 0.3rem 0.45rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.ui-datepicker .ui-datepicker-title select {
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 0.4rem;
    background-color: rgba(15, 23, 42, 0.96);
    background-image:
        linear-gradient(135deg, rgba(251, 146, 60, 0.14), rgba(56, 189, 248, 0.18)),
        linear-gradient(45deg, transparent 50%, rgba(248, 250, 252, 0.92) 50%),
        linear-gradient(135deg, rgba(248, 250, 252, 0.92) 50%, transparent 50%);
    background-position: center, calc(100% - 0.82rem) 49%, calc(100% - 0.56rem) 49%;
    background-size: auto, 0.38rem 0.38rem, 0.38rem 0.38rem;
    background-repeat: no-repeat;
    color: #f8fafc;
    padding: 0.3rem 1.75rem 0.3rem 0.7rem;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.25;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.ui-datepicker .ui-datepicker-month {
    min-width: 4.5rem;
}

.ui-datepicker .ui-datepicker-year {
    min-width: 4.7rem;
}

.ui-datepicker .ui-datepicker-title select:focus {
    outline: none;
    border-color: rgba(56, 189, 248, 0.72);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.22);
}

.ui-datepicker .ui-datepicker-title select:hover {
    border-color: rgba(251, 146, 60, 0.65);
    transform: translateY(-1px);
}

.ui-datepicker .ui-datepicker-title select option {
    background: #111827;
    color: #f8fafc;
}

.ui-datepicker table {
    margin-top: 0.45rem;
}

.ui-datepicker th {
    color: #f1f5f9;
    font-weight: 700;
}

.ui-datepicker .ui-state-default {
    border: 0;
    background: transparent;
    color: #f8fafc;
    text-align: center;
    border-radius: 0.45rem;
}

.ui-datepicker .ui-state-hover,
.ui-datepicker .ui-state-active,
.ui-datepicker .ui-state-highlight {
    border: 0;
    background: rgba(251, 146, 60, 0.35);
    color: #fff;
}

.ui-datepicker td.ui-datepicker-other-month .ui-state-default {
    color: rgba(248, 250, 252, 0.46);
}

.ui-datepicker .ui-datepicker-prev,
.ui-datepicker .ui-datepicker-next {
    top: 5px;
    cursor: pointer;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 0.45rem;
    background: rgba(148, 163, 184, 0.2);
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.ui-datepicker .ui-datepicker-prev:hover,
.ui-datepicker .ui-datepicker-next:hover {
    background: rgba(56, 189, 248, 0.32);
    transform: translateY(-1px);
}

.ui-datepicker .ui-icon {
    filter: invert(1);
    opacity: 0.8;
}



.deck-selector-option {
    width: 100%;
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    padding: 0.55rem;
    text-align: left;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.deck-selector-option:hover {
    border-color: rgba(249, 115, 22, 0.7);
    background: rgba(249, 115, 22, 0.12);
}

.deck-selector-option-accent {
    display: flex;
    gap: 0.2rem;
}

.deck-selector-option-accent-line {
    width: 3px;
    height: 3.2rem;
    border-radius: 9999px;
    background: var(--deck-color, #f97316);
}

.deck-selector-option-thumb {
    width: 3rem;
    height: 3.8rem;
    border-radius: 0.45rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.35);
}

.deck-selector-option-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.leader-result-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    border-radius: 0.55rem;
    border: 1px solid transparent;
    padding: 0.4rem;
    color: #e5e7eb;
    text-align: left;
}

.leader-result-item:hover,
.leader-result-item.is-active {
    border-color: rgba(249, 115, 22, 0.5);
    background: rgba(249, 115, 22, 0.12);
}

.leader-result-thumb {
    width: 2rem;
    height: 2.55rem;
    border-radius: 0.35rem;
    object-fit: cover;
    flex-shrink: 0;
}

.leader-result-label {
    min-width: 0;
    font-size: 0.83rem;
    color: #f3f4f6;
}

/* ============================= */
/* TABLA OPTIMIZADA */
/* ============================= */

.reportes-table {
    width: 100% !important;
    table-layout: auto;
}

/* Columna expandible responsive */
.reportes-table th:nth-child(1),
.reportes-table td:nth-child(1) {
    width: 2.4rem;
}

/* Resultado compacto */
.reportes-table th:nth-child(3),
.reportes-table td:nth-child(3) {
    white-space: nowrap;
}

/* Posición compacta */
.reportes-table th:nth-child(4),
.reportes-table td:nth-child(4) {
    white-space: nowrap;
}

/* Fecha, Tipo, Autor compactos */
.reportes-table th:nth-child(5),
.reportes-table td:nth-child(5),
.reportes-table th:nth-child(6),
.reportes-table td:nth-child(6),
.reportes-table th:nth-child(7),
.reportes-table td:nth-child(7) {
    white-space: nowrap;
}

/* Evento flexible pero con mínimo razonable */
.reportes-table th:nth-child(8),
.reportes-table td:nth-child(8) {
    min-width: 12rem;
}

/* Header */
.reportes-table thead th {
    background: linear-gradient(180deg, rgba(249, 115, 22, 0.85), rgba(194, 65, 12, 0.92));
    color: #fff;
    border-bottom: 1px solid rgba(251, 146, 60, 0.65);
    box-shadow: inset 0 -1px 0 rgba(194, 65, 12, 0.35);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0.85rem 1rem;
    white-space: nowrap;
}

.reportes-table tbody tr {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    transition: background-color 0.2s ease;
}

.reportes-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.reportes-table tbody tr:hover {
    background: rgba(249, 115, 22, 0.1);
}

.reportes-table tbody tr.report-row-clickable {
    cursor: pointer;
}

.reportes-table tbody td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    min-width: 0;
}

/* ============================= */
/* Leader card visual */
/* ============================= */

.report-deck-card {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    border-radius: 0.7rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(2, 6, 12, 0.82);
    padding: 0.45rem 0.65rem;
    min-width: 0;
}

.report-leader-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.report-deck-accent {
    display: flex;
    gap: 0.22rem;
    flex-shrink: 0;
}

.report-deck-accent-line {
    width: 4px;
    height: 2.65rem;
    border-radius: 9999px;
    background: var(--deck-color, #ef4444);
}

.report-deck-thumb {
    width: 2.55rem;
    height: 3.25rem;
    border-radius: 0.45rem;
    overflow: hidden;
    flex-shrink: 0;
}

.report-deck-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ============================= */
/* Responsive */
/* ============================= */

@media (max-width: 991.98px) {
    .reportes-table th:nth-child(2),
    .reportes-table td:nth-child(2) {
        min-width: 14rem;
    }

    .report-deck-card {
        width: 100%;
    }
}
.reportes-table-footer {
    margin-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    font-size: 0.85rem;
    color: #9ca3af;
}

.reportes-table-info {
    opacity: 0.75;
}

.reportes-table-pagination .dataTables_paginate {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    justify-content: flex-end;
    gap: 0.6rem;
    float: none !important;
    width: auto !important;
}

.reportes-table-pagination .dataTables_paginate span {
    display: flex !important;
    flex-direction: row !important;
    gap: 0.4rem;
}

/* Agrupa botones */
.reportes-table-pagination .dataTables_paginate span {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* Botones minimal */
.reportes-table-pagination .paginate_button {
    background: transparent !important;
    border: none !important;
    color: #9ca3af !important;
    padding: 0.25rem 0.6rem !important;
    border-radius: 0.4rem;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.reportes-table-pagination .paginate_button:hover {
    background: rgba(255,255,255,0.08) !important;
    color: #fff !important;
}

.reportes-table-pagination .paginate_button.current {
    background: rgba(249,115,22,0.25) !important;
    color: #fff !important;
}
/* ============================= */
/* DataTables controls styling */
/* ============================= */

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
    color: #9ca3af;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dataTables_wrapper select,
.dataTables_wrapper input {
    background: rgba(255,255,255,0.05) !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    color: #fff !important;
    border-radius: 0.6rem !important;
    padding: 0.35rem 0.6rem !important;
    font-size: 0.85rem !important;
    outline: none !important;
}

.dataTables_wrapper select:focus,
.dataTables_wrapper input:focus {
    border-color: #f97316 !important;
    box-shadow: 0 0 0 2px rgba(249,115,22,0.2);
}
/* ===== TOP CONTROLS LAYOUT FIX ===== */

.dataTables_wrapper .row:first-child {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Quita columnas bootstrap */
.dataTables_wrapper .row:first-child > div {
    width: auto !important;
}

/* Length a la izquierda */
.dataTables_wrapper .dataTables_length {
    margin: 0 !important;
}

/* Search a la derecha */
.dataTables_wrapper .dataTables_filter {
    margin: 0 !important;
    text-align: right !important;
}

/* Hace que el label no rompa línea */
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}
/* ===== PAGINATION FIX ===== */

.dataTables_paginate {
    float: none !important;
}

.dataTables_paginate ul.pagination {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
}

.dataTables_paginate ul.pagination li {
    display: inline-block !important;
}

.dataTables_paginate ul.pagination li a {
    background: transparent !important;
    border: none !important;
    color: #9ca3af !important;
    padding: 0.35rem 0.65rem !important;
    border-radius: 0.5rem !important;
    transition: all 0.2s ease;
}

.dataTables_paginate ul.pagination li.active a {
    background: rgba(249,115,22,0.25) !important;
    color: #fff !important;
}

.dataTables_paginate ul.pagination li a:hover {
    background: rgba(255,255,255,0.08) !important;
    color: #fff !important;
}
/* ===== Separar controles superiores de la tabla ===== */

.dataTables_wrapper > .row:first-child {
    margin-bottom: 1.5rem !important;
    padding: 0 0.25rem;
}

/* Opcional: que no hereden fondo extraño */
.dataTables_wrapper > .row:first-child {
    background: transparent;
}
.dataTables_wrapper > .row:first-child {
    margin-bottom: 1.5rem !important;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}
.reportes-top-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    width: 100%;
}

/* Fuerza izquierda */
.reportes-top-controls .dataTables_length {
    margin: 0 !important;
}

/* Fuerza derecha */
.reportes-top-controls .dataTables_filter {
    margin: 0 !important;
    margin-left: auto !important;
}

/* Evita salto de línea */
.reportes-top-controls label {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}
/* ============================= */
/* OVERRIDE DEFINITIVO CONTROLES */
/* ============================= */

#custom-table-controls .dataTables_length,
#custom-table-controls .dataTables_filter {
    display: flex !important;
    align-items: center;
    gap: 0.6rem;
    color: #9ca3af !important;
    font-size: 0.9rem;
}

/* Label limpio */
#custom-table-controls label {
    display: flex !important;
    align-items: center;
    gap: 0.6rem;
    margin: 0 !important;
    color: #9ca3af !important;
    font-weight: 500;
}

/* SELECT personalizado */
#custom-table-controls select {
    appearance: none;
    background: rgba(255,255,255,0.05) !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    color: #fff !important;
    border-radius: 0.7rem !important;
    padding: 0.4rem 0.8rem !important;
    font-size: 0.85rem !important;
    transition: all 0.2s ease;
}

/* INPUT personalizado */
#custom-table-controls input {
    background: rgba(255,255,255,0.05) !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    color: #fff !important;
    border-radius: 0.7rem !important;
    padding: 0.45rem 0.9rem !important;
    font-size: 0.85rem !important;
    min-width: 220px;
    transition: all 0.2s ease;
}

/* Focus naranja coherente */
#custom-table-controls select:focus,
#custom-table-controls input:focus {
    border-color: #f97316 !important;
    box-shadow: 0 0 0 2px rgba(249,115,22,0.25) !important;
    outline: none !important;
}

/* Quitar fondo blanco Bootstrap */
#custom-table-controls .form-select,
#custom-table-controls .form-control {
    background-image: none !important;
}
/* ============================= */
/* MOBILE TOP CONTROLS FIX */
/* ============================= */

@media (max-width: 991.98px) {

    .reportes-top-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.8rem;
    }

    .reportes-top-controls .dataTables_length,
    .reportes-top-controls .dataTables_filter {
        width: 100%;
    }

    .reportes-top-controls .dataTables_filter {
        margin-left: 0 !important;
    }

    .reportes-top-controls label {
        justify-content: space-between;
        width: 100%;
    }

    .reportes-top-controls input {
        min-width: unset !important;
        width: 100%;
    }
}
/* ============================= */
/* RESPONSIVE CONTROL ICON */
/* ============================= */

td.dtr-control {
    position: relative;
    cursor: pointer;
}

td.dtr-control::before {
    content: '▶';
    display: inline-block;
    font-size: 1.15rem;
    color: #f97316;
    font-weight: 700;
    transition: transform 0.2s ease;
}

tr.dtr-expanded td.dtr-control::before {
    transform: rotate(90deg);
}
/* ============================= */
/* RESPONSIVE DETAILS STYLE */
/* ============================= */

table.dataTable > tbody > tr.child ul.dtr-details {
    width: 100%;
}

table.dataTable > tbody > tr.child ul.dtr-details li {
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 0.6rem 0;
}

table.dataTable > tbody > tr.child ul.dtr-details li:last-child {
    border-bottom: none;
}

table.dataTable > tbody > tr.child span.dtr-title {
    color: #f97316;
    font-weight: 600;
    margin-right: 0.4rem;
}
@media (max-width: 991.98px) {

    /* Leader ocupa todo el ancho disponible */
    .reportes-table th:nth-child(2),
    .reportes-table td:nth-child(2) {
        width: 100% !important;
        min-width: 0 !important;
    }

    /* Quitamos padding lateral excesivo */
    .reportes-table tbody td {
        padding-left: 0.6rem;
        padding-right: 0.6rem;
    }

    /* Card leader ocupa todo */
    .report-deck-card {
        width: 100%;
    }
}
.reportes-table-wrap {
    overflow-x: auto;
}

.reportes-table {
    width: 100% !important;
    min-width: 100% !important;
    border-collapse: collapse;
}

/* Evita huecos superior/inferior que DataTables agrega por defecto */
.reportes-table.dataTable {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}
/* ===== FLECHA RESPONSIVE ANIMADA DEFINITIVA ===== */

table.dataTable.dtr-column > tbody > tr > td.dtr-control::before {
    content: "▸" !important;

    display: inline-block;
    font-size: 1.6rem !important;
    font-weight: 900 !important;
    color: #f97316 !important;

    transform: rotate(0deg);
    transform-origin: center;
    transition: transform 0.35s cubic-bezier(.4,0,.2,1),
                filter 0.25s ease;
}

/* Hover */
table.dataTable.dtr-column > tbody > tr > td.dtr-control:hover::before {
    filter: brightness(1.3);
}

/* 👇 ESTA ES LA CLAVE REAL */
table.dataTable.dtr-column > tbody > tr.parent > td.dtr-control::before {
    transform: rotate(90deg);
}

/* ===========================
   FIN: REPORTES
=========================== */
