/* ============================================
   Dashboard - Modulo Expedientes
   Scope: #tab-expedientes
   ============================================ */

/* ---------- Panel de filtros (colapsable) ---------- */
#tab-expedientes .expedientes-filtros-card {
    border-radius: 0.75rem !important;
    /* Permitir que dropdowns/submenús se vean fuera de la tarjeta */
    overflow: visible;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    position: relative;
    z-index: auto;
}

#tab-expedientes .expedientes-filtros-toolbar {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}

#tab-expedientes .btn-expedientes-filtros-toggle {
    border: none !important;
    background: transparent !important;
    color: inherit !important;
    box-shadow: none !important;
    max-width: 100%;
}

#tab-expedientes .btn-expedientes-filtros-toggle:hover,
#tab-expedientes .btn-expedientes-filtros-toggle:focus {
    background: rgba(13, 110, 253, 0.07) !important;
    color: inherit !important;
}

#tab-expedientes .expedientes-filtros-chevron-wrap {
    width: 2.35rem;
    height: 2.35rem;
    flex-shrink: 0;
    background: linear-gradient(145deg, rgba(13, 110, 253, 0.14), rgba(13, 110, 253, 0.06));
    color: var(--bs-primary, #0d6efd);
    transition: transform 0.2s ease, background 0.2s ease;
}

#tab-expedientes .btn-expedientes-filtros-toggle:hover .expedientes-filtros-chevron-wrap {
    background: linear-gradient(145deg, rgba(13, 110, 253, 0.22), rgba(13, 110, 253, 0.1));
}

#tab-expedientes .expedientes-filtros-chevron {
    font-size: 1.15rem;
    transition: transform 0.25s ease;
    display: block;
}

#tab-expedientes .btn-expedientes-filtros-toggle.collapsed .expedientes-filtros-chevron {
    transform: rotate(-90deg);
}

#tab-expedientes .expedientes-filtros-title {
    font-size: 1.05rem !important;
    letter-spacing: -0.01em;
}

#tab-expedientes .expedientes-filtros-subtitle {
    font-size: 0.82rem !important;
    font-weight: 400 !important;
    opacity: 0.85;
}

#tab-expedientes .expedientes-filtros-body {
    background: linear-gradient(180deg, rgba(248, 249, 250, 0.65) 0%, #fff 48%);
}

#tab-expedientes .expedientes-filtros-label {
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    color: var(--bs-body-color, #212529) !important;
    letter-spacing: 0.01em;
}

#tab-expedientes .expedientes-filtros-control,
#tab-expedientes .expedientes-filtros-card .form-control,
#tab-expedientes .expedientes-filtros-card .form-select {
    font-size: 0.9375rem !important;
    line-height: 1.45 !important;
    padding: 0.5rem 0.85rem !important;
    min-height: 2.75rem !important;
    border-radius: 0.5rem !important;
}

#tab-expedientes .expedientes-filtros-card #expedientes-filtro-abogado-btn {
    font-size: 0.9375rem !important;
    min-height: 2.75rem !important;
    border-radius: 0.5rem !important;
}

#tab-expedientes .expedientes-filtros-chip {
    padding: 0.5rem 1.1rem !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    border-radius: 0.5rem !important;
}

/* Botones pegados (btn-group): sin radios sueltos en cada botón */
#tab-expedientes .expedientes-filtros-estado-group .expedientes-filtros-chip {
    border-radius: 0 !important;
}

#tab-expedientes .expedientes-filtros-estado-group .expedientes-filtros-chip:first-child {
    border-radius: 0.5rem 0 0 0.5rem !important;
}

#tab-expedientes .expedientes-filtros-estado-group .expedientes-filtros-chip:last-child {
    border-radius: 0 0.5rem 0.5rem 0 !important;
}

#tab-expedientes .expedientes-filtros-estado-group .btn-outline-secondary.active {
    background-color: var(--bs-primary) !important;
    border-color: var(--bs-primary) !important;
    color: #fff !important;
}

/* Primera fila: en XL todo en una línea */
@media (min-width: 1200px) {
    #tab-expedientes .expedientes-filtros-row-main {
        flex-wrap: nowrap !important;
    }

    #tab-expedientes .expedientes-filtros-row-main > [class*="col-xl-auto"] {
        flex: 0 0 auto;
        width: auto;
        max-width: 100%;
    }
}

#tab-expedientes .expedientes-toolbar-btn {
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    padding: 0.5rem 1rem !important;
    border-radius: 0.5rem !important;
}

#tab-expedientes .expedientes-filtros-section-title {
    font-size: 1rem !important;
}

#tab-expedientes .expedientes-filtros-hint {
    font-size: 0.875rem !important;
    line-height: 1.45 !important;
}

#tab-expedientes .expedientes-filtros-advanced {
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.07) 0%, rgba(13, 110, 253, 0.02) 100%);
    border: 1px solid rgba(13, 110, 253, 0.14);
}

#tab-expedientes .expedientes-filtros-action {
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    padding: 0.5rem 1.15rem !important;
    border-radius: 0.5rem !important;
}

#tab-expedientes .expedientes-filtros-card .dropdown-menu {
    font-size: 0.9rem !important;
    /* Por encima de la tabla (z-index ~1002) pero por debajo de modales Bootstrap (1055+) */
    z-index: 1045 !important;
}

#tab-expedientes .expedientes-filtros-card .dropdown-item {
    padding: 0.45rem 1rem !important;
}

/* Scroll horizontal suave si carátula/tribunal expanden; evita recortar "Ver más" */
#tab-expedientes .expedientes-table-wrap.table-responsive,
#tab-expedientes .expedientes-table-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

#tab-expedientes #expedientes-unified-table {
    /* auto: columnas crecen con el texto; scroll horizontal en .expedientes-table-wrap */
    table-layout: auto !important;
    width: auto !important;
    min-width: 100% !important;
    max-width: none !important;
    font-size: 0.72rem !important;
}

#tab-expedientes #expedientes-unified-table th {
    font-size: 0.68rem !important;
    padding: 0.3rem 0.2rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

#tab-expedientes #expedientes-unified-table td {
    font-size: 0.72rem !important;
    padding: 0.3rem 0.2rem !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    min-width: 0 !important;
}

#tab-expedientes #expedientes-unified-table tbody tr {
    transition: background-color 0.2s ease;
    /* Evita heredar nowrap del .table global y romper carátula/tribunal */
    white-space: normal !important;
}

#tab-expedientes #expedientes-unified-table tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.1) !important;
}

#tab-expedientes #expedientes-unified-table tbody tr:active {
    background-color: rgba(0, 123, 255, 0.2) !important;
}

/*
 * Anchos relativos (~100%) + min-width:0 en celdas — sin min-width en px que fuercen scroll
 */
#tab-expedientes #expedientes-unified-table th:nth-child(1),
#tab-expedientes #expedientes-unified-table td:nth-child(1) {
    width: 2.2% !important;
    text-align: center !important;
}

/* Número: ancho un poco mayor + envoltura para ver el expediente completo (p. ej. J-01-…/2023-1) */
#tab-expedientes #expedientes-unified-table th:nth-child(2),
#tab-expedientes #expedientes-unified-table td:nth-child(2) {
    width: 12% !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    vertical-align: top !important;
    hyphens: manual !important;
}

#tab-expedientes #expedientes-unified-table th:nth-child(3),
#tab-expedientes #expedientes-unified-table td:nth-child(3) {
    width: 18% !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    vertical-align: top !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
}

#tab-expedientes #expedientes-unified-table th:nth-child(4),
#tab-expedientes #expedientes-unified-table td:nth-child(4) {
    width: 18% !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    vertical-align: top !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
}

#tab-expedientes #expedientes-unified-table td:nth-child(3) .exp-celda-texto-completo,
#tab-expedientes #expedientes-unified-table td:nth-child(4) .exp-celda-texto-completo {
    display: block !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    line-height: 1.35 !important;
}

#tab-expedientes #expedientes-unified-table th:nth-child(5),
#tab-expedientes #expedientes-unified-table td:nth-child(5) {
    width: 3.8% !important;
    text-align: center !important;
}

#tab-expedientes #expedientes-unified-table th:nth-child(6),
#tab-expedientes #expedientes-unified-table th:nth-child(7),
#tab-expedientes #expedientes-unified-table th:nth-child(8),
#tab-expedientes #expedientes-unified-table td:nth-child(6),
#tab-expedientes #expedientes-unified-table td:nth-child(7),
#tab-expedientes #expedientes-unified-table td:nth-child(8) {
    width: 5% !important;
    text-align: center !important;
}

#tab-expedientes #expedientes-unified-table th:nth-child(9),
#tab-expedientes #expedientes-unified-table td:nth-child(9) {
    width: 9% !important;
    text-align: center !important;
    overflow: hidden !important;
    white-space: normal !important;
}

#tab-expedientes #expedientes-unified-table th:nth-child(10),
#tab-expedientes #expedientes-unified-table td:nth-child(10) {
    width: 4.5% !important;
    text-align: center !important;
}

#tab-expedientes #expedientes-unified-table th:nth-child(11),
#tab-expedientes #expedientes-unified-table td:nth-child(11) {
    width: 5% !important;
}

#tab-expedientes #expedientes-unified-table th:nth-child(12),
#tab-expedientes #expedientes-unified-table td:nth-child(12) {
    width: 5% !important;
}

#tab-expedientes #expedientes-unified-table th:nth-child(13),
#tab-expedientes #expedientes-unified-table td:nth-child(13) {
    width: 7.5% !important;
    text-align: center !important;
}

/* Estado select — cabe en la columna sin ensanchar la tabla */
#tab-expedientes #expedientes-unified-table .exp-estado-cell {
    min-width: 0 !important;
    overflow: hidden !important;
    white-space: normal !important;
}

#tab-expedientes #expedientes-unified-table .exp-estado-select {
    font-size: 0.68rem !important;
    padding: 0.25rem 1.5rem 0.25rem 0.35rem !important;
    min-height: 1.65rem !important;
    width: 100% !important;
    max-width: 100% !important;
    line-height: 1.25 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Truncado Carátula/Tribunal: reglas definitivas en dashboard.css y layout-scale.css (final de archivo) */

/* Configuración: fila PJN/EJE/MEV/SRT por abogado — que Exportar/Vaciar no se colapsen a 0px */
#tab-configuracion #lawyers-list .lawyer-sistema-row {
    gap: 0.5rem;
}
#tab-configuracion #lawyers-list .lawyer-sistema-row > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}
#tab-configuracion #lawyers-list .lawyer-sistema-row .btn-group {
    flex-shrink: 0;
}
